In the direct <s:textfield also to date format, usually use the date format is used in the <s:date label directly display, then how to do it now, summed up there are the following three format of the way 1. Use <s:date> to format. such as: <s:date name= "date" format= "YYYY-MM-DD"/ > is to output the attribute date in YYYY-MM-DD format . 2. Use <s:param> for formatting. such as: <s:textfield name= "Date" > <s:param name= "Value" ><s:date name= "date" format= "Yyyy-mm-dd"/></s:param> </s:textfield> or <input type= "text" value= "<s:date name=" Date " format=" Yyyy-mm-dd " />" /> 3. Another way to do this is through an international approach: first Configure struts.custom.i18n.resources=globalmessages in Struts.properties Then add the following content to the Globalmessages_zh_cn.properties and globalmessages_en_us.properties files: global.datetime = {0, date, yyyy-mm-dd hh:mm:ss} GLOBAL.DATE&NBSP;=&NBSP;{0,&NBSP;DATE,&NBSP;YYYY-MM-DD} Finally, use the following statement in the page to achieve the format of the date output . <s:textfield name= "date" value= "% {getText (' global.date ', {date})} '/> --golbal.date style <s:textfield name= ' Date ' value= "%{gettext (' Global.datetime ', {date})}"/> --global.datetime style
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.