Reputation: 77
I want to set the value of a primefaces tag from a bean method using arguments but this doesn't work.
On the Facelets page:
<p:outputLabel id="userLabel" value="#{languageBean.retrieveLanguage(1)}" />
<p:commandButton value="#{languageBean.retrieveLanguage(2)}"
action="#{loginBean.logIn()}"
update="loginForm"/>
On the bean:
public String retrieveLanguage(int key) {
return (String) getPageMap(pagePath, pageName).get(key);
}
I get the following exception:
javax.faces.view.facelets.FaceletException: Error Parsing /components/login.xhtml: Error Traced[line: 24] Element type "p:outputLabel" must be followed by either attribute specifications, ">" or "/>".
Could you give me any idea, please?
Regards, Roberto
Upvotes: 2
Views: 960
Reputation: 7501
You shouldn't be passing in the language value from the front page - this is moving actual login from the app into the graphical frontend. Rather, store the language value in the bean and simply call retrieveLanguage.
If you are trying to handle translations, have a look at resource bundles instead.
Upvotes: 1