• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Encoding problem in jsp

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks
I have a problem in jsp while encoding, in my jsp iam using Ajax response as xml, from DTO object iam trying to populate data in jsp ,
but when i found special characters like <,> it is throwing error like not able to parse the data for <,>,
can you please let me know what are the possibilities to overcome this issue.
thanks in advance

Thanks
Naresh
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does data in the XML contain characters such as < and >?

If that is the case, then your XML is not valid. To solve this, you should either put the data in a CDATA-segment, or escape the < and > with character entity references when you generate the XML:

<element><![CDATA[Some < text]]></element>

or:

<element>Some &lt; text</element>

For more info: XML CDATA, XML and HTML character entity references
[ April 22, 2008: Message edited by: Jesper Young ]
 
Naresh Talluri
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
thanks for your idea , but i have one concern..
if i use CDATA in any special characters it is not parsing, fine...
but while parsing iam considering this data and iam not able to populate in
jsp , it is showing empty string,
code :


[ April 22, 2008: Message edited by: Naresh Talluri ]
[ April 22, 2008: Message edited by: Naresh Talluri ]
reply
    Bookmark Topic Watch Topic
  • New Topic