Reputation: 1332
This question is very similar (if not the same as):
"Can't find bundle for base name messages" error
ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages
Basically, i have this code:
<body>
<f:view>
<f:loadBundle basename="de.vogella.jsf.starter.messages" var="msg" />
<h:form>
<h:panelGrid columns="2">
<h:outputLabel value="#{msg.user}"></h:outputLabel>
<h:inputText value="#{user.name}">
<f:validator
validatorId="de.vogella.jsf.starter.validator.LoginValidator" />
</h:inputText>
<h:outputLabel value="#{msg.password}"></h:outputLabel>
<h:inputSecret value="#{user.password}">
</h:inputSecret>
</h:panelGrid>
<h:commandButton action="#{user.login}" value="#{msg.login}"></h:commandButton>
<h:messages layout="table"></h:messages>
</h:form>
</f:view>
And when I try to run, I get
An exception occurred processing JSP page /LoginView.jsp at line 13
10: </head>
11: <body>
12: <f:view>
13: <f:loadBundle basename="de.vogella.jsf.starter.messages" var="msg" />
14: <h:form>
15: <h:panelGrid columns="2">
16: <h:outputLabel value="#{msg.user}"></h:outputLabel> Stacktrace:
Caused by:
java.util.MissingResourceException - Can't find bundle for base name de.vogella.jsf.starter.messages, locale en`
I tried to change file name, change file name in code, adding resource folder (but I think it was already properly included), and putting messages.properties file in all possible folders. Curiously, eclipse itself shows this error, it also has empty suggestion boxes for basename (no default proposals). In case it helps, my project structure: https://i.sstatic.net/q7VUF.jpg
Upvotes: 1
Views: 3314
Reputation: 79
I too faced the same issue. But finally, if you keep the messages.properties file under any package(de.vogella.jsf.starter.model) and include this as follows: < f:loadBundle basename="de.vogella.jsf.starter.model.messages" var="msg" /> It is Working.
Upvotes: 0
Reputation: 251
Can you confirm if you have message.properties file in the directory de.vogella.jsf.starter
?
If not please add the message.properties in this directory and then compile all. Check if you still get the exception?
Upvotes: 2