• 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

WAR Deployment - Images not loading

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I've developed a web appln which is being deployed in Sun One App Server 7. And while deploying I gave the context-root as /Test and I'm invoking the login jsp page using a Controller servlet. The issue is the images are not loading when the page loads. Should there be any entry be made in the web.xml for images alone ? below is the entry from the server.xml.

<applications dynamic-reload-enabled="false" dynamic-reload-poll-interval-in-seconds="2">
<web-module enabled="true" location="C:\Sun9\jstudio\AppServer7\domains\domain1\server2\applications\j2ee-modules\project_2" name="project" context-root="/Test"/>
</applications>

Can anybody pls help ? I'm stuck...

Thanks,
-GR
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post one of your HTML Image tags.
 
Gokul Ram
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

this is from the jsp...

<img src="abc_seal.gif">

p.s: All requests go to the servlet and they get redirected from there.. so the initial login page is also called thru the servlet by passing a init-param as 'LOGIN'...
below is the web.xml entry...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>Controller</servlet-name>
<servlet-class>com.hud.gims.controller.Controller</servlet-class>
<init-param>
<param-name>event</param-name>
<param-value>LOGIN</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Controller</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Controller</servlet-name>
<url-pattern>/*.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Controller</servlet-name>
<url-pattern>/*.html</url-pattern>
</servlet-mapping>
</web-app>

Thanks....
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All request are going to your controller servlet.
<url-pattern>/</url-pattern>
 
Gokul Ram
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Ben. Thats where the problem I'm facing now. I'm not sure how to
point to the images. Can you pls help me in fixing this ? any suggestions..
 
Gokul Ram
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Ben.. any suggestions... i'm stuck.. i tried different possibilities
in the web.xml.. but no luck...
can anybody pls help me out ?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does the controller ever see the image requests? What is it supposed to do when it gets one?
Bill
 
Gokul Ram
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply...

Actually the controller doesnt do anything for the images.

It just forwards the request to other JavaBeans, Database access objects..

I'm just calling the images in the jsp's as,

<img src="hud_seal.gif">

This is where it is not able to resolve the path...

From all the jsp's the request goes to the controller... and it processes..

Hope I was able to explain...

Pls let me know if you have any suggestions...
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the image in the same directory as your jsp file?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks for the reply...
Actually the controller doesnt do anything for the images.
It just forwards the request to other JavaBeans, Database access objects..
I'm just calling the images in the jsp's as,
<img src="hud_seal.gif">



If you're going to have your controller servlet intercept ALL requests than you are going to have to write your own code to stream the images.
This isn't difficult. If you want an example look at http://simple.souther.us/SimpleStream.war.

I would argue, however, that if your app isn't about streaming images, and you're not adding any functionality, other than what the default servlet would do, don't intercept all requests with your controller.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic