• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

images not display on Struts forwarding JSP page

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,

Can someone tell me why my gif images are not displaying on any of my Struts forwarding JSP pages? If the pages are invoking directly by typing the url into a browser the images are displaying. However, if Sruts forwards the pages, the images DO NOT display.

Here's my jsp page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
<%@ include file="../common/Header.jsp" %>

<html:html>
<body>
<html:form action="/submitPackages" name="PackageForm" type="org.apache.struts.action.DynaActionForm">
<table align="center" width="960" cellpadding="0" cellspacing="0" border="0">
<tr><td>SERVICES</td></tr>
<tr><td>ADVERTISE YOUR BUSINESS</td></tr>
<tr><td> </td></tr>
<tr>
<td><html:img page="../images/beauti.gif" width="78" height="74" /></td>
<td valign="top">Private Business </td>
<td><html:img page="../images/happyWomen.gif" width="78" height="74" /></td>
<td valign="top">Professional Business </td>
</tr>
</table>

......

</body>
<%@ include file="../common/footer.jsp" %>
</html:html>


PLS...heLP!!!
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the version of your tomcat ?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"ramesh",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nina, using page-relative addressing (such as starting a URL with ..) usually will not work in a web app.

Rather, you should be using server-relative addressing that starts with the web app's context path.
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to do servlet relative addressing??
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear's advice is good for writing regular JSPs that don't use a framwork. However, Struts tags use a different set of rules. When you use the page attribute of the html:img tag, it automatically prepends the web app's context path that Bear was talking about. You just need to start your URIs with a simple "/" and then give the path relative to the context path. If you want to give a URL that does not prepend the web context path, use the src attribute of the tag instead.
 
Don't MAKE me come back there with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic