interrupting JSP page

  • Thread starter =?ISO-8859-2?Q?Dra=BEen_Gemi=E6?=
  • Start date
?

=?ISO-8859-2?Q?Dra=BEen_Gemi=E6?=

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
 
A

Andrea Desole

Dra¾en Gemiæ said:
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.
 
?

=?ISO-8859-2?Q?Dra=BEen_Gemi=E6?=

Andrea said:
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.

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.
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top