2010-02-05 131 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