views:

19

answers:

2

Hi,

I have the following snippet of code in the Validator which basically is used to show an error message. In the error message I would like to show a link by sending it as a parameter in the error message.

if (user != null && formData.getUserId()== null) {          
    errors.rejectValue("email", "email.already.exists",new Object[]{"Link "},null);
    return;
}

I am unable to get the desired error message on the JSP page . The error is rendered like a string and is not converted to HTML code. Please help.

Thank you Manu

A: 

The error variable should only be a string. In your JSP, enclose that string with whatever HTML markup you would like.

Greg Harman
+1  A: 

<form:errors> has an escapeHtml attribute:

<form:errors escapeHtml = "false" ... />

Note, however, that this may cause undesired behaviour if other error messages displayed by this tag should be escaped.

axtavt