Most of the time, we use struts 2The built-in type converter can meet most of the type conversion requirements. However, in some special cases, if you want to convert a string into a composite object, you need to use a custom type converter.
To
1, Introduction interface attributeconverter This interface is used to convert entity properties, but the id attribute and the Relationship property are not available. It has two methods:1, y Converttodatabasecolumn (x) Action: The entity attribute
I. Custom Converters 1. OverviewSTRUTS2 provides a generic type converter that can be used for conversions of common data types, but you need a custom converter if the target type is a special type. STRUTS2 type converters are actually implemented
GreenDao custom type converter and code obfuscation configuration in the Android ORM series, ormgreendao
Sometimes, our entity classes have some attributes, but there is no corresponding type in the database. In this case, we need to customize the
GreenDao custom type converter and code obfuscation configuration in the Android ORM Series
Sometimes, our entity classes have some attributes, but there is no corresponding type in the database. In this case, we need to customize the converter for
The Web layer uses the Spring MVC framework to pass the queried data to the app side or client, which is fine, but the pit is a property of the date type in the entity class, but you have to return it to it before you format it well. Honestly, I've
Sometimes there are some attributes in our entity classes, but there are no corresponding types in the database, and we need custom converters for type conversions. The most common treatment is the date type. If the accuracy requirement is not high,
Type converters are divided into global type converters and local type converters. Global type conversions work for all actions, while local type converters target an actionOne, global type converter. Convert string x, Y to pointlogin.jsp
Preface: For the basic data types of Java and some system classes (such as Date class, Collection Class), STRUTS2 provides built-in type conversion functionality, but there are some limitations. So the custom type converter is shownFirst, apply to
Requirements Scenario: When some of the data stored in the database needs to be encrypted, the page needs to be displayed normally. That's what we need. A custom type converter that decrypts char or VARCHAR2 through a custom type converter when
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.