You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David kerber <dc...@verizon.net> on 2010/07/02 15:01:56 UTC

Getting a servlet to work within static pages

My system:
Debian Lenny (5.x) on a low end machine in my basement (so I can do 
whatever I want/need to it)

TC 6.0.24, installed in /home/davek/apache-tomcat-6.0.24

java version "1.5.0_17"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
Java HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode, sharing)

Web content and apps are installed in
/home/content/webapps/ROOT
and
/home/content/webapps/ginp

ROOT contains all the static content for my personal website, with 
various html files and sub-folders, and a couple of .jsp files from this 
issue I'm asking about.

ginp is the open-source photo album project I'm using to manage and 
display post some of my pictures.

I'm trying to figure out how to use some of the functions from ginp 
(specifically one of several defined as tagsets) in my static pages to 
display a list of available photo albums.  And I want to do this 
transparently, so the list appears to be just part of a static page, 
without me having to have /ginp/ show on the url because it was 
redirected or forwarded to the servlet.

I've tried renaming the .html page to .jsp and putting the code to call 
the tag in the desired spot (code below), but I'm getting the exception 
below.  I think the biggest issue is my unfamiliarity with using 
tablibs, but am wondering if there is also some tomcat setup issues I'm 
missing here.

Any help appreciated!!

Dave


The complete .jsp is:

<HTML>
<HEAD>
   <TITLE>Photography</TITLE>
</HEAD>
<BODY background=sand.gif>
<H2 align=center>Photography</H2>
<P>
Some of my favorite pictures for you to peruse and comment on:

<br>
<h3>Picture collections</h3>

<%@ taglib uri="/ginp" prefix="ginp" %>
<ginp:setup />
<h1><ginp:trans code="Collections" /></h1>
<h3><ginp:getcollectiontitles>
     <a href="<%=link%>"><%=name%></a><br /></ginp:getcollectiontitles>
</h3>
<P>
<A HREF="davek_1.htm">Back to the Home Page</A>
</BODY>
</HTML>



org.apache.jasper.JasperException: File "/ginp" not found
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
	org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:160)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:382)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:445)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1392)
	org.apache.jasper.compiler.Parser.parse(Parser.java:130)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a servlet to work within static pages

Posted by David Kerber <dc...@verizon.net>.
David Kerber wrote:
> Christopher Schultz wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> David,
>>
>> On 7/3/2010 9:24 PM, David Kerber wrote:
>>  
>>> Yep, that's basically what's going on:  /ginp is the root of the ginp
>>> context on my web site, and my ROOT context won't reach across the
>>> context boundaries.  Unfortunately, the ginp project is written to be
>>> build into a standalone .war file rather than a library .jar and a set
>>> of front-end classes, and I'm having to do a bit of futzing around to
>>> get the bits I need to work in my ROOT context, but I'm getting there.
>>> It would require a major refactoring to get the http pieces of ginp
>>> separated out from the parts that could be in a library .jar file, and
>>> I'm not ready to tackle that right now.  So I'm looking at some kind of
>>> deployment script to copy the .tld and other config files I need into
>>> the correct spots in my ROOT context.
>>>     
>>
>> Maybe you could just merge your stuff into the /ginp webapp? That might
>> be simpler.
>>   
> That may be what I'll end up doing for the short term, but ultimately 
> I want to get ginp matured into a properly embeddable library.  I'm 
> still playing with it, and it's a strictly spare-time project, go it's 
> hard to predict where it will go and when it will get there.

Getting this to work for now turned out to be fairly easy, though a bit
of a kludge.  I tweaked one of the tag classes slightly, copied the
entire web-inf/classes hierarchy from the exploded .war file in the ginp
context, into the same spot in ROOT, copied a few configuration files
over, and it all started working almost the way I want.  It's not
perfect yet, but it's getting there.

Thanks for the comments, Pid and Chris; they gave me a good starting point.

D



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a servlet to work within static pages

Posted by David Kerber <dc...@verizon.net>.
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> David,
>
> On 7/3/2010 9:24 PM, David Kerber wrote:
>   
>> Yep, that's basically what's going on:  /ginp is the root of the ginp
>> context on my web site, and my ROOT context won't reach across the
>> context boundaries.  Unfortunately, the ginp project is written to be
>> build into a standalone .war file rather than a library .jar and a set
>> of front-end classes, and I'm having to do a bit of futzing around to
>> get the bits I need to work in my ROOT context, but I'm getting there.
>> It would require a major refactoring to get the http pieces of ginp
>> separated out from the parts that could be in a library .jar file, and
>> I'm not ready to tackle that right now.  So I'm looking at some kind of
>> deployment script to copy the .tld and other config files I need into
>> the correct spots in my ROOT context.
>>     
>
> Maybe you could just merge your stuff into the /ginp webapp? That might
> be simpler.
>   
That may be what I'll end up doing for the short term, but ultimately I 
want to get ginp matured into a properly embeddable library.  I'm still 
playing with it, and it's a strictly spare-time project, go it's hard to 
predict where it will go and when it will get there.

D


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a servlet to work within static pages

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

On 7/3/2010 9:24 PM, David Kerber wrote:
> Yep, that's basically what's going on:  /ginp is the root of the ginp
> context on my web site, and my ROOT context won't reach across the
> context boundaries.  Unfortunately, the ginp project is written to be
> build into a standalone .war file rather than a library .jar and a set
> of front-end classes, and I'm having to do a bit of futzing around to
> get the bits I need to work in my ROOT context, but I'm getting there.
> It would require a major refactoring to get the http pieces of ginp
> separated out from the parts that could be in a library .jar file, and
> I'm not ready to tackle that right now.  So I'm looking at some kind of
> deployment script to copy the .tld and other config files I need into
> the correct spots in my ROOT context.

Maybe you could just merge your stuff into the /ginp webapp? That might
be simpler.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwv7k8ACgkQ9CaO5/Lv0PAAZwCghzAIlgUY3/oZfnPkdISTSFPC
YNkAnjosXoREucQguLfzCaVjAohQvs95
=MWcv
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a servlet to work within static pages

Posted by David Kerber <dc...@verizon.net>.
Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> David,
>
> On 7/2/2010 10:04 AM, David kerber wrote:
>   
>> On 7/2/2010 9:23 AM, Pid wrote:
>>     
>
>   
>>> Silly question, have you got the jars for that taglib in:
>>>
>>> ROOT/WEB-INF/lib?
>>>
>>> p
>>>       
>> Not silly at all.  I was thinking they'd pick up what they need from the
>> ginp webapp, but I've never done this kind of cross-context calling
>> before.  I'll try that.
>>     
>
> Tomcat isn't going to load taglibs from another context, so you'd better
> deploy the taglib JAR in both contexts. Once you do that, use the
> correct taglib URI to reference it. Presumably "/ginp" isn't correct.
> It's probably something like "http://www.ginp.com/taglibs/v1" or
> something like that.
>   
Yep, that's basically what's going on:  /ginp is the root of the ginp 
context on my web site, and my ROOT context won't reach across the 
context boundaries.  Unfortunately, the ginp project is written to be 
build into a standalone .war file rather than a library .jar and a set 
of front-end classes, and I'm having to do a bit of futzing around to 
get the bits I need to work in my ROOT context, but I'm getting there. 

It would require a major refactoring to get the http pieces of ginp 
separated out from the parts that could be in a library .jar file, and 
I'm not ready to tackle that right now.  So I'm looking at some kind of 
deployment script to copy the .tld and other config files I need into 
the correct spots in my ROOT context.

D



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a servlet to work within static pages

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David,

On 7/2/2010 10:04 AM, David kerber wrote:
> On 7/2/2010 9:23 AM, Pid wrote:

>> Silly question, have you got the jars for that taglib in:
>>
>> ROOT/WEB-INF/lib?
>>
>> p
> 
> Not silly at all.  I was thinking they'd pick up what they need from the
> ginp webapp, but I've never done this kind of cross-context calling
> before.  I'll try that.

Tomcat isn't going to load taglibs from another context, so you'd better
deploy the taglib JAR in both contexts. Once you do that, use the
correct taglib URI to reference it. Presumably "/ginp" isn't correct.
It's probably something like "http://www.ginp.com/taglibs/v1" or
something like that.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwuUngACgkQ9CaO5/Lv0PCudACfVnrN/mCn7+KExkaH+qjHIhEF
4p4An0alqNJw25RbmAMct70vugUSoCfp
=IXCV
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a servlet to work within static pages

Posted by David kerber <dc...@verizon.net>.
On 7/2/2010 9:23 AM, Pid wrote:
> On 02/07/2010 14:01, David kerber wrote:
>> My system:
>> Debian Lenny (5.x) on a low end machine in my basement (so I can do
>> whatever I want/need to it)
>>
>> TC 6.0.24, installed in /home/davek/apache-tomcat-6.0.24
>>
>> java version "1.5.0_17"
>> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
>> Java HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode, sharing)
>>
>> Web content and apps are installed in
>> /home/content/webapps/ROOT
>> and
>> /home/content/webapps/ginp
>>
>> ROOT contains all the static content for my personal website, with
>> various html files and sub-folders, and a couple of .jsp files from this
>> issue I'm asking about.
>>
>> ginp is the open-source photo album project I'm using to manage and
>> display post some of my pictures.
>>
>> I'm trying to figure out how to use some of the functions from ginp
>> (specifically one of several defined as tagsets) in my static pages to
>> display a list of available photo albums.  And I want to do this
>> transparently, so the list appears to be just part of a static page,
>> without me having to have /ginp/ show on the url because it was
>> redirected or forwarded to the servlet.
>>
>> I've tried renaming the .html page to .jsp and putting the code to call
>> the tag in the desired spot (code below), but I'm getting the exception
>> below.  I think the biggest issue is my unfamiliarity with using
>> tablibs, but am wondering if there is also some tomcat setup issues I'm
>> missing here.
>>
>> Any help appreciated!!
>>
>> Dave
>>
>>
>> The complete .jsp is:
>>
>> <HTML>
>> <HEAD>
>>    <TITLE>Photography</TITLE>
>> </HEAD>
>> <BODY background=sand.gif>
>> <H2 align=center>Photography</H2>
>> <P>
>> Some of my favorite pictures for you to peruse and comment on:
>>
>> <br>
>> <h3>Picture collections</h3>
>>
>> <%@ taglib uri="/ginp" prefix="ginp" %>
>
> Silly question, have you got the jars for that taglib in:
>
> ROOT/WEB-INF/lib?
>
> p

Not silly at all.  I was thinking they'd pick up what they need from the 
ginp webapp, but I've never done this kind of cross-context calling 
before.  I'll try that.


D

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Getting a servlet to work within static pages

Posted by Pid <pi...@pidster.com>.
On 02/07/2010 14:01, David kerber wrote:
> My system:
> Debian Lenny (5.x) on a low end machine in my basement (so I can do
> whatever I want/need to it)
> 
> TC 6.0.24, installed in /home/davek/apache-tomcat-6.0.24
> 
> java version "1.5.0_17"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_17-b04)
> Java HotSpot(TM) Client VM (build 1.5.0_17-b04, mixed mode, sharing)
> 
> Web content and apps are installed in
> /home/content/webapps/ROOT
> and
> /home/content/webapps/ginp
> 
> ROOT contains all the static content for my personal website, with
> various html files and sub-folders, and a couple of .jsp files from this
> issue I'm asking about.
> 
> ginp is the open-source photo album project I'm using to manage and
> display post some of my pictures.
> 
> I'm trying to figure out how to use some of the functions from ginp
> (specifically one of several defined as tagsets) in my static pages to
> display a list of available photo albums.  And I want to do this
> transparently, so the list appears to be just part of a static page,
> without me having to have /ginp/ show on the url because it was
> redirected or forwarded to the servlet.
> 
> I've tried renaming the .html page to .jsp and putting the code to call
> the tag in the desired spot (code below), but I'm getting the exception
> below.  I think the biggest issue is my unfamiliarity with using
> tablibs, but am wondering if there is also some tomcat setup issues I'm
> missing here.
> 
> Any help appreciated!!
> 
> Dave
> 
> 
> The complete .jsp is:
> 
> <HTML>
> <HEAD>
>   <TITLE>Photography</TITLE>
> </HEAD>
> <BODY background=sand.gif>
> <H2 align=center>Photography</H2>
> <P>
> Some of my favorite pictures for you to peruse and comment on:
> 
> <br>
> <h3>Picture collections</h3>
> 
> <%@ taglib uri="/ginp" prefix="ginp" %>

Silly question, have you got the jars for that taglib in:

ROOT/WEB-INF/lib?

p

> <ginp:setup />
> <h1><ginp:trans code="Collections" /></h1>
> <h3><ginp:getcollectiontitles>
>     <a href="<%=link%>"><%=name%></a><br /></ginp:getcollectiontitles>
> </h3>
> <P>
> <A HREF="davek_1.htm">Back to the Home Page</A>
> </BODY>
> </HTML>
> 
> 
> 
> org.apache.jasper.JasperException: File "/ginp" not found
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
> 
> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
> 
> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
> 
>     org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:160)
> 
> org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:382)
> org.apache.jasper.compiler.Parser.parseDirective(Parser.java:445)
> org.apache.jasper.compiler.Parser.parseElements(Parser.java:1392)
>     org.apache.jasper.compiler.Parser.parse(Parser.java:130)
> org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
> 
> org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
> 
> org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
>     org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
>     org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
>     org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
> 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
> 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>     javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>