• Post Reply Bookmark Topic Watch Topic
  • New Topic

Links in properties file

 
vinitha simon
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a properties file containing several key value pairs, I need to display one at a time, based on the request, some of the messages have links in them. I'm unsure how to implement links inside properties file, because in my jsp, I'm using struts2.0 to retrieve the value... when I read the value, ,I see the entire content on the jsp, not the link....

sample.properties

key1 = here is the <a href="sample.html">link</a>

in jsp

<s: property value="getValue()"/>

the final output :

here is the <a href="sample.html">link</a>

Any help is appreciated.

TIA
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vinitha simon:
the final output :

here is the <a href="sample.html">link</a>

So what's the problem? Looks the same to me.
[ September 02, 2008: Message edited by: Bear Bibeault ]
 
vinitha simon
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the problem is, I expect to see
"here is the link" as the output in which the word "link" is actually a link to sample.jsp, instead I see

"here is the <a href="sample.html">link</a>" in my view.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you emitting the text? If you are seeing the angle brackets in the browser window, something is HTML-encoding the characters to their HTML entity equivalents. <cut> will do that, and so will (I believe) the proprietary Struts equivalent.

Each has a way to turn that encoding off.
 
vk jain
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this. May be it can help you out

<a href=<S:property value ="">>link</a>

 
Paul Michael
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear is correct, try looking for an escape or escapeXml attribute for the tag you're using (c tag for example) and set it to false.
 
vinitha simon
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all, I figured out the solution, in the jsp

<s:property escape="false" value="getValue()"/>

setting escape=false renders the html view.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!