File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Unable to fetch Request Parameters in customized Interceptor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Unable to fetch Request Parameters in customized Interceptor" Watch "Unable to fetch Request Parameters in customized Interceptor" New topic
Author

Unable to fetch Request Parameters in customized Interceptor

prav gup
Greenhorn

Joined: Jun 15, 2013
Posts: 2
I have written a validation Interceptor, in which I am retrieving the parameters from parameterMap.



I am facing a problem when I am trying to fetch the value of params.get("searchValidationString"), it is returning Object, casting to String is giving Class cast exception



this check is returning false

and



this block is printing the reference instead of value.

I am unable to get the string value from the request parameter ,which I need in interceptor for comparison.
prav gup
Greenhorn

Joined: Jun 15, 2013
Posts: 2
I got the problem, problem is with the piece of code following:-
Object SearchString = params.get("searchValidationString");

this code returns the String[] instead of String. Casting it to the String[], then taking the [0] element solves the issue.
I am surprised to see that no one explains this in any interceptor example I have refered.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to fetch Request Parameters in customized Interceptor
 
Similar Threads
Ideas Needed to insert Action execution time in DB !!
Unable to fetch results using createQuery
struts2 login interceptor not finding session attribute of user details.
Caching rendered html in jsp
Servlets/HTTP