Re: forward thing: tomcat 4.1

2003-12-01 Thread Doug Parsons
Sorry I read to fast. You are in a servlet. Unless you return or escape out
or try catch it is going to execute to the end or until you do something to
exit.

- Original Message - 
From: "Kumar, Sumit" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
Sent: Monday, December 01, 2003 11:58 AM
Subject: forward thing: tomcat 4.1


> Hello,
>
> This is more like a jsp question rather then the tomcat one but pardon me
> for asking here. In my servlet, I do a
> getServletContext().getRequestDispatcher(
> "/reports.jsp?msg='selectEval'&pid=" + pid).forward( req, res ). The code
is
> given below. I believe this should forward it to reports.jsp[line (4)].
But
> what happens is that even though it forwards it to reports.jsp, it
continues
> to execute the servlet even below the forward statement. When it
encounters
> the next forward statement[line (5)], it gives IllegalStateException. I
> would think it should not go even past first forward[line (4)]. Please
help
> in clarifying.
>
> if (revList.length > 1)
> {
> req.setAttribute("revList", revList);
>(4)getServletContext().getRequestDispatcher(
> "/reports.jsp?msg='selectEval'&pid=" + pid).forward( req, res );
> }
> else if (revList.length == 1)
> {
>
> req.setAttribute("projEvalInfo", pe);
> }
> (5)getServletContext().getRequestDispatcher(
> "/OtaceEvalFormRpt.jsp").forward( req, res );
>
> -sumit
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forward thing: tomcat 4.1

2003-12-01 Thread Doug Parsons
Kumar,

Why not? There is nothing in the code to stop it from proceeding. Think in
the terms of a servlet. If you called a servlet instead of placing this code
in the jsp, how would you write it. Also do you mean for the (5) statement
to be outside your else bracket? Or did you mean for it to look like this:

if (revList.length > 1)
{
req.setAttribute("revList", revList);
   (4)getServletContext().getRequestDispatcher(
"/reports.jsp?msg='selectEval'&pid=" + pid).forward( req, res );
}
else if (revList.length == 1)
{
req.setAttribute("projEvalInfo", pe);
(5)getServletContext().getRequestDispatcher(
"/OtaceEvalFormRpt.jsp").forward( req, res );
}

Doug

- Original Message - 
From: "Kumar, Sumit" <[EMAIL PROTECTED]>
To: "'Tomcat Users List'" <[EMAIL PROTECTED]>
Sent: Monday, December 01, 2003 11:58 AM
Subject: forward thing: tomcat 4.1


> Hello,
>
> This is more like a jsp question rather then the tomcat one but pardon me
> for asking here. In my servlet, I do a
> getServletContext().getRequestDispatcher(
> "/reports.jsp?msg='selectEval'&pid=" + pid).forward( req, res ). The code
is
> given below. I believe this should forward it to reports.jsp[line (4)].
But
> what happens is that even though it forwards it to reports.jsp, it
continues
> to execute the servlet even below the forward statement. When it
encounters
> the next forward statement[line (5)], it gives IllegalStateException. I
> would think it should not go even past first forward[line (4)]. Please
help
> in clarifying.
>
> if (revList.length > 1)
> {
> req.setAttribute("revList", revList);
>(4)getServletContext().getRequestDispatcher(
> "/reports.jsp?msg='selectEval'&pid=" + pid).forward( req, res );
> }
> else if (revList.length == 1)
> {
>
> req.setAttribute("projEvalInfo", pe);
> }
> (5)getServletContext().getRequestDispatcher(
> "/OtaceEvalFormRpt.jsp").forward( req, res );
>
> -sumit
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: forward thing: tomcat 4.1

2003-12-01 Thread Tim Funk
You must follow the forward() with a return inside of a servlet. forward() is 
just a plain old java method call.

-Tim

Kumar, Sumit wrote:
Hello,

This is more like a jsp question rather then the tomcat one but pardon me
for asking here. In my servlet, I do a 
getServletContext().getRequestDispatcher(
"/reports.jsp?msg='selectEval'&pid=" + pid).forward( req, res ). The code is
given below. I believe this should forward it to reports.jsp[line (4)]. But
what happens is that even though it forwards it to reports.jsp, it continues
to execute the servlet even below the forward statement. When it encounters
the next forward statement[line (5)], it gives IllegalStateException. I
would think it should not go even past first forward[line (4)]. Please help
in clarifying.

if (revList.length > 1)
{
req.setAttribute("revList", revList); 
   (4)getServletContext().getRequestDispatcher(
"/reports.jsp?msg='selectEval'&pid=" + pid).forward( req, res );
}
else if (revList.length == 1)
{   

req.setAttribute("projEvalInfo", pe);
}   
(5)getServletContext().getRequestDispatcher(
"/OtaceEvalFormRpt.jsp").forward( req, res );
-sumit	

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


forward thing: tomcat 4.1

2003-12-01 Thread Kumar, Sumit
Hello,

This is more like a jsp question rather then the tomcat one but pardon me
for asking here. In my servlet, I do a 
getServletContext().getRequestDispatcher(
"/reports.jsp?msg='selectEval'&pid=" + pid).forward( req, res ). The code is
given below. I believe this should forward it to reports.jsp[line (4)]. But
what happens is that even though it forwards it to reports.jsp, it continues
to execute the servlet even below the forward statement. When it encounters
the next forward statement[line (5)], it gives IllegalStateException. I
would think it should not go even past first forward[line (4)]. Please help
in clarifying.

if (revList.length > 1)
{
req.setAttribute("revList", revList);   
   (4)getServletContext().getRequestDispatcher(
"/reports.jsp?msg='selectEval'&pid=" + pid).forward( req, res );
}
else if (revList.length == 1)
{   

req.setAttribute("projEvalInfo", pe);
}   
(5)getServletContext().getRequestDispatcher(
"/OtaceEvalFormRpt.jsp").forward( req, res );

-sumit  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]