I think you need to change it to

out.println("<img src=/"" + request.getContextPath() +
"/image?name=imagename/">");

The url pattern should only really be relative to your web
application's context root.

-B

>>> [EMAIL PROTECTED] 11/12/2004 5:07:39 PM >>>
I have a very simple web application that contains two servlets. One
called GreetingServlet that displays the web page for the application.
The web page includes an image that is dynamically generated by the
second servlet, called ImageServlet. I'm thinking that the
GreetingServlet can display the dynamic image by including the
following html snippet:

        out.println("<img src='/image?name=imagename'>");

My web deployment descriptor looks like:

<web-app>
   <display-name>Business Card</display-name>
   <servlet>
     <display-name>GreetingServlet</display-name>
     <servlet-name>GreetingServlet</servlet-name>
     <servlet-class>servlets.GreetingServlet</servlet-class>
   </servlet>
   <servlet>
     <display-name>ImageServlet</display-name>
     <servlet-name>ImageServlet</servlet-name>
     <servlet-class>servlets.ImageServlet</servlet-class>
   </servlet>
   <servlet-mapping>
     <servlet-name>GreetingServlet</servlet-name>
     <url-pattern>/greeting</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>ImageServlet</servlet-name>
     <url-pattern>/image</url-pattern>
   </servlet-mapping>
</web-app>

Note that the ImageServlet is registered to handle URI from the root
context of the form "/image". I would think then that the URI in the
the html snippet <img src='/image?name=imagename'> would get resolved
by dispatching to my ImageServlet. But it doesn't work. My
ImageServlet
never gets called. I think my deployment descriptor is set up
correctly
because if I type the URI to the image in the browser directly, my
ImageServlet gets called. (e.g. http://localhost:8080/demo/image).

Any help would be appreciated.

Thanks,
Michael-

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html

LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to