jsf - Where to place configuration properties files in a JSP web application? -
i read where place configuration properties files in jsp/servlet web application? , more dont have java class, have xhtml page messages property. set properties fcile webcontent, src, bundle in src, meta inf none of them worked.
the xhtml page:
<?xml version="1.0" encoding="utf-8" ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>#{msgs.windowtitle}</title> </head> <body> <h:form> <h:panelgrid columns="2" columnsclasses="evencolumns, oddcolumns"> #{msgs.nameprompt} <h:inputtext/> #{msgs.passwordprompt} <h:inputsecret id="password" /> #{msgs.confirmpasswordprompt} <h:inputsecret id="passwordconfirm"/> </h:panelgrid> <h:commandbutton type="button" value="submit" onclick="checkpassword(this.form)" /> </h:form> </body> </html> facesconfig:
<?xml version="1.0" encoding="utf-8"?> <faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd" version="2.2"> <application> <message-bundle>messages</message-bundle> </application> </faces-config> checkpassword.js (i set in webcontent, couldnot have time find set js, first want find out properties)
/** * */ function checkpassword(form){ var password = form[form.id+":passwordconfirm"].value; var passwordconfirm = form[form.id+":password"].value; if(password==passwordconfirm){ form.submit(); } else{ alert("wrong"); } } i utilize eclipse kepler jsf 2.2. apache tomcat 7.0.54
when run, shows input texts, not title or other texts. can reason?
i changed lot of times name of file. messages, msgs, messages , declaration still did not work.
try set within faces-config:
<application> <resource-bundle> // seek set within main/java/resources <base-name>com.x.messages</base-name> <var>msg</var> </resource-bundle> </application> and exceptional bundle can specify bundle view:
f:loadbundle basename="com.x.messages" var="msg"/> jsf tomcat properties
No comments:
Post a Comment