Here is the class declaration :
public class DoSearchAction extends DispatchAction
{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException
{
SearchForm s = (SearchForm) form;
String dispatchString = s.getDispatch();
System.out.println("Main Dispatch String : " + dispatchString);
// manually dispatching works but is ugly
//if ("run_main_search".equals(dispatchString)) { return
runMainSearch(mapping, form, request, response);}
//if ("save_defaults".equals(dispatchString)) { return
setAsDefaults(mapping, form, request, response);}
return mapping.findForward("error");
}
public ActionForward runMainSearch(ActionMapping mapping, ActionForm
form, HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException
{
SearchForm s = (SearchForm) form;
System.out.println(s.getDispatch());
return mapping.findForward("gms");
}
public ActionForward setAsDefaults(ActionMapping mapping, ActionForm
form, HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException
{
System.out.println("Hello from save defaults");
return mapping.findForward("confirm_save_defaults");
}
}
Any ideas?
Wendy Smoak wrote:
From: "Troy Bull" <[EMAIL PROTECTED]>
The problem is my dispatch parameter is not being recognized. I have
the following code in my ActionForward execute method:
SearchForm s = (SearchForm) form;
String dispatchString = (String) request.getAttribute("dispatch");
Try request.getParameter("dispatch"); instead if you want to see what
was submitted with the form. (Request parameters are not the same as
request attributes.) But it looks okay, because the form bean
property was populated.
what I want is the method run_main_search to execute instead.
Java naming conventions would point to runMainSearch, but okay. :)
Does your DoSearchAction extend DispatchAction? (You mention your
"ActionForward" execute method-- typo?) If you've overridden the
'execute' method to print debugging statements, are you calling
super.execute(...)?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]