Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rushi Patel
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....!
directory.jpg
[Thumbnail for directory.jpg]
Is it correct File hirarchy ??
errorPageCode.jpg
[Thumbnail for errorPageCode.jpg]
Snap shot of Error page
 
Pete Nelson
Ranch Hand
Posts: 147
Debian Eclipse IDE Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64848
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic