12 Replies Latest reply on Aug 22, 2007 8:04 AM by yohann Normandin

    Exception when i want to fill a form !!

    yohann Normandin Newbie

      Hello !!!

      I have a little problem. I'am developping a web application (with Netbeans, glassfish and hibernate). In a page, the client must fill a form and when I click on the button, there is this exception :

      Exception during request processing: javax.servlet.ServletException: /abonnement_contact.xhtml @45,70 value="#{contactel.firstName}": Target Unreachable, identifier 'contactel' resolved to null

      my jsf 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"
       <ui:composition template="templates/client.xhtml">
       <ui:define name="servicesclients">
       <h3>Please fill the Contact form</h3>
       <h:dataTable id="contact" value="#{conts}" var="cont" rendered="#{cont.size>0}">
       <f:facet name="header">Contacts</f:facet>
       <h:outputLabel value="#{cont.firstName} #{cont.lastName}"/>
       <h:panelGrid columns="2">
       <h:outputLabel value="FirstName :"/>
       <h:inputText value="#{contactel.firstName}"/>
       <h:outputLabel value="LastName :"/>
       <h:inputText value="#{contactel.lastName}"/>
       <h:outputLabel value="Phone :"/>
       <h:inputText value="#{contactel.phone}"/>
       <h:outputLabel value="Other Phone :"/>
       <h:inputText value="#{contactel.otherPhone}"/>
       <h:outputLabel value="Mail :"/>
       <h:inputText value="#{contactel.mail}"/>
       <h:outputLabel value="Username :"/>
       <h:inputText value="#{contactel.username}"/>
       <h:outputLabel value="Password :"/>
       <h:inputText value="#{contactel.password}"/>
       <h:commandButton value="Save" action="#{ContactManager.createContact}"/>

      and my bean :
      public class ContactManager implements com.pingwy.web.front.ContactManagerLocal, Serializable{
       private EntityManager em;
       List<Contact> contacts;
       @In(required = false) @Out (required = false)
       Contact currentContact;
       @In (required = false)
       Contact contactel = new Contact();
       private List<Contact> conts;
       public String findContact(){
       Query query;
       query = em.createQuery("select c from Contact c where c.customerId=#{currentContact.customerId}");
       contacts = (List<Contact>) query.getResultList();
       return null;
       public String updateContact(){
       return null;
       public String removeContact (){
       System.out.println("contact bientot supprimé");
       return null;
       @Begin(join = true)
       public String createContact(){
       return "success";
       public List<Contact> getConts() {
       return conts;
       public void setConts(List<Contact> conts) {
       this.conts = conts;
       public Contact getContactel() {
       return contactel;
       public void setContactel(Contact contact) {
       this.contactel = contact;
       @Remove @Destroy
       public void destroy(){

      Thanks for your help .