• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 convertion type

 
Carlos Mendoza
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !
Does Struts 2 provides automatic data type conversion?
I've tried to get data form (e.g dates), and i still get only String data, my struts.xml extends struts-default (struts ver 2.0.14), i don't know what's wrong
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you've provided no code, configuration, anything, it's impossible to help. Yes, S2 provides date conversion, as described in the type conversion doc page.
 
Carlos Mendoza
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh sorry!

This is the struts.xml

 
Carlos Mendoza
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the file pages.xml


[/code]
 
Carlos Mendoza
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the formAjuste.jsp




this is a part of class com.primero.action.pages.AjustesAction

 
Carlos Mendoza
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i have an Ajuste object property in my class com.primero.action.pages.AjustesAction i use it to set and get the values from the form,
the Ajuste class has 2 Date object properties



i try to set the values from my jsp in my Ajuste object in this way:



but when i execute the method insertOrUpdate i get the following error for both AJUSTEPERIODOFIN and AJUSTEPERIODOINICIO properties:



 
Carlos Mendoza
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have to use


in my action, to get the string date, and convert it to Date object and set it to my Ajuste object.
 
Carlos Mendoza
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i made a mistake above

this is how i try to set the form data to my Ajuste object

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic