Thursday, June 24, 2010

How to Display Tips messages from the properties files in JSF

Following tag should be included in jsp
<f:loadBundle basename="message" var="msg"/>
Note : here basename should be same as name of the properties file
following tag shows the Tips message in form
<h:outputText id="tips" styleClass="label" value="Tips :"/> <font size="1" id="msg" color="blue"></font>

calling the properties file values from the corresponding tags in jsp
<h:inputText id="tf_USER_PHONENO" binding="#{createuser.tf_USER_PHONENO}" maxlength="15" onkeypress="return onlyNumbers(event);" onblur="phoneNo(this)" onfocus="javascript:document.getElementById(\"msg\").innerHTML ='#{msg.tips_phoneno}'" autocomplete="off" >

message.properties
tips_phoneno = Enter only [0-9]

JSF Related topics: JCaptcha in JSF, Integrating Richfaces with JSF,Getting client and server sessionId in JSF,PopUp AlertMessagebox for JSF and more.....

No comments:

Post a Comment