You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kevin Duffey <kd...@buymedia.com> on 2000/08/02 22:22:16 UTC

RE: RESEND: Is it possible to send control back to 'ActionServlet' instead of to a JSP?

I would do it this way..if you want ALL links/pages to go through the
ActionServlet no matter what:

<action path="/Default" class="com.company.actions.Default" />

<action path="/Login" class="com.company.actions.Login">
  <forward name="LoginOK" path="/Default.do?page=somepage.jsp"
redirect="false" />
  <forward name="LoginError" path="/Default.do?page=anotherpage.jsp"
redirect="false" />
</action>

This way, the Default.java class will get ALL links passed to it. The
request attribute "page" would indicate the page to forward to. So..ALL of
your links would be processed by this Default class. Name it what you like.
Then you could wrap up any security issues inside the Default class..such as
making sure if a given path exists in the requestURI, and a certain session
variable doesn't exist..you redirect them to a login page.  I am not doing
this myself mainly because I include the same one header file in every JSP
page that I use some scriplet code to do this. It is a good idea though..the
only problem I see is its a little extra processing to forward to another
servlet to handle the forwarding to a page. Its much faster than
sendRedirect() though..so I don't think its that bad for the extra "control"
you get.


> Hi,
>
> I have a situation where from my 'LogonServlet',  depending on certain
> conditions, I want to either:
>
> Go to "Servlet1" which does some processing and forwards control to JSP1.
>
> or
>
> Go to "Servlet2" which does some processing and forwards control to JSP2.
>
>
> Since everything I feel should pass through the controller
> servlet, how do I
> send control from "LogonServlet" to go back to the
> 'ActionServlet' with all
> the parameters, e.g., the name of the next servlet, etc.
>
>
> Nimmi Shamdasani
>