aspose file tools
The moose likes JSP and the fly likes How to bind images and text together in same jsp page in easiest way? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How to bind images and text together in same jsp page in easiest way?" Watch "How to bind images and text together in same jsp page in easiest way?" New topic
Author

How to bind images and text together in same jsp page in easiest way?

Rushi Patel
Greenhorn

Joined: Sep 14, 2011
Posts: 17
Here i am sending you my code for simple navigation page...!

Can anyone tell me the way to get my image in this page along with Text and where i need to put it inside my netbeans project ??


I have created images folder inside /WEB-INF folder...!

/WEB-INF/Images/Forward.jpg Is it correct ??
Code from file nevigation.jsp



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...!

IS IT PROBLEM OF MOZILLA FIREFOX ??? OR DYNAMICALLY GENERATED PAGES are faulty somewhere???

Hoping for best and quick solution....!

Thanks....!
[Thumb - errorPageCode.jpg]
 Filename errorPageCode.jpg [Disk] Download
 Description Snap shot of Error page
 Filesize 194 Kbytes
 Downloaded:  5 time(s)

[Thumb - directory.jpg]
 Filename directory.jpg [Disk] Download
 Description Is it correct File hirarchy ??
 Filesize 34 Kbytes
 Downloaded:  3 time(s)

Pete Nelson
Ranch Hand

Joined: Aug 30, 2010
Posts: 144

WEB-INF is a special folder, and the application server typically (if not always) does not allow content to be served directly from this folder. Your web application can access files under this folder, but you can't simply request /MyApp/WEB-INF/Images/myimage.png in the browser. You'd actually need to create some sort of handler to stream that file.

It's probably far easier to simply move those images outside of the WEB-INF folder, to a location they can be requested directly by the browser.



OCPJP

"In preparing for battle I have always found that plans are useless, but planning is indispensable."
-- Dwight D. Eisenhower
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 159

When you move the image folder don't forget to add security-constraint for that, since this can be viewed by direct URL of any browser.


No pain, No gain.
OCJP 1.6
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693

Kumaravadivel Subramani wrote:When you move the image folder don't forget to add security-constraint for that, since this can be viewed by direct URL of any browser.

Why would he do that? The whole point is to allow the images to be viewed. If a security restraint is placed on the images, then they won't show up.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
 
subject: How to bind images and text together in same jsp page in easiest way?
 
Threads others viewed
how to get an image by .css file using .ftl(freemarker template)
dynamic Checkboxe value retrieval
Directory Structure JSP & JS
prototype framework with ajax in struts 2 'jsp
Struts 2 Tiles
developer file tools