I am new to Struts and am trying to use the LookupDispatchAction class to display a 
page for the first time (i.e. the user is being navigated to this page from another 
page).

I have everything setup fine in my struts_config.xml and Struts attempts to display my 
page, but was giving the following error:

Request[/lookup] does not contain handler parameter named submit

After researching on the archives, I realized that this message is due to the fact 
that the user has not yet clicked any of the "submit" button on this page (the page 
hasn't even been displayed yet). The suggestion on the archive is to implement 
something similar to the following in the Action class which extends 
LookupDispatchAction:

 public ActionForward execute(ActionMapping actionMapping,
         ActionForm actionForm,
         HttpServletRequest httpServletRequest,
         HttpServletResponse httpServletResponse)
   throws Exception
 {
  if (httpServletRequest.getParameter(actionMapping.getParameter()) == null)
  {
   return defaultMethod();
  }
  else
  {
   return super.execute(actionMapping, actionForm, httpServletRequest,
         httpServletResponse);
  }
 }


My question is what do I return from "defaultMethod"? I have to return an 
ActionForward but I don't want to forward the user anywhere -- I want to display the 
page. How do I do this? I guess I could have 2 pages and 2 actions -- one to display 
the page initially and one to process the page upon "submit" -- but that is ugly and I 
hope not the only solution.

 



---------------------------------
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day

Reply via email to