Structs2 <s:date> <s:debug> <s:property> Description

Source: Internet
Author: User

Label Display Date

First, the main use of the <s:date> tag as an example. For example: <s:date name= "Publishtime" format= "Yyyy-mm-dd HH:mm:ss. SSS "/> Here format meaning: Yyyy-mm-dd month day HH:mm:ss. SSS hours and seconds milliseconds

But there are a few subtle areas to note:
1, "Yyyy-mm-dd" in the "MM" must be capitalized, otherwise it will not work or the time display is not normal. Because in Java, large m means "month", while small m means "minute" (minute)
2, the following "HH" means 24-hour system, and if it is "HH", then the display is 12-hour system
3, there is a point: s:date tag when used, it must be the date type.

Second, if it is a string type, numeric type, and other types, you can use the following methods:
1. Define the following in the resource file first: Format.date_medium={0,date,medium}
FORMAT.DATE_YMD={0,DATE,YYYY/MM/DD}
Format.date_time={0,date,yyyy/mm/dd hh:mm}

2. Then you are free to format: <s:text name= "Format.date_ymd" >
<s:param name= "value" value= "Publishtime"/>
</s:text>

Debug label

the debug tag is primarily used for auxiliary testing, which generates a hyperlink on the page that allows you to view all the value information in the Valuestack and stack Context. with the debug tag there is only one id attribute, and this property is just a reference ID for that element. Add <s:debug/> tags on the page, through the Debug tab, you can see all the information in the Valuestack in the system, and you can see the properties in the stack context.

Usage is inserted in JSP page: <s:debug></s:debug> tag

Clicking the [DEBUG] connection to the return page is the result of the following, where you can clearly see all the value information in the Valuestack and stack Context.

This value stack is also divided into two value stack Contents and Stack Context.

(1) Valuestack is very simple, the inside is the Action property. If you jump through multiple actions by chain, it will contain the properties of more than one action. For example Fielderror, error, actionerror these inherit from the Actionsupport class. The information inside the Value Stack Contents can be accessed directly using <s:property value= "SSS" >.

(2) The stack context is saved in the form of a map type, which contains a series of objects, including Request,session,attr,application,map. The information inside the Stack Context can be accessed <s:property value= "#sss" >.

Property label

When using the property tag:

1. The function of the Property object can be called by <s:property value= ' phoneno.substring (0, 3) + "* * * *" + phoneno.substring (7) '/>.

2. You can also call the custom function of the class that contains the action that entered the page: <s:property value= "%{getclob (content)}"/>

Structs2 <s:date> <s:debug> <s:property> Description

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.