0

I am applying fn:escapeXml to a input value (say >) in JSP to do html escape. When I submit the form, I do need to send the parameter to the controller. In my controller, the request parameter comes as &gt and not >. Because of this, I could not unescape in the controller to get the original value. Could anyone help on this?

sridhar
  • 1,117
  • 5
  • 31
  • 59
  • What is backticks.. could u please help me. – sridhar Oct 30 '12 at 11:17
  • I've edited your code. Take a look [at it](http://stackoverflow.com/posts/13137781/revisions) for how I've done it. And see http://stackoverflow.com/editing-help#code-spans –  Oct 30 '12 at 11:18
  • Many thanks Tichodroma. I am yet to get what is backticks :(. – sridhar Oct 30 '12 at 11:23
  • See https://en.wikipedia.org/wiki/Grave_accent –  Oct 30 '12 at 11:24
  • If you take a look at the [source code of JstlFunction.java](https://svn.apache.org/repos/asf/myfaces/core/branches/2.0.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java) which contains `fn:escapeXml` you will see this: `case '>' : app = ">"; break;` Are you sure, you only get `&gt` *without* the `;`? –  Oct 30 '12 at 11:28
  • Yes. You are correct.. Tichodroma. The parameter is encoded in the URL and %2526gt%253B is the value. It gives me &gt in the request. – sridhar Oct 30 '12 at 11:30
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/18784/discussion-between-tichodroma-and-sridhar) –  Oct 30 '12 at 11:33

2 Answers2

1

Apache Commons Lang - String Escape Utils

http://commons.apache.org/lang/api-2.4/org/apache/commons/lang/StringEscapeUtils.html

Use one of the unescape methods.

dvlpr
  • 139
  • 8
0

One solution is, create a custom method, and replace all string occurrences of &gt with > and do similar operation for other html characters.

Yashpal Singla
  • 1,924
  • 4
  • 21
  • 38