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 >
and not >
. Because of this, I could not unescape in the controller to get the original value. Could anyone help on this?
Asked
Active
Viewed 2,925 times
0

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 `>` *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 > 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 Answers
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 > with > and do similar operation for other html characters.

Yashpal Singla
- 1,924
- 4
- 21
- 38
-
Hi Yashpal.. many thanks for the response. There are many html escape characters. It is difficult to manage using a custom method right. – sridhar Oct 30 '12 at 11:25
-
Yes right, if you don't have any restriction on special characters in your input. – Yashpal Singla Oct 30 '12 at 11:28