[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: Control Struts2 Tags with Conditional Tags
From:       Lukasz Lenart <lukaszlenart () apache ! org>
Date:       2014-06-12 6:24:42
Message-ID: CAMopvkMrd0mvPTyt-eKY_OnnbNC=XF=7d2X6ncccOXesXjtPcg () mail ! gmail ! com
[Download RAW message or body]

I'm not sure what do you want to achieve .... tags are rendered on
server side and when user will interact with your webpage there will
be just pure Html. You must send user selection back to server to
allow re-render the page based on user choice and then <s:if> tag come
into play.

2014-06-11 12:31 GMT+02:00 NIJO GEORGE <nijomon@gmail.com>:
> <s:select name="totalOptions" id="TotalOptions" headerKey="-1"
> headerValue="Select Number of Options" theme="bootstrap" list="#
> {'2':'2','3':'3','4':'4','5':'5','6':'6','7':'7'}"
> onchange="getTextBoxes(value)"/>
> ----------------------
> <s:radio list="#
> {'0':'SingleChoice','1':'MultipleChoice','2':'Subjective'}" value="0" name="
> answerType" onclick="getChoice(value);" theme="bootstrap"
> id="answertype"></s:radio>
> ----------------------
> <s:if test="answerType==0">
>       <div class="form-group">
>           <label class="col-lg-2 control-label">Correct Answer :</label>
>                <div class="col-lg-10" style="width: 300px">
>                         <s:if test="totalOptions == 2">
>                             <s:select theme="bootstrap"
> name="correctAnswer" list="# {'A':'A','B','B'}"/>
>                         </s:if>
>                         <s:elseif test="totalOptions == 3">
>                             <s:select theme="bootstrap"
> name="correctAnswer" list="# {'A':'A','B','B','C':'C'}"/>
>                         </s:elseif>
>                         <s:elseif test="totalOptions == 4">
>                   <s:select theme="bootstrap" name="correctAnswer" list="#
> {'A':'A','B','B','C':'C','D':'D'}"/>
>                         </s:elseif>
>                         <s:elseif test="totalOptions == 5">
>          <s:select theme="bootstrap" name="correctAnswer" list="#
> {'A':'A','B','B','C':'C','D':'D','E':'E'}"/>
>                         </s:elseif>
>                         <s:elseif test="totalOptions == 6">
>      <s:select theme="bootstrap" name="correctAnswer" list="#
> {'A':'A','B','B','C':'C','D':'D','E':'E','F':'F'}"/>
>                         </s:elseif>
>                         <s:else>
>  <s:select theme="bootstrap" name="correctAnswer" list="#
> {'A':'A','B','B','C':'C','D':'D','E':'E','F':'F','G','G'}"/>
>                         </s:else>
>                     </div>
>                 </div>
>                 <div class="form-group">
>                     <label class="col-lg-2 control-label">Show Options As
> :</label>
>                     <div class="col-lg-10">
>                         <s:radio name="showAsMCQ" list="# {'0':'Radio
> Button','1':'Check Boxes'}"/>
>                     </div></div>
> </s:if>
>
> <s:elseif test="answerType==1">
>                 <div class="form-group">
>                     <label class="col-lg-2 control-label">Correct Answer
> :</label>
>                     <div class="col-lg-10">
>                         <s:if test="totalOptions == 2">
>                             <s:checkboxlist theme="bootstrap"
> name="correctAnswer" list="# {'A':'A','B','B'}"/>
>                         </s:if>
>                         <s:elseif test="totalOptions == 3">
>                             <s:checkboxlist theme="bootstrap"
> name="correctAnswer" list="# {'A':'A','B','B','C':'C'}"/>
>                         </s:elseif>
>                         <s:elseif test="totalOptions == 4">
>           <s:checkboxlist theme="bootstrap" name="correctAnswer" list="#
> {'A':'A','B','B','C':'C','D':'D'}"/>
>                         </s:elseif>
>                         <s:elseif test="totalOptions == 5">
>     <s:checkboxlist theme="bootstrap" name="correctAnswer" list="#
> {'A':'A','B','B','C':'C','D':'D','E':'E'}"/>
>                         </s:elseif>
>                         <s:elseif test="totalOptions == 6">
>   <s:checkboxlist theme="bootstrap" name="correctAnswer" list="#
> {'A':'A','B','B','C':'C','D':'D','E':'E','F':'F'}"/>
>                         </s:elseif>
>                         <s:else>
> <s:checkboxlist theme="bootstrap" name="correctAnswer" list="#
> {'A':'A','B','B','C':'C','D':'D','E':'E','F':'F','G','G'}"/>
>                         </s:else>
>                     </div>
>                 </div>
>                 <div class="form-group">
>                     <label class="col-lg-2 control-label">Show Options As
> :</label>
>                     <div class="col-lg-10">
>            <s:radio name="showAsMCQ" list="# {'0':'Radio Button','1':'Check
> Boxes'}" value="1" disabled="true"/>
>                     </div></div>
>
> </s:elseif>
> <s:else>
>                 <div class="form-group">
>                     <label class="col-lg-2 control-label">Correct Answer
> :</label>
>                     <div class="col-lg-10">
>             <s:textarea name="correctAnswer" cols="80" rows="5"
> theme="bootstrap" id="corrctAnswr"></s:textarea>
>                         </div>
>                     </div>
>                     <div class="form-group">
>                         <label class="col-lg-2 control-label">Show Options
> As :</label>
>                         <div class="col-lg-10">
>   <s:radio name="showAsMCQ" list="# {'0':'Radio Button','1':'Check
> Boxes','2':'Text Area'}" value="2" disabled="true"/>
>                     </div></div>
> </s:else>
>
>
> Is it possible to implement The above Scenario?
>
> How to Access the value of totalOptions and answerType in conditional Tags.
>
> Is OGNL Expressions can me to sort out this ?
>
> --
> NIJO GEORGE

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic