0

I have a Java file that includes a lot of validation messages. I have added some HTML tags (anchor link) in one of them as you can see below.

if (count > 0) {
  //Reg Path
  if (pCustomer.getCsnoemail().equals("N")) {
    errorList.add(new ErrorMessage(1, "Someone has already registered using that username. Try again."));
  } else {
    errorList.add(new ErrorMessage(1, "Someone has already registered using that email address. Please **<a href='/account/register-or-signin'> sign in here</a>** or try again"));
  }
  return new Logon(0, Logon.FAIL, errorList);
}

In the browser the html anchor tag is not properly intepretted. How can I make sure my html is read in the browser? I want this change to happen in the Java file itself and not create another html file and redirect.

6
  • The rest of the message is displayed? Commented May 28, 2013 at 14:11
  • 2
    I'm guessing you need to return your response as text/html, but you need to let us know: 1. Which framework you're using? 2. How you're sending back the response? 3. Which server are you using? Tomcat? Java is just a language, not a framework... Commented May 28, 2013 at 14:12
  • 1
    In JSF <h:outputText escape="false" ...>. Default is true. Commented May 28, 2013 at 14:16
  • Yes, the rest of the message is displayed but the html anchor link is parsed as text Commented May 28, 2013 at 14:21
  • What is the mimetype of your response? Commented May 28, 2013 at 14:24

1 Answer 1

1

Well in the end I only had to use escapeXml="false"/ in my jsp and it worked

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.