wood burning stoves 2.0*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
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....!



[Thumbnail for directory.jpg]


[Thumbnail for errorPageCode.jpg]

Pete Nelson
Ranch Hand

Joined: Aug 30, 2010
Posts: 147

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: 166

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 ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to bind images and text together in same jsp page in easiest way?
 
Similar Threads
dynamic Checkboxe value retrieval
Directory Structure JSP & JS
prototype framework with ajax in struts 2 'jsp
Struts 2 Tiles
how to get an image by .css file using .ftl(freemarker template)