struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Jain" <Eric.J...@isb-sib.ch>
Subject Re: DynamicForwardAction
Date Fri, 07 Mar 2003 11:17:55 GMT
> You can define an "unknown" action that responds to requests that no
> other actions are mapped to.  See section 4.7:
> http://jakarta.apache.org/struts/userGuide/building_controller.html

Finally got it working... If no action exists for a request that was
mapped to the Struts servlet, the request is forwarded to the default
servlet. This could be extended somewhat to handle forwarding to
specific servlets for handling other kinds of dynamic content. One minor
issue however is that I am not sure whether the default servlet has the
same name on all servlet containers.


public class DefaultAction
 extends Action
{
 public ActionForward execute(...)
  throws Exception
 {
  servlet.getServletContext().
    getNamedDispatcher("default").
    forward(request, response);
  return null;
 }
}


  <action
   path="/null"
   type="DefaultAction"
   unknown="true"
   parameter="null"
  />


--
Eric Jain


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message