Overview of default date output steps in Oracle struts2

Source: Internet
Author: User

The default date output operations in Oracle struts2 do not match our Chinese daily output habits. the following describes how to correctly format the date output in struts2. We hope you will have a better understanding of the default date output in Oracle struts2.

1. Use <s: date> for formatting. For example:

<S: date name = "birthday" format = "yyyy-MM-dd"/> outputs the attribute birthday in the format of yyyy-MM-dd.

2. Use <s: param> to format the file. For example:

 
 
  1. <s:textfield name="birthday" > 
  2. <s:param name="value"><s:date name="birthday" format="yyyy-MM-dd"/></s:param> 
  3. </s:textfield> 

Or <input type = "text" value = "<s: date name =" birthday "format =" yyyy-MM-dd "/>"/>

Another method is to internationalize:

First, configure struts. custom. i18n. resources = globalMessages in struts. properties.

Add the following content to the globalMessages_zh_CN.properties and globalMessages_en_US.properties files:

 
 
  1. global.datetime = {0, date, yyyy-MM-dd HH:mm:ss}  
  2. global.date = {0, date, yyyy-MM-dd}  

Finally, you can use the following statement on the page to format and output the date.

<S: textfield name = "birthday" value = "% {getText ('Global. date', {birthday})}"/> -- golbal. date Style

<S: textfield name = "birthday" value = "% {getText ('Global. datetime', {birthday})}"/> -- global. datetime Style

The above content is a description of the display problem of the date input in Oracle struts2, hoping to help you in this aspect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.