Doubt with JSP - Message

Asked

Viewed 57 times

1

I am in need of 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 do a validation via Bindingresult.

If you have 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+'"/>');

Only the result appears in the browser:

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

I did some tests, and when I run the same code with this property set instead of the variable the code works normally.

Any hint, help regarding this doubt?

  • I think this one fmt will not work. JSP is rendered on the server.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.