Updated 7/13: used google pages as my online wysiwyg to generate valid html for xml files
We use SpringMVC and use the built-in validator support. I had a problem parsing in a parameter for an error message.
my applicationcontext contained:<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename"> <value>app</value> </property> </bean>
the line in my resource bundle,app.property, was:error_key=What's up, {0}?
the validator call was:
errors.reject(errorcode, new Object[] {"doc"}, defaultMessage);
My jspx file looked like this:
<spring:hasbinderrors name="mycommand">
<div class="error">
<c:foreach var="error" items="${errors.allErrors}">
<li><spring:message arguments="${error.arguments}" code="${error.code}"></spring:message></li>
</c:foreach>
</div></spring:hasbinderrors>
Like always, the answer was found in the javadocs. The parameter binding is backed by java.text.MessageFormat and what happens is that a single quote, ' , stops any binding. So to solve the problem, use two quotes '' to represent a single quote.
No comments:
Post a Comment