That's exactly my point. If there is no "submit=xxx" parameter/value to the action, then it throws a NullPointerException. So my action works like this:
/admin/list.do?submit=Refresh But not like this: /admin/list.do In the second case, there is no submit parameter. For now, anything I want to go to the list for the firs titme, I have it going to the first representation. But what I really want is for it to have a default behavior when no submit value is present so I can use the second form of the URL instead. That was why I originally posted. The initial wave of replies suggested I could use 'unspecified', but that didn't work. So, is the answer: (a) I should never use the second form because it is evil (b) I could use the second form but its broken in LookupDispatchAction (c) something else? Regards, Brian. Mark Shifman <[EMAIL PROTECTED]> 03/25/2004 08:51 AM Please respond to "Struts Users Mailing List" To: Struts Users Mailing List <[EMAIL PROTECTED]> cc: Subject: Re: LookupDispatchAction default Look at the sourc for LookupDispatchAction snippet below: public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Identify the request parameter containing the method name String parameter = mapping.getParameter(); if (parameter == null) { String message = messages.getMessage("dispatch.handler", mapping.getPath()); throw new ServletException(message); } // Identify the string to lookup String name = request.getParameter(parameter); if (name == null) { String message = messages.getMessage("dispatch.parameter", mapping.getPath(), parameter); throw new ServletException(message); } It looks for the parameter's value and throws if the name is null so it never gets a chance to get to unspecified in Dispatch action. mas Brian Sayatovic/AMIG wrote: >Well, I tried overriding unspecified and I still get the following (mind >you that I didn't change the parameter name yet) when I hit >/admin/list.do: > > Error 500: Request[/admin/list] does not contain handler parameter >named submit > >My unspecified method I simply overrode from DispatchAction to call my >normal refresh list method: > > protected ActionForward unspecified( > ActionMapping mapping, > ActionForm form, > HttpServletRequest request, > HttpServletResponse response > ) { > return this.refreshList(mapping, form, request, response); > } > >While the JavaDocs do imply this should work, when I looked in the Struts >1.1 source, the execute method of LookupDispatchAction generates the erorr >message I see as soon as request.getParameter(parameterName) returns null. > In fact, I can find no reference to 'unspecified' anywhere in >LookupDispatchAction. > >So I think there is a disconnect. Maybe LookupDispatchAction is broken >and should be fixed to also use 'unspecified', or maybe its JavaDocs >should explicitly state that it does not utilize the 'unspecified' >behavior of its parent class. Or, maybe I missed something and didn't >implement correctly? > >Regards, >Brian. > > > > >Mark Lowe <[EMAIL PROTECTED]> >03/24/2004 09:21 AM >Please respond to "Struts Users Mailing List" > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > cc: > Subject: Re: LookupDispatchAction default > > > >unspecified() is the method you want look at the javadoc. > >you do need the method name though > >/admin/list.do?method > >I saw that using "submit" as the parameter name causes problems so i >wouldn't use that. > >On 24 Mar 2004, at 15:16, Brian Sayatovic/AMIG wrote: > > > >>I'd like to be able to have someone hit my action, /admin/list.do, >>without >>having to specify a submit paramater. However, the action is a >>subclass >>of LookupDispatchAction whci requires that the request parameter be >>supplied. Looking in the struts source code, it would be nice if the >>LookupDispatchAction could fall back to a default or not consider >>'null' >>to be a bad value and just use 'null' as a key to the lookup Map. For >>now, any link or redirect to the page must specify what I consider to >>be >>the default action -- refresh -- on the URL: >>/admin/list/do?submit=Refresh. >> >>Is there another way to do this? Is it worth suggesting that >>LookupDispatchAction support a default or null mapping? >> >>Regards, >>Brian. >> >> > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- Mark Shifman MD. Ph.D. Yale Center for Medical Informatics Phone (203)737-5219 [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]