user2480906
user2480906

Reputation: 21

How to use <spring:message tag in javascript/jQuery/jsp?

is resulting nothing. Here is my code....

  1. src/validationMessages.properties fname.error=First name is mandatory.

  2. Spring-servlet.xml messagesource is configured with basename = validationMessages

  3. Jsp code as mentioned above and jQuery as follows.... Rules:{ firstname: "required" }, Messages:{ firstname:{ required: "" }

    jsp taglib tag is included......

But the tag renders nothing...........required: " "

Any advice.?

Upvotes: 2

Views: 4086

Answers (1)

CodeHunter
CodeHunter

Reputation: 368

I don't know much about springs but you can try this. I've used the same to catch the values in Struts2 mvc

    $(document).ready(function() {
       var message='<spring:message code="${error.code}" text="${error.defaultMessage}"/>'
       alert(message);
    });

Upvotes: 1

Related Questions