I have some code that looks something like this;


            RequestDispatcher rd =
_req.getRequestDispatcher("/invalid.jsp");
            try {
                rd.forward(_req, _resp);

            } catch ( ServletException e ) {
            } catch ( java.io.IOException e ) {
            }

The question is does control ever continue after the forward() method call?
It would seem sensible that it didn't 
if you viewed forward as, I no longer wan't this page, but another one
instead. 

My problem is that the above code is in a bean, which does an isValid user
check and forwards to a page if they are not. After the bean access I have
regular pages which are only mean to be displayed if the user is valid.

Like this;

<jsp:useBean id="userChk" class="package.UserValid"/>
<jsp:setProperty name="userChk" property="UserName" value="auser"/>
<jsp:setProperty name="userChk" property="UserPass" value="apass"/>
<% userChk.setPageInfo(request, response); %>
<jsp:getProperty name="userChk" property="IsValid"/>

<body bgcolor="#7080D0" link="#00FF00" alink="#000000" vlink="#00FFFF">
  <font size="+1" color="#D0F0F0">
  <p>
    Show this if user is valid
  </p>
</body>

What actually happens is the invalid page is shown, with the additional
"Show if user is valid" html appended to the end.

What can I do? I'd really like the forward to actually forward, not act like
include.

Reply via email to