Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am a JSP/Servlet developer.
I am new to Linux server environment.
I am experiencing a problem with Image Path reference in Linux server.
My application (myapp.war) is running in Linux in the following path: /opt/jboss-3.2.6/server/default/deploy/myapp.war
The myapp.war is having the html,xml,jsp and servlet files.
I stored the images in a different location. The reason is, the images can be frequently changed. /var/myapp_images/ABC/image1.gif
I want to refer the above image in the <IMG> tag of the html file.
If I give the <IMG> tag like below, the jboss servlet context is taking effect, i.e., the
/opt/jboss-3.2.6/server/default/deploy folder.
<IMG src = "/var/myapp_images/ABC/image1.gif">
The image is not loaded from the particular location. It shows an empty area with red color x mark.
But, the browser shows the address of the image as url/var/myapp_images/ABC/image1.gif.
(The url has the IP address and 8080 port number.)
Image Type : Not available.
Image Size : Not available.
How can I refer the image which is in a different location?
My Operating System is : Windows 2000.
JBOSS3.2.6 is running in : Linux server.
I am testing the myapp application in my Windows 2000.
I have given the absolute path reference for image. But it is not taking effect.
Anything needs to be configured / altered?
I have no clue on JSP, so forgive me if this is way off.
You said that you're referencing the image in an HTML file. Unless your app is doing some kind of processing on the HTML file to adjust the path before serving it, giving the real local path won't work. A client browser will always interpret a path like that as relative to the web root of the server.
In order for clients to find the image, you need to put it under your DocumentRoot (as set in your Apache configuration) and use a path relative to that. So if your document root is /var/mysite, you might put the image in /var/mysite/images/image1.gif and give the URL as /images/image1.gif.
Is there any options to create a link file which maps to the /var/myapp_images directory from /opt/jboss-3.2.6/server/default/deploy/.?
Yeah, you could try making a symlink under your document root instead of putting the actual files there. That should work. Of course, you would need make sure following symlinks is enabled in your Apache configuration.
You should have a folder or directory named with .war extension under the /tmp/images/ (like, /tmp/images/abc.war), else the JBOSS server wont refer the image file. All your images should be copied inside the abc.war file. Adjust your image reference in JSP or HTML to get them from the /tmp/images/abc.war.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.