?
Solved

struts: problem getting images to show up

Posted on 2006-05-24
4
Medium Priority
?
276 Views
Last Modified: 2010-04-01
I am using struts with tiles.

all my images are in project/web/images/. in the html page I am using ./images/xyz.gif to refer to an image, this works fine was pages that are in web directory.

if my action forward path is /actions/customer then the image url becomes /actions/customer/images and hence is not able to find any of the images.

is there a easier way to deal with it. I am confused with paths.



0
Comment
Question by:muthiahmerchant
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
evnafets earned 1000 total points
ID: 16755602
Couple of ways.

1 - use the struts html:img tag, which automatically adds in the servlet context part of the URL, and so will let you use absolute references
<html:img page="/images/xyz.gif">

2 - use the struts <html:base> tag on your page.
A base tag tells a web page where to resolve relative links to.
That means that you can use links relative to where your JSP is in the directory structure, rather than to the "action" you call it with.

0
 
LVL 1

Author Comment

by:muthiahmerchant
ID: 16756309
Thanks. <html:img>  worked very well.

along the same lines can you help me figure out how to determine the path for my config.properties. right now I have to use an absolute path.

My app is in c:/myprojects/CAS but my tomcat is in C:\Program Files\netbeans-5.5beta\enterprise3\apache-tomcat-5.5.16

hence when i use user.dir it takes me to C:\Program Files\netbeans-5.5beta\enterprise3\apache-tomcat-5.5.16 and not c:/myprojects/CAS.

is there a way I can put my config.properties in c:/myprojects/cas/config.properties and be able to use it without using absolut path.

I will award the points for this question. even if you don't  konw the answer to config.properties

Thanks a lot
0
 
LVL 1

Author Comment

by:muthiahmerchant
ID: 16756423
Sounds right. I will close this question

Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most folks would know the basics of how Dropbox works, so that’s not the purpose of this article. Security is what it’s all about, so here I’ll share how I choose to secure my Dropbox Account and the Data it contains.
With more and more companies allowing their employees to work remotely, it begs the question: What are some of the security risks involved with remote employees and what actions should we take to secure them?
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question