• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Links in properties file

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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. <c:out> will do that, and so will (I believe) the proprietary Struts equivalent.

Each has a way to turn that encoding off.
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this. May be it can help you out

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

 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Why am I so drawn to cherry pie? I can't seem to stop. Save me tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic