2010-02-05 160 views
0

,当我想显示错误消息,但是,当它通过JSP错误消息的JSP不显示

<form:errors path="arnNumber" cssClass="error" /></span> 

返回JSP页面这是给我一个例外

org.springframework.context。 NoSuchMessageException: 在代码'ARN 中找不到消息编号为 required.contactUsUtil.arnNumber'为 区域设置'en_US'。

+1

猜你的问题是否给予了足够的信息; ) – Bozho 2010-02-05 10:23:02

回答

0

直译,它只是意味着它无法找到具有以下主要

ARN number is required.contactUsUtil.arnNumber
的消息包关联的任何消息在 applicationContext.xmlmessageSource属性definied。


的关键看起来可疑:)

0

定义它在应用程序上下文

<bean id="responseMessageSource" 
class="org.springframework.context.support.ReloadableResourceBundleMessageSource"> 
    <property name="cacheSeconds" value="3"/> 
    <property name="basename" value="classpath:response_msg" /> 
    <property name="defaultEncoding" value="UTF-8"/> 
</bean> 

资源文件夹下的定义,很容易

NO_SESSION=SESSION ERROR 
NO_PHOTO=The photo with specified id couldn't find 
SUCCESSFULL_CRATED_ALBUM=Album has created successfully 
ASSIGNED_ALBUM_PHOTO=This photo assigned as your album photo. 
SUCCESFULL_UPDATED_ALBUM=Album has updated successfully 
SUCCESFULL_UPDATED_PHOTO=Photo has updated successfully 
SUCCESFULL_CRATED_IMAGE_DIRECTORY=Image directories created successfully