• Post Reply Bookmark Topic Watch Topic
  • New Topic

& converted into & while coming from view to controller.  RSS feed

 
John teras
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing an issue in my application related to encoding.
There is one string data in view says "Hello P & C".
And when it comes to controller layer, it has been converted into "Hello P & C".


I don't want it to be encoded. What configuration I need to do. I am using (JSF 2.0, Primefaces 3.0, Spring 3.0)

Please Help.


Thanks.
John
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A rather odd use of terminology. The Controller in JSF is essentially invisible. What most people worry about is the resulting View and Model.

The JSF View Definition Language is an XML dialect and therefore subject to XML syntactical and semantic rules. One of those rules is that there are 5 "magic" characters (<, >, &, ", and ') that must frequently be escaped because otherwise the XML cannot be unambiguously parsed. These "escapes" are known as entities and the entity for the ampersand character is "&amp;" - including the final semicolon (I've seen a lot of sloppy websites that didn't include it).

When you code an outputText element, the default rendering is to escape these magic characters, so they will display exactly as the string would print. If your text is HTML that you want to apply, you can set the escape attribute to "false".

When you code an inputText element, there is no escape option. What you see is what you get, unless you meddle with its internals.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!