struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wendy Smoak <Wendy.Sm...@asu.edu>
Subject RE: Nasty Error when use LookupDispatchAction
Date Thu, 12 Dec 2002 18:51:26 GMT
> Everything works beautifully until you try and mess the query string
> for e.g  /edit.do?submit=initchanged&key=10
> there is no mapping for initx, hence there is no method name and null is
> passed into the
> return dispatchMethod(mapping, form, request, response, methodName)
> which finally calls getMethod(String name, Class[] parameterTypes)
> The end result is that application shuts down with VM error

I had the same problem with LookupDispatchAction, but it just causes an
error with Tomcat, it doesn't dump the JVM.  That might be a problem with
Resin.  (Not that the patch is a bad idea, just that  Resin shouldn't die
that spectacularly just because of this problem!)

For my own project, I had to override execute() and provide a default
behavior:

   public ActionForward execute( ... )
   {
       if ( request.getParameter( mapping.getParameter() ) == null ) {
            //required parameter is missing!
            return ( mapping.findForward( "failure" ) );
         }
      } else {
         //parameter is present, let LookupDispatchAction do its thing:
         return super.execute( mapping, form, request, response );
      }
   }

I think there should be a "default" attribute for the <action> tag, used in
conjunction with "parameter".  If the "parameter" isn't there,
LookupDispatchAction would use the default forward.

Finals are almost over and I was actually thinking about doing this and
submitting it, if I can figure out how. :)  Does anyone have any comments or
would like it to work differently?  Or know that it'll never get accepted so
don't bother?

-- 
Wendy Smoak
Applications Systems Analyst, Sr.
Arizona State University PA Information Resources Management

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message