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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 convertion type" Watch "Struts 2 convertion type" New topic
Author

Struts 2 convertion type

Carlos Mendoza
Greenhorn

Joined: Sep 14, 2009
Posts: 22
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Sep 14, 2009
Posts: 22
Oh sorry!

This is the struts.xml

Carlos Mendoza
Greenhorn

Joined: Sep 14, 2009
Posts: 22
this is the file pages.xml


[/code]
Carlos Mendoza
Greenhorn

Joined: Sep 14, 2009
Posts: 22
this is the formAjuste.jsp




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

Carlos Mendoza
Greenhorn

Joined: Sep 14, 2009
Posts: 22
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

Joined: Sep 14, 2009
Posts: 22
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

Joined: Sep 14, 2009
Posts: 22
sorry i made a mistake above

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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 convertion type
 
Similar Threads
Sample Struts Application
HttpSession management in Struts 2 using Jquery Ajax
extract url
Clarification of Concept: DataSource of Struts
How to share a context (Struts and servlet)