wood burning stoves 2.0*
The moose likes Struts and the fly likes Data conversion in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Data conversion in Struts" Watch "Data conversion in Struts" New topic
Author

Data conversion in Struts

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9398
    
    2

Guys,

Is there any framework to availd duplication of my data conversion of my request parameters in the validate method and in the TO object?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm afraid I don't understand the question. Could you explain in greater detail what it is you're trying to do?
[ April 14, 2008: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9398
    
    2

Yes, imagine I have a date field in my html form and also it is a mandatory field. Now when I validate it, I have to convert it to a Date type in my ActionForm calss. When the validation succeeds, I have to send it to the TO where I need to convert the String to a Date format in my Action class. So I was thinking that there might be a method something like BeanUtils and so on...?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm not aware of any Struts utility that will do this. One of the weaknesses of Struts 1 is the fact that it offers little help in converting from Strings to other data types. You will find the support for this much greater in Struts 2.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9398
    
    2

Thanks. You have been helpful!
 
Don't get me started about those stupid light bulbs.
 
subject: Data conversion in Struts