I am developing a dynamic page in that some text and images should be displayed together...!
But before that i had tried to get nevigation page for whole application. In that i am getting same problem, Image is not displayed...!

What i should write in src=" ????? "
I have tried everything

1. /images/Forward.jpg
2. /WEB-INF/images/Forward.jpg
3. /localhost:8081/Car_Dynamic_Demo/images/Forward.jpg
4. D:\study\ADVANCE_JAVA\PrOgRaMs\WEB_APPS\Car_Dynamic_Demo\web\WEB-INF\images\Forward.jpg

But nothing is working for me...!

<%@page import="java.net.URL"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title> </title>
        <div style="position: fixed ;bottom:550px;left:600px">
            <p>Nevigation Bar </p>             
            <img src=" ??? " />

In directory file i have shown my directory structure

One more query i have...
I had tried simple html code on both browser Chrome and Mozila
But in mozila it didnot work , In chrome it gave Result...!
What can be the reason for that ??

<p> Demo Testing...Images...!</p>
<img src="D:/study/ADVANCE_JAVA/PrOgRaMs/WEB_APPS/Car_Dynamic_Demo/web/WEB-INF/images/Forward.jpg" />

I am trying to get same thing done by JSP page...!
Why its not working ????

Attachments directory.jpg 34.41 KB error.jpg 34.72 KB errorPageCode.jpg 28.34 KB
5 Years
Discussion Span
Last Post by rushi3311

It depends on where you put your image and how you deployed your web application and what server do you use. If you simply used NetBeans to create the .war file or just run your application then the image is not beeing read from where you think it is. In the above case your image is deployed inside the war and you must read from there.

I have tried your example and had the same problem. Then I moved the image inside a folder in the structure of the server and it worked. In my case I had the .war in :
.......\domains\testDomain\autodeploy\web_app.war and I moved the images at:
And at the code I used: src="/images/image.jpg"

The first thing you can do is try to read the images from the .war file or from whatever you have deployed. Or:

You need to open the directory where your server is running and place the images in a folder where your application is. From your images it looks to me that you are using NetBeans. If you go to the Services tab, (next to the tabs where you see the structure of the project - the image you posted) click the Servers icon and follow the tree. Right click on the server you are running and find its location. There you will find your application and place there your folder with the images.

Attachments image.jpg 29.6 KB
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.