Struts2 learning type conversion -- defatypetypeconverter

Source: Internet
Author: User

1. struts2 type conversion, for 8 element data types and java. util. for common data such as Date and String, struts2 can use the built-in type converter for automatic conversion. However, for custom object types, We need to specify the type conversion method by ourselves. 2. For a custom type converter, three information is required: The Action name, the attribute name to be converted in the Action, and the converter corresponding to this attribute. The Action is named by struts. the property name to be converted in the Action obtained in the xml property file is obtained by the key in the xxx-conversion.properties property file, and the converter corresponding to the property is obtained by the value corresponding to the key. For example, the conversion between a string and an object. Create the following directory structure, import the jar package related to struts2, and configure the PreparedAndExecuteFilter index in xml. the code in jsp is as follows: [html]

Related Article

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.