开发者

Spring form errors from property file

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="log开发者_Go百科in.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:errors tag will get the messages from the spring messageSource anyway. Try using just

<form:errors path="name">

without the <fmt:message... bit.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜