myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bgs...@comcast.net
Subject Help with Multi-step Wizard "Previous" Button...
Date Mon, 29 Jan 2007 15:47:04 GMT
(I posted this to the "dev" email list by accident, so I am reposting here with a bit more
information...) 

I am implementing a multi-step registration wizard which functions as follows:

1. Uses one backing bean per wizard page
2. Uses Tomahawk saveState to save model data between pages
3. "Next" button performs full-validation on all required and critical input fields for each
page
4. "Previous" button navigates back to the previous wizard page, without performing any validation.
 However, if the user has entered any values on the page, it pushes those values into the
model/backing bean before navigating to the previous page

I am using the "immediate" attribute on the "required" input components, along with the "immediate"
attribute on the "Previous" commandButton component, as well as an actionListener which invokes
a method to processUpdates() on the UIViewRoot when the button is clicked.  All this works
fine, the user's entries are saved to the model and restored when the come back to the page
(even though they have not been validated yet), and validation occurs when they hit the "Next"
button on every page.

Here's my problem though:

When the user navigates to a new page and does not enter ANY data for the "required"/"immediate"
input fields, then clicks the "Previous" button a Null Pointer exception is thrown during
the applyRequestValues() phase (see stack trace below).  However, if they actually enter data
into each of the "required"/"immediate" input fields everything works just fine.  Also, if
I remove the "required" attribute, then the exception disappears but of course there is no
validation which runs when the user subsequently clicks the "Next" button either so that is
not really an option.  Any ideas?  I have set breakpoints in many places, but cannot figure
out exactly why this exception is being thrown or how to get around it.

javax.servlet.ServletException
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:156)
	org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)

root cause 
java.lang.NullPointerException
	javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:112)
	javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:136)
	org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(LifecycleImpl.java:219)
	org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
	org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
Mime
View raw message