Showing posts with label Jsp(Java). Show all posts
Showing posts with label Jsp(Java). Show all posts

Tuesday, January 6, 2009

Jsp broken link images

I have encounter many times my Jsp page is not reading the images .In jsp it not as direct and straight forward as java application where you jus need to give the entire source link.
Eg. <-- img src ='C:/Documents and Settings/User/Desktop/image.gif'-->(this doesn work in jsp but works in java application)

Lets just say i wan to use just this link as below example, so that my Jsp page will load my images correctly, how should i do that?
Eg. <-- img src ='ok.gif' -->

The location of the images must be in the folder of the project but where?
If you want the Jsp to read the image link and display it well without appearing broken after it is build and clean.Please see the image below.This is an example of how i put my images which u can insert it through drag and drop from the picture source.i dragged my images from the desktop.It is a netbeans platform



After that at my servlet i will have this code to create the html tag


<-- String ImageName = "ok.gif"; -->
<-- out.println("img src ='"+ImageName+"'"); -->

Please add a < and > because i don wan my post to recognise it as Images path so i have removed it