Abc. Properties

Sid=student Id

Sname=student name

Saddre=student address

Semail=student email

Smobilel=student mobile

Button=add student

Javax. faces. validator. Regix validator. NOT.MATCHED-Detail= value must be provided in “{0}”format

Sid-validation-msg=student id must be started with Dss





<meta http-equiv=”Refresh” context=”2;Ural=http://local host:1010/Jsf2 validations app/student add form .dss”>



<h1>application is loading</h1>

</ body >



Student add form.jsp

<%@loglib prefix= ”f”url=

<%@                            ”h”



<h1> soft pvt ltd</h1>

<h2>student add form</h2>


<h:panel Grid column=”3”>

<h:output text value=”#{msg.sid}”/>

<h:input text id=”sid” value=”#{student Bean.sid}”

required=”true ” required message= student IN is required”>

<f:validator validator Id=”sid validator”/>

</h:input text>

<h: message for=”sid”/>

<h:output text value=”#{msg. sname}”/>

<h:input text id=”sname” value=”#{student}”

required=”true ” required message= “student name is required”>

</h:input text>

<h: message for=”s name”/>

<h:output text value=”#{msg. saddr}”/>

<h:input text id=”saddr” value=”#{student Bean. saddr }”

required=”true ” required message= “student address is required”>

<h: message for=”saddr”/>

<h:output text value=”#{msg. semail}”/>

<h:input text id=”semail” value=”#{student Bean. semail }”

required=”true ” required message= “student email is required”>

</h:input text>

<h: message for=”semail”/>

<h:output text value=”#{msg. smobile}”/>

<h:input text id=”smobile” value=”#{student Bean. smobile}”

required=”true ” required message= “student mobile is required”>

<f:validate range xpattern=”/d{2}-/d{10}$”/>

</h:input text>

<h: message for=”smobile”/>

<h: command button value=”#{msg. button}”action=”#{student bean. add }”/>

</h:parel Grid>



</ body >




<%@Loglib prefix=”f”



</body >

</f:view><h1 >student registration success</h1 ></fiview >

</body >


<body >


<h1>Registration success</h1>


</body >




Package com. durga soft

Public class Regiatration bean{

Private strin eid;

Private strin ename;

Private strin eaddre;

Private strin eemail;

Private strin emobile;

//provide setter()&getter()

Public string registration(){

Return ”success”;




Package com. soft;

Import java. Util. iterator;

Import java. Util. resource bundle;

Import java. Faces. application. application;

Import java. Faces. application. application message;

Import java. Faces. component. UI Component;

Import java. Faces. content. faces context;

Import java. Faces. validator. validator;

Import java. Faces. validator. Validator exception;

Public class email validate implements validate{

Public void validator(faces context)fe, UI Component we, object value)throws  validator exception{

String email=(string)value;

If(email. contains(“@”)){

Application application=fe.get application();

String prp-file=application .get message bundle();

Resource bundle bundle=resource bundle. get bundle(pre-file);

String err-msg=bundle. Get string(“email- validator”);

Faces message fm= new faces message();

Fm.set detail(err-msg);

Throw new validator exception(fm);









<managed. bean>

<managed. Bean-name>studentBean</managed. Bean-name>

<managed. Bean-class>com. soft. registration bean

<managed. Bean-scope>session</     >

</managed. Bean>


<from-view- id>/employee from.jsp</>


<from-outcome >success </ >

<to-view-id>/success.jsp</ >



< validator -id>email-validator</  >








<message-bundle>abc</ message-bundle>