Meaningless Drivel is fun!
The moose likes Struts and the fly likes DispatchAction problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DispatchAction problem" Watch "DispatchAction problem" New topic

DispatchAction problem

Mattia Merenda
Ranch Hand

Joined: Dec 14, 2006
Posts: 47
Hi everybody,
in my application I have a form where I need to get some results from a database.
In this form there are 2 buttons that call 2 JSP pages because I need one JSP page to know the results from the database as they are and the other one to know total results for every user is in the table of my database.
I handle these buttons in my Action class by extending my Action class as DispatchAction.In my struts-config.xml file I define for this Action class the parameter "results_type" to work with the 2 buttons.
For the pagination of my tables in my JSP pages I use Displaytag.It is also working fine and I can also save these tables in the PDF format.But,in the user table I added a link for every user and it is possible to see a chart about user's work with this link.
If I try to see the table in the PDF format before to see the chart for an user,it works fine.The problem that I have is when I decide to see for first the chart for a user, to come back in my JSP page with the table and I try to see the table in the PDF format.I get this error:

javax.servlet.ServletException: Request[/joblogs] does not contain handler parameter named 'result_type'. This may be caused by whitespace in the label text.

So,I think I was able to save the table in the session so when I go back I can see the table as it was before.But,if I try to click the PDF label to see my label,I cannot do this because it is not possible to know the value of the parameter "result_type".
How can I solve this problem?
I need a solution before Wednesday.
Ashish Tahasildar

Joined: Dec 10, 2006
Posts: 12
Hi Mattia Merenda,
This whitespace problem dosent give any error on JSP but backend it throws error. This error can be resolve if you override the method execute of DispatchAction shown as below:

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {

String ls_action= new String("unspecified");
if( form instanceof CompanyProfileForm){
try {
YourFormname yourForm = (YourFormname ) form;
String methodName = yourForm .getResult_action();
return dispatchMethod(mapping,form,request,response,methodName);
}catch(Exception e) {
ls_action = new String("unspecified");
return mapping.findForward(ls_action);

try adding this code in your DispatchAction you wont get the whitespace error. ok
let me know if you got any problem

Surya Lanka

Joined: Dec 14, 2006
Posts: 6
The above solution seems to be working...Thanks...

Surya L
Have you checked out Aspose?
subject: DispatchAction problem
jQuery in Action, 3rd edition