Common struts2 labels

Source: Internet
Author: User
Struts2 common labels Summary 1. the role of struts2 the struts2 tag Library provides topic and template support, greatly simplifying the writing of view pages. In addition, the topics and templates of struts2 provide excellent scalability. Achieves better code reuse. Struts2 allows the use of custom components on the page, which can fully meet the complex and variable page display requirements in the project. The struts2 tag library has a huge improvement. The tags of the struts2 tag library do not rely on any performance Layer Technology. That is to say, strtus2 provides most of the labels and can be used in various performance technologies. Including the most common JSP pages, we can also say that velocity, freemarker, and other template technologies are used 2. struts2 classification (1) UI tags: (user interface, user interface) tags are mainly used to generate HTML element tags. UI tags can be classified into Form tags, non-form tags (2) Non-UI tags, it is mainly used for data access and logic control tags. Non-UI labels can be divided into Process Control labels (including labels used to implement process control such as branch and loop) and data access labels (mainly including the value of valuestack output by users and functions such as internationalization) (3) Ajax tag 3. preparations before using the struts2 Tag: (1) introduce the tag Library to the JSP page of the tag to be used: <% @ taglib uri = "/Struts-tags" prefix = "S" %> (2) in the web. <filter> <filter-Name> struts2 </filter-Name> <filter-class> Org. apache. struts2.dispatcher. ng. filter. strutsprepareandexecutefilter </filter-class> </filter> 4. tag use (1) the property tag is used to output the specified value: <s: property value = "% {@ cn. csdn. HR. dom Ain. user @ name} "/> <br/> <s: property value =" @ cn. csdn. HR. domain. user @ name "/> <br/> <! -- Either of the above methods can be --> <s: property value = "% {@ cn. csdn. HR. domain. user @ Study ()} "/> the preceding method can be used to access the attributes of a class in a package. Study () is the method for accessing and outputting the class attributes. The following code is replaced by the Java code to access the attributes within a certain range <% // use the pagecontext object into the page range memory to verify that # the ATTR search sequence starts from the page, the search sequence is page, reques, session, and application. When the set value is stored, the request is saved. when accessing the JSP page, you can directly access the page without adding any identifiers. If different scopes are different, pagecontext. setattribute ("name", "laoowang", pagecontext. page_scope); %> <s: property value = "# ATTR. name "/> assume that tags of different scopes are configured in the action to access tags of different scopes: 

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.