Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

beans properties and modelDriven in struts 2  RSS feed

 
teddy clayton
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!