wood burning stoves*
The moose likes Struts and the fly likes OGNL and dinamic s:url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "OGNL and dinamic s:url" Watch "OGNL and dinamic s:url" New topic

OGNL and dinamic s:url

Moli molina

Joined: Apr 07, 2010
Posts: 19
Hi at all!

Hi have a question about how to use s:url and s:property.
My question : I need to use s:url to get the url of my image.

This works , but the Url are inapropiate, because it do not include the aplication name...
on other images of the page I use this code
and It works.

How I get a correct s:url including a s:property?

Many Thanks

Moli molina

Joined: Apr 07, 2010
Posts: 19
I've found the solution.
I use

By mistake I was trying with <img src='<s:url value="/img/app/{%icon}.png"/>'/>.....

Ankit Garg

Joined: Aug 03, 2008
Posts: 9291

This can also be made to work if you use this
${pageContext.request.contextPath} will add the "application name" or the context path to the image location...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Moli molina

Joined: Apr 07, 2010
Posts: 19

I'll try with your solution.

Many Thanks Ankit,
I agree. Here's the link: http://aspose.com/file-tools
subject: OGNL and dinamic s:url
Similar Threads
question about struts2 and links
Struts 2 value append while using s:text
dyanmic part of the script tag does not get evaluated
Problem in opening a popup window in struts 2
accesing value from list of string