Velocity Reviews

Velocity Reviews (
-   Java (
-   -   servlet - output jsp page? (

tiewknvc9 09-23-2006 02:22 PM

servlet - output jsp page?

is it possible for a servlet to produce a jsp page that can still run?

for instance I want to run

<%@include file="../Header.html"%>

in the page generated by the servlet. However when I do this by
response.write("..."), nothing appears on screen.

Is it possible? or is there a better way to output this file from a


Juha Laiho 09-23-2006 09:37 PM

Re: servlet - output jsp page?
"tiewknvc9" <> said:
>is it possible for a servlet to produce a jsp page that can still run?

Not necessarily; I think there could be all kinds of reloading/caching

Now, what is so dynamic on your pages that one (or few) JSP response
pages are not sufficient? I.e. handle the browser action with a servlet,
then do request.forward() to the correct JSP. To pass data processed by
the servlet, you place it in request attributes.
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)

Manish Pandit 09-23-2006 10:33 PM

Re: servlet - output jsp page?

It works when you do this in a JSP but not when you write it from a
servlet because your servlet is writing "directly" to the response. In
case of a JSP, it gets compiled into a servlet first - and the JSP
engine handles the directive <%@include...%>. When you are writing
directly on the response, this text (<%@include file= %> will end up as
it is on your browser.


All times are GMT. The time now is 05:51 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.