cancel
Showing results for 
Search instead for 
Did you mean: 

wizard: conditional logic issue

robertmarkbram
Champ in-the-making
Champ in-the-making
Hi All,

I am trying to put some conditional logic into the jsp of a single wizard step:


<c:choose>
  <c:when test="#{WizardManager.bean.admin eq 'true}">
    <p>admin things.. </p>
  </c:when>
  <c:otherwise>
    <p>ordinary user things.. </p>
   </c:otherwise>
</c:choose>

But it seems my c:x tags are being ignored.. same results whether I use:
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
or
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

Is this a life-cycle thing? I have tried adding jstl-impl-1.2.jar and jstl-api-1.2.jar to Alfresco-Community-3.3\tomcat\lib .. no difference.

Otherwise, is there another way I can modify the wizard to maybe trigger a different jsp if the user is a member of a particular group?

Thanks for any advice!

Rob
Smiley Happy
1 REPLY 1

robertmarkbram
Champ in-the-making
Champ in-the-making
I still don't know why the c:if, c:choose, c:when, cSmiley Surprisedtherwise tags don't work.. but I do know now how to express logic as part of the wizard definition. Make sure your bean encapsulates all data needed to make the decision and then give it a bean style get method that returns result values as true/false. Then something like this will work:

<step name="assignment" title-id="review_estimate_assignment" description-id="review_estimate_step1_desc">
   <condition if="#{ReviewEstimateWizard.admin == true}">
      <page path="/jsp/extension/wizards/review-estimate-wizard/assignmentAdmin.jsp"
            title-id="review_estimate_step1_title"
            description-id="review_estimate_step1_desc"
            instruction-id="default_instruction" />
   </condition>
   <condition if="#{ReviewEstimateWizard.hasNoNextStatus == true}">
      <page path="/jsp/extension/wizards/review-estimate-wizard/assignmentAtEnd.jsp"
            title-id="review_estimate_step1_title"
            description-id="review_estimate_step1_desc"
            instruction-id="default_instruction" />
   </condition>
   <condition if="#{ReviewEstimateWizard.hasNoPreviousStatus == true}">
      <page path="/jsp/extension/wizards/review-estimate-wizard/assignmentAtStart.jsp"
            title-id="review_estimate_step1_title"
            description-id="review_estimate_step1_desc"
            instruction-id="default_instruction" />
   </condition>
   <page path="/jsp/extension/wizards/review-estimate-wizard/assignment.jsp"
         title-id="review_estimate_step1_title"
         description-id="review_estimate_step1_desc"
         instruction-id="default_instruction" />
</step>



This is like an if, else-if, else-if, else series of clauses - the one <PAGE> element at the end not encapsulated by a <CONDITION> element is the else.

There better be a way to use  c:if, c:choose, c:when, cSmiley Surprisedtherwise tags within the jsp fragments though - I think I got lucky that I happen to be working with a wizard when I needed some choices. What about other xml JSP definitions that don't allow choice?

Anyone know if  c:if, c:choose, c:when, cSmiley Surprisedtherwise tags can be used or have I just badly configured my environment?

Rob
Smiley Happy