Java Learning Notes (2)--struts2 type conversion, data validation important points of knowledge

Source: Internet
Author: User

1, *action.conversion-properties

such as (Point=com.test.converter.pointlistconverter)

Configuration file for the specific action class

2, *action.properties

such as (INVALID.FIELDVALUE.GRADUATION=\U6BD5\U4E1A\U65E5\U671F\U8F93\U5165\U9519\U8BEF)

Configuration file for specific field error message

2, in Struts.xml

            <Actionname= "Register"class= "Com.test.action.RegisterAction">                <resultname= "Success">/registersuccess.jsp</result>
When an error message occurs, Struts automatically finds the input tag of the current action and performs a jump
          <result name= "Input">/register.jsp</result> </Action>

3, struts.xml label description

The description of which constants need to be used in the constant--struts framework, which can be used as the basis for configuring global type conversions in the Type conversion section

Other configuration files included with include--

4. Struts local type Conversion error configuration method

A) Create the *.properties file in the same sibling directory as the corresponding *action

b) Fill in the Invalid.fieldvalue.fieldname= error message

5. Struts Global type Conversion error configuration method

A) Add constant tags to struts.xml

<name= "Struts.custom.i18n.resources"  value= "message"  ></constant>

b) Create the message.properties file in the SRC directory

c) fill in xwork.default.invalid.fieldvalue=[0] Error

6, Native2ascii Javac character conversion to ASCII code method

A) cmd--nativce2ascii source file. txt converted file. properties

7, type conversion is not successful int value will be given 0

8. When a type conversion is not possible, the STRUTS2 framework automatically adds the error through Addfielderror ()

Java Learning Notes (2)--struts2 type conversion, data validation important points of knowledge

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.