Wizard in ModalPanel
gabo.gabo80.gmail.com Jun 17, 2009 8:48 PMHi,
I am trying to create a two page wizard embedded in a modal panel but I cannot get to the second page, apparently it is not even submitting the request.
What am I doing wrong? Thanks!!!
The code for the modal panel is the following:
<rich:modalPanel id="registrationPanel" width="530" height="500" resizeable="false" moveable="false"> <h:form> <a4j:include viewId="/registrationStep1.xhtml" /> </h:form> </rich:modalPanel>
The registrationStep1.xhtml page contains some POJO attributes and a call to the saveUserInfo() method on a Stateful Session Bean:
<h:form> First name: <h:inputText name="fname" class="textboxes" id="fname" value="#{user.firstname}"/> Last name: <h:inputText name="lname" class="textboxes" id="lname" value="#{user.lastname}"/> <a4j:commandLink action="#{userService.saveUserInfo()}">Next</a4j:commandLink> </h:form>
The Stateful Session Bean userService looks like this:
@Stateful @Name("userService") public class UserService implements UserServiceLocal { @PersistenceContext(type=PersistenceContextType.EXTENDED) private EntityManager em; @In private FacesMessages facesMessages; @In(required=false) @Out(required=false) private User user; private boolean userInfoValid; public void saveUserInfo() { userInfoValid = true; if (user.getFirstname() == null || user.getFirstname().length() == 0) { facesMessages.addToControl("fname", "Invalid first name"); userInfoValid = false; } if (user.getLastname() == null || user.getLastname().length() == 0) { facesMessages.addToControl("lname", "Invalid last name"); userInfoValid = false; } if (userInfoValid) { try { em.merge(user); } catch (Exception e) { facesMessages.add(e.getMessage()); userInfoValid = false; } } } public boolean isUserInfoValid() { return userInfoValid; } }
And my pages.xml looks like this:
<page view-id="/registrationStep1.xhtml" conversation-required="true"> <description>Save user info</description> <navigation from-action="#{userService.saveUserInfo}"> <rule if="#{userService.userInfoValid}"> <redirect view-id="/layout/registrationStep2.xhtml"/> </rule> </navigation> </page>