Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to convert the value of String in simple text as well as url link

 
Rajesh k Jha
Ranch Hand
Posts: 72
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Currently i am working on an issue where i need the value of a string in the JSP to display the data as simple text as well as link of the url where my value starts with the http://, though i have added .

For example if we have a string which contains a value in the action class is

[code=java]
There are some changes that we need to visualize and can get the reference in the places http://localhost:8080/abc.action?value='Too' and http://localhost:8080/abc.action?value='Foo'
and this need to be finalized http://localhost:8080/abc.action?value='Too' and http://localhost:8080/abc.action?value='Foo'


code]

so above value should display in jsp like

There are some changes that we need to visualize and can get the reference in the places http://localhost:8080/abc.action?value='Too' and http://localhost:8080/abc.action?value='Foo'
and this need to be finalized http://localhost:8080/abc.action?value='Too' and http://localhost:8080/abc.action?value='Foo'


Thanks in advance
Rajesh
 
Rajesh k Jha
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone help me to resolve this issue?..Thanks in advance
 
Pravin Shirke
Ranch Hand
Posts: 152
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajesh,

If i have not interpreted it wrongly... then you need to display some text instead of those url and on click it should take you to the url mentioned. If this is the question then you should use. html anchor tag
Hope this helps
 
Rajesh k Jha
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi pravin,

This is not the exact case , Actually i want statement which is the combination of the simple text and url to be displayed in the JSP. I set the value of url inside the anchor tag in the action class
but when i display it in the JSP it displays like

'We can do something fruitful followin the link url <a<space>href='url'>http://abc.com</a> and then this will help further <a<space>href='url'>Again some textt</a> tag '

Struts tag is not able to parse the url from the value of the variable.

 
Joe Ess
Bartender
Pie
Posts: 9258
10
Linux Mac OS X Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What tag are you using to put the text on the JSP? Some tags, like property, have an escapeHtml attribute, which determines if things like greater than and less than signs show up as text (escaped) or are written as-is to be interpreted by the browser.
 
Rajesh k Jha
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Joe,
You have got the point, but what is the solutin of it as
Currently i am using


and is displaying anchor tag with less (<) and greater then sign instead of parsing it as url .

Thanks
Rajesh

 
Rajesh k Jha
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Joe,
The issue has been resloved, Thanks for the great help . I add the following value in the s:proprty tag and it worked.

escapeHtml="false"

as the default value of capeHtml="true"

Thanks a ton Joe for giving me the right direction to think.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic