This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSP and the fly likes Escaping special character Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Escaping special character" Watch "Escaping special character" New topic
Author

Escaping special character

Amarjyoti Das
Greenhorn

Joined: Mar 18, 2002
Posts: 16
I am trying to do create a simple String Buffer and my jsp page is failing. Here is what I am trying to do.
StringBuffer sb = new StringBuffer();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> ;
When I do <%= sb.toString() %> it returns nothing. If I do \< then I get invalid escape character error message. How can I fix the situation. I need to create an XML page from my JSP page.
Thank you
-- amar
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Did you set the content type of the page to be text/xml?
[ August 28, 2002: Message edited by: Chris Mathews ]
Sudharsan Govindarajan
Ranch Hand

Joined: Jul 03, 2002
Posts: 319
Why can't use a single-quote (') instead of the double-quote (") ? Single-quote does'nt need escaping
Ruilin Yang
Ranch Hand

Joined: Jan 06, 2002
Posts: 150
I would change it as:
StringBuffer sb = new StringBuffer();
sb.append("<?xml version=\'1.0\'encoding=\'UTF-8\' "?>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Escaping special character