Let's say that I wan't to stop processing of JSP page.
I can do it by executing return statement in a JSP body.
It returns from compiled servlet 'service' method. If
I call <jsp:forward../> before it, I could redirect to
another page.
Besides being slopy, is there anything wrong that violates some
standard or causing unstable condition with this method ?
I know that I should resolve all the issues in a bean or servlet
that does actual data processing before JSP does the rendering,
but sometimes I just might need to do that.
DG
> Let's say that I wan't to stop processing of JSP page.
>
> I can do it by executing return statement in a JSP body.
> It returns from compiled servlet 'service' method. If
> I call <jsp:forward../> before it, I could redirect to
> another page.
just for clarity: forward doesn't redirect. With forward you can't see
the url of the new page in the browser. Returning from the JSP body is
also different: that just stops processing the JSP, without showing you
any other page.
> Besides being slopy, is there anything wrong that violates some
> standard or causing unstable condition with this method ?
don't think so. You only have to make sure that you call it soon enough,
so that the response hasn't been committed.
Dražen Gemić - 15 Aug 2006 22:27 GMT
>> Let's say that I wan't to stop processing of JSP page.
>>
[quoted text clipped - 7 lines]
> also different: that just stops processing the JSP, without showing you
> any other page.
I understand forward, and I know that there is a true redirect in
Servlet API. Using 'return' makes sense if jsp:forward is called
before it, in order to show me another page. Otherise I would get jus an
empty page.
>> Besides being slopy, is there anything wrong that violates some
>> standard or causing unstable condition with this method ?
>
> don't think so. You only have to make sure that you call it soon enough,
> so that the response hasn't been committed.
Thx
DG