null pointer while trying to ajaxify an <h:inputText>

UI Components for JSF
Post Reply
goutham.rao
Posts: 24
Joined: 29 Jan 2010, 16:27
Location: Newbury,United Kingdom

23 Mar 2010, 23:30

Good Evening,

I am a bit of a newbie to primefaces and here is a problem I am trying to solve. I have a simple input component that I'm trying to Ajaxify using p:ajax and below is my UI

Code: Select all

  <h:form id="simpleForm">
            Enter your name and Tab out <h:inputText id="nameInput" value="#{Person.firstName}" required="true" valueChangeListener="#{Person.validatePassword}">
                                                      <p:ajax process="nameInput" event="blur" update="msgs" />
                                                      </h:inputText>
                                                      <p:message for="nameInput" id="msgs" showDetail="true"/>
         
   </h:form>
This works if I change
<p:message> to <p:messages>

Code: Select all

  <h:form id="simpleForm">
            Enter your name and Tab out <h:inputText id="nameInput" value="#{Person.firstName}" required="true" valueChangeListener="#{Person.validatePassword}">
                                                       <p:ajax process="nameInput" event="blur" update="msgs" />
                                                       </h:inputText>
                                                       <p:messages id="msgs" showDetail="true"/>
         
        </h:form>
I have a simple backing bean method:

Code: Select all

@ManagedBean(name="Person")
@RequestScoped
public class Person {

    private String firstName;

    /** Creates a new instance of Person */
    public Person() {
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public void validatePassword(ValueChangeEvent evt)
    {
        FacesContext context = FacesContext.getCurrentInstance();
        
        context.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO,this.firstName + " is valid", "Hello "+firstName));
        
    }
}

And the error message is :
SEVERE: Error Rendering View[/person.xhtml]
java.lang.NullPointerException
at org.primefaces.component.message.MessageRenderer.encodeEnd(MessageRenderer.java:65)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1617)
at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:848)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1610)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1613)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:379)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:126)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:127)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:311)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1522)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)

Dev Env:
Java 6, Primefaces 2.0 in Glassfish 6.8:
I have a feeling that I'm doing a very rookie mistake and hence I'm knocking your doors.Please can some one clarify.

Best Regards,
Goutham
Primefaces 2.2.1
GlassFish V3.0, JSF 2.0.3
EJB 3.1,HIbernate 3.5
Coding on Netbeans 6.9.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

24 Mar 2010, 18:48

Hi Goutham,

Welcome to forum and PrimeFaces.

This issue is fixed in current 2.0.1 snapshot builds, please try with a nightly build from;

http://repository.prime.com.tr/org/prim ... -SNAPSHOT/

goutham.rao
Posts: 24
Joined: 29 Jan 2010, 16:27
Location: Newbury,United Kingdom

25 Mar 2010, 00:03

Hello Cagatay,

Thanks for taking the time out to reply , I just found the issue list on your wiki. Next time I shall have a peek before posting. :)

I would like to confirm that this works fine for me.

Regards,
Goutham
Primefaces 2.2.1
GlassFish V3.0, JSF 2.0.3
EJB 3.1,HIbernate 3.5
Coding on Netbeans 6.9.1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

25 Mar 2010, 02:03

Thanks for confirming Goutham. Glad it works for you now.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 40 guests