Doubt with JSP - Message

1

I need help, to display a message through fmt: message.

The situation is as follows. I have a form that is submitted via $ .post. In the controller that receives this request, I perform a validation through the BindingResult.

If I get an error, I return a JSON containing the errors found. When returning to the form I create an alert with Bootstrap to show the user the error found.

With the following excerpt:

var str = "field.required.departamento.nome";
str = $("<div></div>").addClass("alert alert-danger alert-dismissable fade in").
text('<fmt:message key="'+str+'"/>');

In the browser only the result appears:

???field.required.departamento.nome???

I made some tests, and when I run the same code with this property set to the variable place, the code works normally.

Any tips, help with this doubt?

    
asked by anonymous 26.06.2017 / 14:35

0 answers