Tutorials to .com

Tutorials to .com » Jsp » Tapestry-hivemind » Tapestry data format conversion and storage of the study between 1

Tapestry data format conversion and storage of the study between 1

Print View , by: iSee ,Total views: 6 ,Word Count: 389 ,Date: Thu, 16 Apr 2009 Time: 2:14 AM

On the one hand, the application of the data displayed to the user to see, on the other hand need to be saved to the database. The purpose of these two forms of data may be different.
For example:
1, the user can see the gender is "male" and stored in the database is "0" - This type of data is code data;
2, the number of users is "1214235.30", and is stored in the database, "1214235.3" - This type of data format belongs to the control, may be associated with localization-related.

The above data for display and storage on the differences in how tapestry Design and resolved it? Please read on ...

First, data formatting
1, enter the domain user can input data components, such as: TextField.
Set translator property needs, if it is data conversion code is inherited from AbstractTranslator, if the data format conversion is inherited from FormatTranslator.

If it is inherited from AbstractTranslator, you need to achieve parseText methods methods and formatObject.
FormatObject which method is carried out in order to show the conversion, it is converted to string objects, because the client is shown in the string;
parseText method is to store and carry out background processing and conversion, it is to convert a string to object, because the background objects are handled.

2, the output domain user can not input data components, such as: Insert
Insert the format attribute set for the sub-class Examples java.text.Format.

Second, data storage format
This situation occurred in the imported components. Please refer to the first note of the parseText.

Therefore, Tapestry formatting of data processing through the translator and the format in two ways to deal with.

tapestry & hivemind Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.