aspose file tools*
The moose likes Struts and the fly likes beans properties and modelDriven in struts 2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "beans properties and modelDriven in struts 2" Watch "beans properties and modelDriven in struts 2" New topic
Author

beans properties and modelDriven in struts 2

teddy clayton
Greenhorn

Joined: May 21, 2012
Posts: 9
I am new to struts 2
i created an action class that insert data from JSP page to a bean using modelDriven interface.

the problem is that i have some non string properties in the bean like Long, Date ... etc
the problem is:
when i press submit button in the jsp page i get an error saying that it did not find the a string setter for that particular property.
for example if i have in my bean




when the action class that implement the model driven is exectuted, it fires a run time exception




is there anyway to solve this problem without writing a String setter for my Date property?
teddy clayton
Greenhorn

Joined: May 21, 2012
Posts: 9
well i found that struts implicit conversion from string to date will use my local system format which is mm/dd/yyyy, there fore when i pass for example this date 15/04/2012 it fails because there is month 15.
i think what i need is custom converter.
my problem now is how to make the custom converter global. i don't want to copy the converter in every place i need the conversion, why not to put in global place and every action that needs it will refer to it.
how can i do that?

regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: beans properties and modelDriven in struts 2