wood burning stoves*
The moose likes Struts and the fly likes How to convert the value of String in simple text as well as url link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to convert the value of String in simple text as well as url link " Watch "How to convert the value of String in simple text as well as url link " New topic
Author

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

Rajesh k Jha
Ranch Hand

Joined: May 10, 2009
Posts: 72
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

Joined: May 10, 2009
Posts: 72
Can someone help me to resolve this issue?..Thanks in advance
Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

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


[Vipassana] - It is seeing the reality as it is, And not as you want it to be.!!!
SCJP1.5.
Rajesh k Jha
Ranch Hand

Joined: May 10, 2009
Posts: 72
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

Joined: Oct 29, 2001
Posts: 8997
    
    9

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.


[How To Ask Questions On JavaRanch]
Rajesh k Jha
Ranch Hand

Joined: May 10, 2009
Posts: 72
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

Joined: May 10, 2009
Posts: 72
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to convert the value of String in simple text as well as url link