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

JSP /Javascript rendering issue  RSS feed

 
Tobi McFarland
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Hibernate to pull text that is HTML mark up from a database, and passing that to a Javascript as an argument to a function that creates a pop up box.

Example DB string:

<html><body>Dates for Dummies</body></html>

when passed to this Javascript function:

function popHTML(txt){
var html = txt;
newwindow3=window.open('','name','height=200,width=150 screenX=350, screenY=100, left=500');
var tmp3 = newwindow3.document;
tmp3.write(html);
tmp3.close();
}

it successfully creates a pop up box with the text from the DB. However, if adding formatting to the string like <font face = "Arial"> things get quirky. Both the JSP and Javascript hiccup on the ". After changing the db string to include: <font face = \"Arial\">, there's still a problem, presumably that the JSP recognizes \" as a "-and passes it to the Javascript as simply a ".

Has anyone had to work around something similar?

Thanks
 
Tobi McFarland
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved. Simply replace the quotes with the ASCII for quotes. :-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!