Details
Description
I have a boolean checkbox, which toggles the rendered attribute on 2 inputDate tags. When I check the "continuous" checkbox, the page refreshes and the "begins" and "ends" inputDate tags are not rendered. But when I uncheck the checkbox, I get an exception. I have tried to replace the inputDate tags with inputText tags and that works just fine. Everything seems to indicate a problem with inputDate.
Here's the code I'm using, along with the exception thrown.
My JSF:
<html:form id="myForm">
<tomahawk:selectBooleanCheckbox id="continuous"
value="#
"
onclick="document.forms['myForm'].submit();"
immediate="true"/>
<html:outputText rendered="#
">
<tomahawk:inputDate id="begins" value="#
" required="true"/>
<tomahawk:inputDate id="ends" value="#
" required="true"/>
</html:outputText>
</html:form>
My ManagedBean:
public class ManagedBean extends AbstractRequestBean {
private boolean continuous;
private Date begins;
private Date ends;
public ManagedBean() {
String value = null;
if ((value = getRequestParameter("myForm:continuous")) != null)
else
{ continuous = false; }}
public boolean getContinuous()
{ return continuous; }public void setContinuous(boolean continuous)
{ this.continuous = continuous; }public Date getBegins()
{ return begins; }public void setBegins(Date begins)
{ this.begins = begins; }public Date getEnds()
{ return ends; }public void setEnds(Date ends)
{ this.ends = ends; }}
Exception thrown:
java.lang.NullPointerException
at org.apache.myfaces.custom.date.HtmlInputDate$UserData.isDateSubmitted(HtmlInputDate.java:329)
at org.apache.myfaces.custom.date.HtmlInputDate$UserData.isSubmitValid(HtmlInputDate.java:346)
at org.apache.myfaces.custom.date.HtmlInputDate$UserData.parse(HtmlInputDate.java:274)
at org.apache.myfaces.custom.date.HtmlDateRenderer.getConvertedValue(HtmlDateRenderer.java:359)
at javax.faces.component.UIInput.getConvertedValue(UIInput.java:936)
at javax.faces.component.UIInput.validate(UIInput.java:861)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1071)
at javax.faces.component.UIInput.processValidators(UIInput.java:663)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1040)
at javax.faces.component.UIForm.processValidators(UIForm.java:229)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1040)
at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:667)
at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:113)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at portal.b2b.filters.StatisticsFilter.doFilter(StatisticsFilter.java:103)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at portal.b2b.filters.UserFilter.doFilter(UserFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at portal.b2b.filters.HostFilter.doFilter(HostFilter.java:97)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at portal.b2b.filters.InitializeFilter.doFilter(InitializeFilter.java:36)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
#] |