5 Replies Latest reply on Sep 8, 2010 7:54 AM by Leo van den berg

    Problem...The page is not displayed

    Harsh Jain Newbie

      The registration.xhtml page is not displayped which I start the application


      Here is code for registration.xhtml




      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
      
      
      
      <ui:define name="body">
      <h:form id="register_student">
          <rich:panel>
              <f:facet name="header">WELCOME TO STUDENT REGISTRATION FACILITY</f:facet>
              
              
            
              <h:panelGrid columns="5" id="stdenroll" border="0" columnClasses="name;value;name;value">
                      <h:outputLabel for="fname">First Name</h:outputLabel>
                      <h:inputText id="fname" size="40" value="#{userdata.fname}"/>
                        <rich:separator id="fspacer" width="50px"></rich:separator>
                            
                      <h:outputLabel for="mname">Middle Name</h:outputLabel>
                      <h:inputText id="mname" size="40" value="#{userdata.mname}"/>  
                                    
                      <h:outputLabel for="lname">Last Name</h:outputLabel>
                      <h:inputText id="lname" size="40"  value="#{userdata.lname}"/>
                                    
                                     <rich:separator id="fspacer8" width="50px"/>                               
                                      
                      <h:outputLabel for="allocaterollno">ROLLNO</h:outputLabel>
                          <h:inputText id="allocaterollno" value="#{registration.myrollno}">
                          <a4j:support event="onblur" action="#{registration.checkRollno()}" reRender="allocaterollno"/>       
                          </h:inputText>
                                      
                                                   
                         
                      <h:outputLabel for="fathername">Father's Name</h:outputLabel>
                      <h:inputText id="fathername" size="40"   value="#{userdata.fathername}"/>
                                    
                                    
                             <rich:separator id="fspacer2" width="50px"/>
                                  
                      <h:outputLabel for="mothername">Mother's Name</h:outputLabel>
                      <h:inputText id="mothername" size="40" value="#{userdata.mothername}"/>
                                    
                      <h:outputLabel for="genderselect">Gender</h:outputLabel>
                      <h:selectOneRadio id="genderselect" value="#{userdata.gender}" noSelectionLabel=" -- Select --">
                             <f:selectItem itemValue="M" itemLabel="M"/>
                             <f:selectItem itemValue="F" itemLabel="F"/>
                           </h:selectOneRadio>
                           
                           
                                 <rich:separator id="fspacer3" width="50px"> </rich:separator>
                                                           
                          <h:outputLabel for="lname">D.O.B.</h:outputLabel>
                      <rich:calendar id="dob" value="#{userdata.dob}">           </rich:calendar>
                                      
                                       
                                       
                                                               
                         <h:outputLabel for="emailID">E-Mail</h:outputLabel>  
                          <h:inputText id="emailID" value="#{userdata.email}" size="40"/> 
                          
                          <rich:separator id="fspacer4" width="50px"/> 
                                                    
                      <h:outputLabel for="category">Category</h:outputLabel>  
                          <h:selectOneMenu id="category" value="#{userdata.category}"  noSelectionLabel=" -- Select --">
                                       <f:selectItem itemValue="Gen" value="General"/>
                                       <f:selectItem itemValue="OBC" value="OBC"/>
                                       <f:selectItem itemValue="SC" value="SC"/>
                                       <f:selectItem itemValue="ST" value="ST"/>
                                       <f:selectItem itemValue="PH" value="PH"/>
                                      
                          </h:selectOneMenu>
                                      
                         <h:outputLabel for="branch">Branch</h:outputLabel>  
                          <h:selectOneMenu id="branch" value="#{student.masterBranch}" noSelectionLabel=" -- Select --">
                          <f:selectItem itemValue="Computer" value="Computer"/>
                          <f:selectItem itemValue="IT" value="IT"/>
                          <f:selectItem itemValue="ECE" value="ECE"/>
                          <f:selectItem itemValue="Mechanical" value="Mechanical"/>
                          <f:selectItem itemValue="Electrical" value="Electrical"/>
                          <f:selectItem itemValue="Civil" value="Civil"/>
                          <f:selectItem itemValue="IEM" value="IEM"/>
                                      
                          </h:selectOneMenu>
                                     
                                             <rich:separator id="fspacer7" width="50px"/>        
                      <h:outputLabel for="section">Section</h:outputLabel>  
                          <h:inputText id="section" value="#{userdata.section}" />
                                      
                          <h:outputLabel for="phoneno" >Phone No.</h:outputLabel>
                          <h:inputText id="phoneno" value="#{userdata.phonenum}" />
                            
                                       <rich:separator id="fspacer6" width="50px"/>
                     
                                         
                                         
                          <h:outputLabel for="address" >Address</h:outputLabel>
                          <h:inputText id="address" value="#{userdata.address}" />
                               
                          <h:outputLabel for="city" >City</h:outputLabel>
                          <h:inputText id="city" value="#{userdata.city}" />     
                                      
                           <rich:separator id="fspacer6" width="50px"/>
                            
                          <h:outputLabel for="state" >State</h:outputLabel>
                          <h:inputText id="state" value="#{userdata.state}" />
                                      
                          <h:outputLabel for="pincode" >Pincode</h:outputLabel>
                          <h:inputText id="pincode" value="#{userdata.pincode}" />
                                      
                                      
                        <h:commandButton id="hello" label="Proceed" value="Proceed"
                          action="#{registration.register}" />
                          <s:conversationPropagation type="begin"/>
                          </h:panelGrid>
              </rich:panel>
             </h:form>
              </ui:define>
      
      </ui:composition>
      
              
              
      





      Entity bean ... UserData.java



      package org.domain.onlyregistration.entity;
      
      // Generated Sep 7, 2010 5:59:54 PM by Hibernate Tools 3.3.0.GA
      
      import java.util.Date;
      import javax.persistence.Column;
      import javax.persistence.Entity;
      import javax.persistence.Id;
      import javax.persistence.Table;
      import javax.persistence.Temporal;
      import javax.persistence.TemporalType;
      import org.hibernate.validator.Length;
      import org.hibernate.validator.NotNull;
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      
      /**
       * UserData generated by hbm2java
       */
      @Scope(ScopeType.CONVERSATION)
      @Name("userdata")
      @Entity
      @Table(name = "user_data", catalog = "onlyregistration")
      public class UserData implements java.io.Serializable {
      
           private int rollNo;
           private String email;
           private String fname;
           private String mname;
           private String lname;
           private Date dob;
           private String gender;
           private String branch;
           private String section;
           private String fathername;
           private String mothername;
           private String category;
           private String address;
           private String city;
           private String state;
           private Integer pincode;
           private String phonenum;
      
           public UserData() {
           }
      
           public UserData(int rollNo, String email, String fname, String lname,
                     Date dob, String gender, String branch, String section,
                     String fathername, String mothername, String category,
                     String address, String city, String state, String phonenum) {
                this.rollNo = rollNo;
                this.email = email;
                this.fname = fname;
                this.lname = lname;
                this.dob = dob;
                this.gender = gender;
                this.branch = branch;
                this.section = section;
                this.fathername = fathername;
                this.mothername = mothername;
                this.category = category;
                this.address = address;
                this.city = city;
                this.state = state;
                this.phonenum = phonenum;
           }
      
           public UserData(int rollNo, String email, String fname, String mname,
                     String lname, Date dob, String gender, String branch,
                     String section, String fathername, String mothername,
                     String category, String address, String city, String state,
                     Integer pincode, String phonenum) {
                this.rollNo = rollNo;
                this.email = email;
                this.fname = fname;
                this.mname = mname;
                this.lname = lname;
                this.dob = dob;
                this.gender = gender;
                this.branch = branch;
                this.section = section;
                this.fathername = fathername;
                this.mothername = mothername;
                this.category = category;
                this.address = address;
                this.city = city;
                this.state = state;
                this.pincode = pincode;
                this.phonenum = phonenum;
           }
      
           @Id
           @Column(name = "RollNo", unique = true, nullable = false)
           public int getRollNo() {
                return this.rollNo;
           }
      
           public void setRollNo(int rollNo) {
                this.rollNo = rollNo;
           }
      
           @Column(name = "Email", nullable = false, length = 40)
           @NotNull
           @Length(max = 40)
           public String getEmail() {
                return this.email;
           }
      
           public void setEmail(String email) {
                this.email = email;
           }
      
           @Column(name = "fname", nullable = false, length = 20)
           @NotNull
           @Length(max = 20)
           public String getFname() {
                return this.fname;
           }
      
           public void setFname(String fname) {
                this.fname = fname;
           }
      
           @Column(name = "mname", length = 20)
           @Length(max = 20)
           public String getMname() {
                return this.mname;
           }
      
           public void setMname(String mname) {
                this.mname = mname;
           }
      
           @Column(name = "lname", nullable = false, length = 20)
           @NotNull
           @Length(max = 20)
           public String getLname() {
                return this.lname;
           }
      
           public void setLname(String lname) {
                this.lname = lname;
           }
      
           @Temporal(TemporalType.TIME)
           @Column(name = "dob", nullable = false, length = 8)
           @NotNull
           public Date getDob() {
                return this.dob;
           }
      
           public void setDob(Date dob) {
                this.dob = dob;
           }
      
           @Column(name = "gender", nullable = false, length = 2)
           @NotNull
           @Length(max = 2)
           public String getGender() {
                return this.gender;
           }
      
           public void setGender(String gender) {
                this.gender = gender;
           }
      
           @Column(name = "branch", nullable = false, length = 20)
           @NotNull
           @Length(max = 20)
           public String getBranch() {
                return this.branch;
           }
      
           public void setBranch(String branch) {
                this.branch = branch;
           }
      
           @Column(name = "section", nullable = false, length = 10)
           @NotNull
           @Length(max = 10)
           public String getSection() {
                return this.section;
           }
      
           public void setSection(String section) {
                this.section = section;
           }
      
           @Column(name = "Fathername", nullable = false, length = 40)
           @NotNull
           @Length(max = 40)
           public String getFathername() {
                return this.fathername;
           }
      
           public void setFathername(String fathername) {
                this.fathername = fathername;
           }
      
           @Column(name = "Mothername", nullable = false, length = 40)
           @NotNull
           @Length(max = 40)
           public String getMothername() {
                return this.mothername;
           }
      
           public void setMothername(String mothername) {
                this.mothername = mothername;
           }
      
           @Column(name = "Category", nullable = false, length = 5)
           @NotNull
           @Length(max = 5)
           public String getCategory() {
                return this.category;
           }
      
           public void setCategory(String category) {
                this.category = category;
           }
      
           @Column(name = "address", nullable = false, length = 50)
           @NotNull
           @Length(max = 50)
           public String getAddress() {
                return this.address;
           }
      
           public void setAddress(String address) {
                this.address = address;
           }
      
           @Column(name = "city", nullable = false, length = 20)
           @NotNull
           @Length(max = 20)
           public String getCity() {
                return this.city;
           }
      
           public void setCity(String city) {
                this.city = city;
           }
      
           @Column(name = "state", nullable = false, length = 40)
           @NotNull
           @Length(max = 40)
           public String getState() {
                return this.state;
           }
      
           public void setState(String state) {
                this.state = state;
           }
      
           @Column(name = "pincode")
           public Integer getPincode() {
                return this.pincode;
           }
      
           public void setPincode(Integer pincode) {
                this.pincode = pincode;
           }
      
           @Column(name = "phonenum", nullable = false, length = 20)
           @NotNull
           @Length(max = 20)
           public String getPhonenum() {
                return this.phonenum;
           }
      
           public void setPhonenum(String phonenum) {
                this.phonenum = phonenum;
           }
      
      }
      
      



      Session Bean   registrationBean.java





      package org.domain.onlyregistration.session;
      
      import java.util.List;
      
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      import javax.persistence.EntityManager;
      
      import org.domain.onlyregistration.entity.UserData;
      import org.domain.onlyregistration.session.registration;
      
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Destroy;
      import org.jboss.seam.annotations.End;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.faces.FacesMessages;
      
      
      @Name("registration")
      @Scope(ScopeType.CONVERSATION)
      public @Stateful class registrationBean implements registration {
           
           private int myrollno;
           
           
           
      
           @In 
           private EntityManager entityManager;
           @In
           public UserData userdata;
           
           
           
           public void checkRollno()
           {
                System.out.println(this.getMyrollno());
                //String abc = this.getMyrollno().trim();
                //int roll=Integer.parseInt(abc);
                     List mystd =  entityManager.createQuery("select p.fname from UserData p where p.rollNo=:nm1").setParameter("nm1", myrollno).getResultList();
                     System.out.println(mystd.size());
                     if ( mystd.size()==0)
                          {
                          userdata.setRollNo(myrollno);
                          return; 
                          }
                     else
                     { FacesMessages.instance().add("Roll No. exists already");
                           return;
                     }
                
           }
           
           
           public int getMyrollno() {
                return myrollno;
           }
           
           @End
           public String register()
           {     
                entityManager.persist(userdata);
                return "/registration.xhtml";
           }
           
           
           @Remove
           void remove()
           {
           
           }
           
           @Destroy
           void destroy()
           {
           
           }
      
      
           
      
      }
      
      
      



      and registration.java






      package org.domain.onlyregistration.session;
      
      import javax.ejb.Local;
      
      @Local
      public interface registration {
           
           
           public void checkRollno();
           public String register();
      
      }
      
      




      Please help me as I am not able to figure out the solution of this problem