Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HTML string in java  RSS feed

 
srinivas krishnan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am returning an HTML string from a java method to a jsp(which is basically an href link)For some reason the link does not get resolved and it just prints the text..I escaped the characters < with < > with >> " with "..Any ideas?
Thanks in advance.

Original String:
<a href="test.jsp?row=1&row=2"><img src="/dac/images/pen.gif"></a>
String returned to jsp:<a href="test.jsp?row=1&row=2"><img src="/dac/images/pen.gif"></a>
 
Vijay Vaddem
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srinivas,

Is it really required to pass the entire string along with <a href.... tag??
I feel u can put this in JSP and pass the path as a string....
 
srinivas krishnan
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is actually required to pass the entire string. The link should appear based on certain condition which is checked-for and if and only if the condition is met, we display the link.Let me know, If there is way to return the string from java code.
Thanks
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the JSP forum...
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post the exact string that you are using for your return statement. There might be a problem with the escape characters.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36396
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srinivas,
I would consider creating a method in your java object to determine whether the href should be displayed. Then your JSP could use a conditional tag to display the href.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!