This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

context path in the message.properties of struts

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i use images in the jsp using the html:image tag with the srcKey="imageurl", the value of the key contains the image resource location. how to include the context path in the resource than using like this, ../../images/image1.gif?
 
az ziz
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please note this,
`<img src=<bean:message arg0="<%=request.getContextPath()%>" key="image1"/>>` works. but i cant change in 100s of jsp files which uses html:image.

thanks
V
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi az ziz

create a folder named images under web content and add all the images to the images folder.
now you can use like this



Thanks
 
az ziz
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, all the images are in images folder only. but the problem is with the relative path the old developers has given, ../../images now the context path is changing, so as the request uri changes the images in the jsp and their paths changes

if
my_project/transaction/a.jsp was the request
../images/img1.jpg will work
if the same was changed to my_project/a.jsp
../images/img1.jpg wont work

said above,
../images/img1.jpg will work were mapped in the message properties file of struts.
how to append the context path with the path than ../../

V
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use an absolute path.
 
I was her plaything! And so was this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic