This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes problems with custom converters and move from Struts 2.0.11 to 2.1.6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problems with custom converters and move from Struts 2.0.11 to 2.1.6" Watch "problems with custom converters and move from Struts 2.0.11 to 2.1.6" New topic
Author

problems with custom converters and move from Struts 2.0.11 to 2.1.6

Nikos Andreou
Greenhorn

Joined: Mar 16, 2009
Posts: 1
Hi there

I am currently studying struts 2. I got a book to assist me, Struts 2 Design and Programming by Budi Kurniawan. I am happy with the book and I am working on the section with custom converters. However, although one of my sample apps work with struts 2.0.11, it fails to work with 2.1.6. My action class is this:



Then I have two converters:



and



As you can see, I already changed the import of

com.opensymphony.xwork2.util.TypeConversionException

to

com.opensymphony.xwork2.conversion.TypeConversionException

My web.xml according to 2.1.6 instructions:



However, in MyDateConverter

ServletContext servletContext = (ServletContext)
context.get(StrutsStatics.SERVLET_CONTEXT);

returns null. After debugging the application, I found that

com.opensymphony.xwork2.conversion.impl.XWorkConverter gives an exception in line 282



Following this, I get to the point where

ognl.OgnlRuntime.callAppropriateMethod

fails and give me an exception



for method setTransactionDate



After that, it constructs the message

Error setting expression 'transactionDate' with value '[Ljava.lang.String;@12933cb'

I am really stuck and have no clue what is wrong. The code can be downloaded at http://jtute.com/download/Struts2.zip. The application is app7b. Any help is appreciated.
 
Consider Paul's rocket mass heater.
 
subject: problems with custom converters and move from Struts 2.0.11 to 2.1.6
 
Similar Threads
jsp tag pagination and tiles
from struts 2.0. to 2.1 - tokenSession
Problem with conversion
Type Conversion Problem
strtus 2 application error