Getting NullPointerException when using <t:inputDate>

View: New views
3 Messages — Rating Filter:   Alert me  

Getting NullPointerException when using <t:inputDate>

by Alan-147 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I searched the list, but I can't tell if my problem is the same as what has
been reported before.  In any case there don't seem to be any posts about
this since 1.1.9 was released, which I am using.

Very simply, I am coding the following:

<t:outputLabel for="dob" value="Date Of Birth:" />
<t:inputDate id="dob" value="#{UserEditor.user.dob}" />
<t:message for="dob" />


The EL resolves to a java.sql.Date object.  It renders fine, but when I
click on my "save changes" action button I get the following exception:

Error Rendering View[/user/editUser.xhtml]

java.lang.NullPointerException

        at
> javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:551)

        at
> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(HtmlMessageRenderer.java:200)

        at
> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(HtmlMessageRenderer.java:214)

        at
> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(HtmlMessageRenderer.java:214)


I'm really new to this so I am not sure if I am missing the obvious.   Any
suggestions?

Re: Getting NullPointerException when using <t:inputDate>

by Walter Mourão-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I suppose user (from #{UserEditor.user.dob}) is null.

Walter Mourão
http://waltermourao.com.br
http://arcadian.com.br
http://oriens.com.br



On Wed, Nov 4, 2009 at 6:27 PM, Alan <omegaobject@...> wrote:

> I searched the list, but I can't tell if my problem is the same as what has
> been reported before.  In any case there don't seem to be any posts about
> this since 1.1.9 was released, which I am using.
>
> Very simply, I am coding the following:
>
> <t:outputLabel for="dob" value="Date Of Birth:" />
> <t:inputDate id="dob" value="#{UserEditor.user.dob}" />
> <t:message for="dob" />
>
>
> The EL resolves to a java.sql.Date object.  It renders fine, but when I
> click on my "save changes" action button I get the following exception:
>
> Error Rendering View[/user/editUser.xhtml]
>
> java.lang.NullPointerException
>
>        at
> >
> javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:551)
>
>        at
> >
> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(HtmlMessageRenderer.java:200)
>
>        at
> >
> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(HtmlMessageRenderer.java:214)
>
>        at
> >
> org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.createOutputLabelMap(HtmlMessageRenderer.java:214)
>
>
> I'm really new to this so I am not sure if I am missing the obvious.   Any
> suggestions?
>

Re: Getting NullPointerException when using <t:inputDate>

by Alan-147 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/5 Walter Mourão <walter.mourao@...>

I suppose user (from #{UserEditor.user.dob}) is null.
>
>
It turns out that wasn't it.  (First thing I checked of course).

The error arises because dob is of class java.sql.Date.   When I re-coded so
that it was java.util.Date it works.

This looks like a bug to me, unless that is desirable behavior for some
reason.  java.sql.Date is a sub-class of java.util.Date so I can't see why
it shouldn't work.