1 Reply Latest reply on Jan 5, 2008 8:40 AM by Pete Muir

    Newbie conversation question

    Andrew Elegante Newbie

      I'm having a hard time getting seam to start conversations when I want it to. I have a series of pages that go with a type of task. Using facelets I've created a special navigation bar for each task. This bar has a series of links that can be clicked on at any time that the user is working with that type of task. A couple of the links open 'wizards' for creating new things. What I would like to have happen is that every time a user clicks one of these links a new conversation is started and the first page of the wizard opens. I've tried this a couple of different ways and haven't had much luck

      Here is my stateful wizard bean

      public class FeeProductWizardBean implements FeeProductWizard {
       @Logger private Log log;
       private FeeProduct feeProduct;
       private FacesMessages facesMessages;
       private FeeConfiguratonHandler feesConfigBean;
       private FeeSearcher feeSearcher;
       private EntityManager em;
       /** Whether the product is valid or not */
       private boolean feeProductValid;
       /** The set of default assessment notes */
       private Hashtable<Integer,String> defaultAssessmentNotes;
       public void init() {
       defaultAssessmentNotes = feesConfigBean.getDefaultNotes();
       log.info("default assessment notes = " + defaultAssessmentNotes);
       * @see com.emida.intranet.fees.wizard.NewWizard#startNewWizard()
       public void startNewWizard() {
       log.info("Starting new fee product wizard");
       feeProduct = new FeeProduct();
       * @see com.emida.intranet.fees.wizard.NewWizard#back()
       public void back() {
       * @see com.emida.intranet.fees.wizard.NewWizard#next()
       public void next() {
       log.info("next called : " + feeProduct);
       * @see com.emida.intranet.fees.wizard.FeeProductWizard#validateDates()
       public void validateDates() {
       log.info("validating dates");
       if(feeProduct.getEndDate() != null) {
       if(feeProduct.getStartDate().compareTo(feeProduct.getEndDate()) >= 0) {
       log.debug("end date is after start date");
       facesMessages.addToControl("endDate", "#{messages.endDateError}");
       feeProductValid = false;
       }else {
       }else {
       * @see com.emida.intranet.fees.wizard.FeeProductWizard#isFeeProductValid()
       public boolean isFeeProductValid() {
       return feeProductValid;
       * @see com.emida.intranet.fees.wizard.NewWizard#cancel()
       public void cancel() {
       * @see com.emida.intranet.fees.wizard.NewWizard#destroy()
       public void destroy() {
       * @see com.emida.intranet.fees.wizard.NewWizard#saveNew()
       public void saveNew() {
       * @see com.emida.intranet.fees.wizard.FeeProductWizard#setupDefaultNote()
       public void setupDefaultNote() {
       FeeProductSearchConfig config = new FeeProductSearchConfig();
       if(feeSearcher.doFeeProductSearch(config).size() != 0) {
       log.debug("fee name has been taken");
       facesMessages.addToControl("feeName", "#{messages.feeNameError}");
       feeProductValid = false;
       }else {

      This is the facelets fragment for the navigation bar

      ?xml version="1.0" encoding="ISO-8859-1" ?>
      <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
      <f:loadBundle var="feesNav" basename="fees.GeneralFeeMessages" />
      <table class="sidebar">
       <td> <font size="-2">
       <h:form id="navForm">
       <h:panelGrid columns="1" cellpadding="2" cellspacing="2">
       <f:facet name="header">
       <h:outputText value="#{feesNav.feesHeader}"/>
       <h:outputText styleClass="sectionHeader" value="#{feesNav.manageFeeAgreements}"/>
       <h:outputLink value="/intranet/fees/feeAgreement/search.seam">
       <h:outputText value="[#{feesNav.searchFeeAgreements}]" />
       <h:commandLink id="newFeeAgreement" value="[#{feesNav.createNewFeeAgreement}]"
       action="#{feeAgreementWizard.startNewWizard}" />
       <h:outputText styleClass="sectionHeader" value="#{feesNav.manageFeeProducts}"/>
       <h:outputLink value="/intranet/fees/feeProduct/search.seam">
       <h:outputText value="[#{feesNav.searchFeeProducts}]" />
       <h:commandLink id="newFeeProduct" value="[#{feesNav.createNewFeeProduct}]"
       action="#{feeProductWizard.startNewWizard}" />
       <h:outputText styleClass="sectionHeader" value="#{feesNav.misc}"/>
       <h:outputLink value="/intranet/fees/approveFees.seam">
       <h:outputText value="[#{feesNav.approveFees}]" />

      I first tried using the s:link tag to start the wizard but for some reason I had to click the link twice before it would call the action method. The code for that was:

      <s:link id="newFeeProduct" value="[#{feesNav.createNewFeeProduct}]"
       action="#{feeProductWizard.startNewWizard()}" propogation="begin" />

      Here is the navigation rule from the pages.xml file.
      <page view-id="/fees/*">
       <navigation from-action="#{feeProductWizard.startNewWizard}">
       <redirect view-id="/fees/feeProduct/wizard/step1.xhtml" />

      In the application's current state, I can only click on the link once. The wizard is started within the current conversation but it won't start a new conversation and if I attempt to click the link again it tells me the conversation has already been started. Everything else works beautifully though.

      Seam 2.0.0 GA
      JBoss 4.2.2 GA

      Thanks in advance for your help.