The basename property is relative to war root (not classpath), hence you should put it on <war_root>/messages_en.properties
. If you don't want the properties file to be served, it's better to put it on <war_root>/WEB-INF/messages_en.properties
and set the basename property to WEB-INF/messages
Locating resourcebundle when deploying on weblogic
-
24-06-2022 - |
Frage
I am gettign the following error when attemptign to load the jsp,after deploying the spring application on weblogic:
javax.servlet.jsp.JspTagException: No message found under code 'label.firstname' for locale 'en_US'.
What am I doing wrong?
JSP:
<form:form method="post" action="add.html" commandName="contact">
<table>
<tr>
<td><form:label path="firstname"><spring:message code="label.firstname"/></form:label></td>
<td><form:input path="firstname" /></td>
</tr>
.....
</table>
</form:form>
Spring context:
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
Web-app(war) structure
META-INF/
META-INF/MANIFEST.MF
WEB-INF/
WEB-INF/classes/
WEB-INF/classes/messages_en.properties
WEB-INF/classes/org/
WEB-INF/classes/org/spring/
WEB-INF/classes/org/spring/controller/
WEB-INF/classes/org/spring/controller/ContactController.class
WEB-INF/classes/org/spring/dao/
WEB-INF/classes/org/spring/dao/ContactDAO.class
WEB-INF/classes/org/spring/dao/ContactDAOImpl.class
WEB-INF/classes/org/spring/entity/
WEB-INF/classes/org/spring/entity/Contact.class
WEB-INF/classes/org/spring/service/
.....
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow