I’m using Spring form tag library and I want my form error messages to be
taken from some messages.properties file, I have the following jsp:
<form:form method="post" action="" commandName="client">
<form:input path="name"/><form:errors path="name">
<input class="button" type="submit"
value='<fmt:message key="login.submit"/>'>
</form:form>
here submit button value is loaded from some message
source file (<fmt:message key=”login.submit” />), and
I want my error messages to be loaded from there too,
I’ve tried the following, but it doesn’t work:
<fmt:message key='<form:errors path="name">' />
it simply returns ?????? value.
How can I do this?
You can’t nest JSP tags as you are trying to do (although you can put a JSP tag inside a HTML tag) but AFAIK the
form:errorstag will get the messages from the spring messageSource anyway. Try using justwithout the
<fmt:message...bit.