Two questions about struts2

Source: Internet
Author: User

I haven't written anything for a long time. I 've been taking an experiment over the past two days. Let's take a look at the following questions:

1. Regarding filterdispatcher filtering in struts2, the official filtering method is:/*. In fact, the default filtering method is *. action. You can use default in the struts2 core class library. properties (ORG/Apache/struts2 in the struts2-core-2.0.11.jar package) to find the definition:

...... <Br/>### used by the defaultactionmapper <br/> ### you may provide a comma separated list, e.g. struts. action. extension = action, JNLP, DO <br/> struts. action. extension = action <br/> ......

If you want to modify the file, I have read some documents about modifying this file and re-compile and generate a new jar package to replace it. However, this method is still quite troublesome. In fact, you can directly modify struts. XML, add a constant:

<Constant name = "struts. Action. Extension" value = "action, HTML, shtml"/>

 

2. Another student asked struts2 about struts2xml verification: After the XML verification framework provided in struts2.0 is used, error messages on the page are accumulated and submitted several times, several error messages are displayed. This is a good question. I will briefly discuss the solution:

The action class needs to implement the prepareable interface and implement the prepare method in it, and call the clearerrorsandmessage () method in the prepare method, so that everything is normal.

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.