tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Micael Padraig Og mac Grene" <caraun...@harbornet.com>
Subject Re: .gif images not displaying with JSPs
Date Wed, 28 Nov 2001 17:56:03 GMT
Congraduations.  A little work and now you are a Tomcat killer!
Interesting, Mark.  I am not using Tomcat 4.0, but 3.* and my examples is:

<Host name="127.0.0.1" >
           <Context path=""
                    docBase="webapps/examples" />
           <Context path="/examples"
                    docBase="webapps/ROOT" />

Your does not have "webapps"?   Micael


-----Original Message-----
From: Mark <markd@bellsouth.net>
To: Tomcat Users List <tomcat-user@jakarta.apache.org>
Date: Wednesday, November 28, 2001 6:03 AM
Subject: Re: .gif images not displaying with JSPs


>After my initial message, I created an images directory (eg.
>../myapp/images), so using <%=request.getContextPath()%>/images/image1.gif
>results in:
>
>        /myapp/images/image1.gif
>
>In server.xml, I'm set up as:
>
>        <Context path="/myapp" docBase="myapp" debug="0" reloadable="true">
>            <Logger className="org.apache.catalina.logger.FileLogger"
>                    prefix="myapp." suffix=".txt"
>                    timestamp="true"/>
>        </Context>
>
>I noticed the difference between us is in docBase, where you prepend
>'webapps/'. I simply followed the examples when I updated server.xml for my
>app.  I'm just happy to say it now works 100% under Tomcat!
>
>Mark
>
>
>At 10:03 PM 11/27/2001 -0800, you wrote:
>>At any rate, Mark, I would be interested in what the path you get is.
Just
>>put <%= request.getContextPath() %> before
>> <img src='<%= request.getContextPath() %>/blah/blah.gif'/>
>>
>>-----Original Message-----
>>From: Mark <markd@bellsouth.net>
>>To: Tomcat Users List <tomcat-user@jakarta.apache.org>
>>Date: Tuesday, November 27, 2001 11:03 AM
>>Subject: RE: .gif images not displaying with JSPs
>>
>>
>>>Yes, that fixed the problem - thank you!
>>>
>>>Takes care of my problem with Tomcat, but it introduces a problem with
the
>>>same app under VAJ - request.getContextPath() isn't in the IBM
>>>HttpServletRequest interface.  Yet another place where VAJ isn't fully
>>>compliant with the Sun APIs...
>>>
>>>Thanks again for the help Carsten!
>>>
>>>Mark
>>>
>>>
>>>At 12:50 PM 11/27/2001 -0500, you wrote:
>>>>I've run into problems with images showing on JSPs in the past as well,
>>and
>>>>I found that using request.getContextPath() solves the problem to give
you
>>>>an absolute path within the context.
>>>>
>>>>example:
>>>><img
>>>>src='<%=request.getContextPath()%>/graphics/flags/german_flag.gif'/></a>
</
>>tr
>>>>>
>>>>
>>>>Hope that helps!
>>>>
>>>>Carsten
>>>>
>>>>-----Original Message-----
>>>>From: Mark [mailto:markd@bellsouth.net]
>>>>Sent: Tuesday, November 27, 2001 12:36 PM
>>>>To: Tomcat Users List
>>>>Subject: Re: .gif images not displaying with JSPs
>>>>
>>>>
>>>>Can you display images from a JSP?  My straight html pages display
images
>>>>with no problems using Tomcat.  What's odd is if I take the html source
>>>>generated by the JSP (ie, 'view source from the browser'), save it as an
>>>>html file and re-display it, it's fine.  So the html generated by the
JSP
>>>>seems ok - it's only when it's being pushed to the browser from the JSP
>>>>servlet where the images don't display.
>>>>
>>>>I don't understand odd classloader error messages that refer to the
>>images.
>>>> Since the servlet .java/.class are being dealt with in the ../work
>>>>directory, could this have something to do with it?
>>>>
>>>>Frustration mounting again...
>>>>
>>>>Mark
>>>>
>>>>
>>>>At 08:27 AM 11/27/2001 -0800, you wrote:
>>>>>I have a directory called graphics on the same level as WEB-INF, i.e.
>>>>>root_directory/webapps/myapp/graphics/flags/ and
>>>>>root_directory/webapps/myapp/WEB-INF/, and I use
>>>>>         <img src='graphics/flags/german_flag.gif'/></a></tr>
>>>>>without dificulty, if that helps.  This may have to do with my settings
>>in
>>>>>server.xml, which is:
>>>>>
>>>>> <Context path="/myapp"
>>>>>  docBase="webapps/myapp"
>>>>>  debug="0"
>>>>>  reloadable="true" >
>>>>> </Context>
>>>>>
>>>>>Hope this helps.  Again, inside and outside WEB-INF is a big deal.
>>>>>-----Original Message-----
>>>>>From: Mark <markd@bellsouth.net>
>>>>>To: tomcat-user@jakarta.apache.org <tomcat-user@jakarta.apache.org>
>>>>>Date: Tuesday, November 27, 2001 5:54 AM
>>>>>Subject: .gif images not displaying with JSPs
>>>>>
>>>>>
>>>>>>My servlet/JSP/JavaBean app is working under TC 4.0.1, except for
images
>>>>>>not displaying in JSPs. The various .gifs live in the root context
for
>>the
>>>>>>application, ie. the same directory as the html and JSP files.  The
JSP
>>>>has
>>>>>>simple embedded html statements such as:
>>>>>>
>>>>>>    <a><img src="image1.gif" align="left"></a>
>>>>>>
>>>>>>For each img tag, the application log has an associated set of errors:
>>>>>>
>>>>>>   2001-11-27 08:24:34
>>>>>>StandardWrapper[/myapp:org.apache.catalina.INVOKER.image1.gif]:
>>>>>>   Marking servlet org.apache.catalina.INVOKER.image1.gif as
unavailable
>>>>>>   2001-11-27 08:24:34 invoker: Cannot allocate servlet instance for
>>path
>>>>>>   /myapp/servlet/image1.gif
>>>>>>   javax.servlet.ServletException: Wrapper cannot find servlet class
>>>>>>image1.gif or a
>>>>>>   class it depends on
>>>>>>   ...
>>>>>>
>>>>>>   - Root Cause -----
>>>>>>   java.lang.ClassNotFoundException: image1.gif
>>>>>>
>>>>>>The generated Java code (in ../work directory) looks like the
following:
>>>>>>
>>>>>>    out.write("      \r\n\r\n<a><img src=\"image1.gif\"
>>>>>>align=\"left\"></a>\r\n<a>
>>>>>>              <img src=\"image2.gif\" align=\"left\"></a>\r\n");
>>>>>>
>>>>>>
>>>>>>The page displays except for the images, and the resulting html pushed
>>to
>>>>>>the browser has the <img> tags. The JSPs work under other environments
>>>>(eg.
>>>>>>VAJ, Sun SDK, etc). What am I doing wrong this time under Tomcat?
>>>>>>
>>>>>>Thanks
>>>>>>Mark
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>--
>>>>>>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>>>>>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>>>>>>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>--
>>>>>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>>>>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>>>>>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>>>>>
>>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>>>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>>>>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>>>>
>>>>--
>>>>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>>>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>>>>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>>>>
>>>>
>>>
>>>
>>>--
>>>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>>>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>>>
>>>
>>
>>
>>--
>>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>>
>>
>
>
>--
>To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
>For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
>Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>
>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message