0

Basically I have a form with a textbox.

Some of the input value contains html entities (specifically <, >).

Say I input "<" and pass my values as such:

var theDescription = $("#inMaintDescription").val()

$.ajax( {
        url : "Ajax.faces",
        type : "GET",
        cache : false,
        contentType : 'application/json; charset=utf-8',
        data : {
            description: theDescription

However when it reaches java, it becomes

String theDescription = inRequest.getParameter(RequestConstants.AJAX_REQUEST_VARIABLE_DESCRIPTION);

theDescription is literally &lt; instead of <

How can I input < on my text box and the java string receives it as < ? Is string replacement on java the only way?

Jordin Vell
  • 141
  • 1
  • 2
  • 11

1 Answers1

0

You can try using the Apache Commons StringEscapeUtils.unescapeHtml4()

Joe Urc
  • 487
  • 5
  • 19
  • Edit: I made this to work by using unEscapeHtml on the last method that uses my value with html entities. Thanks! – Jordin Vell Apr 15 '16 at 03:08