You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Boszormenyi Laszlo <bo...@queen.iit.uni-miskolc.hu> on 2000/11/19 16:49:42 UTC

JSP and embedded servlet call

Hello!

How should I implement something like <.!--#exec cgi="..."--> in a jsp
page? So, I want to see the output of the servlet embedded in the jsp
page.

Thanks, Laszlo


Server-Side Includes (was Re: JSP and embedded servlet call)

Posted by Kurt Bernhard Pruenner <le...@gmx.at>.
"Craig R. McClanahan" wrote:
> Boszormenyi Laszlo wrote:
> > How should I implement something like <.!--#exec cgi="..."--> in a jsp
> > page?
> 
> Tomcat does not support server-side includes via "#exec cgi".  You can use 
> such commands in HTML pages if you run Tomcat behind a web server, but not 
> in a JSP page.

There's something I actually wanted to ask for some time; on our server, we
have had JServ running for quite some time, and we had absolutely no problems
using

<!--#include virtual="/sswstyle/header.jsp" -->

to include a servlet that does provide the header for most pages... when we
tried the same thing with some older Tomcat version (I don't know if it was
3.0 or 3.1), the above statement didn't do anything at all and was left in the
page served by Apache. 

Now, I've tried this again with Tomcat 3.2b7 and the latest JServ, and while
it at least tries to include something now, I've found that Tomcat doesn't get
passed the "/sswstyle/header.jsp", but the location of the page that tries to
include the JSP page (i.e. "/test/test.shtml"), which of course fails again...
:(

As I assume that this behaviour happens by JServ passing the wrong location to
Tomcat when invoked from mod_include - is this some planned behaviour and is
using mod_include with mod_jserv right out of the question, or is this just a
bug? :/

-- 
Kurt Bernhard Pruenner --- Haendelstrasse 17 --- 4020 Linz --- Austria
Music: http://www.mp3.com/Leak --- Work: http://www.ssw.uni-linz.ac.at
.......It might be written "Mindfuck", but it's spelt "L-A-I-N".......
np: Kendall Jackman - Weightless (ambient.01@hyperreal comp.)

Re: JSP and embedded servlet call

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Boszormenyi Laszlo wrote:

> Hello!
>
> How should I implement something like <.!--#exec cgi="..."--> in a jsp
> page?

Tomcat does not support server-side includes via "#exec cgi".  You can use such
commands in HTML pages if you run Tomcat behind a web server, but not in a JSP
page.

> So, I want to see the output of the servlet embedded in the jsp
> page.
>

If you want to embed the output of a servlet (or JSP page) in another page, you
can use <jsp:include>.

>
> Thanks, Laszlo

Craig McClanahan