views:

305

answers:

1

Hi,

I am using struts2.1.6 with DOJO plugin.

I have three tabs shown as TabValue1, TabValue2 and TabValue3. I want to show TabValue2 as the default tab if a certain url is clicked otherwise TabValue1 is the default tab.

Here is the code:

<sx:tabbedpanel cssStyle="width: 630px; height: 600px;" doLayout="true"
       id="tabbedPanel2" selectedTab="TabValue2">
       <s:if test="apptypes.size>0">

        <s:iterator value="apptypes" id="apptype" status="app_stat">
         <img id="indicator" src="/jctaylor/images/loader.gif"
          style="display: none" />

         <sx:div label="%{name}" id="%{name}" indicator="indicator"
          loadingText="Loading..." href="%{showTab}%{typeid}"
          refreshOnShow="true" preload="false" >

         </sx:div>
        </s:iterator>

       </s:if>

      </sx:tabbedpanel>

Its working for the default tab selection which is the first tab. But when I click on the link which is supposed to select the TabValue2 tab its not working. I have created a separate page for it and put the selectedTab="TabValue2" but still its showing the TabValue1 selected.

If you have any suggestion please so let me know.

A: 

I have figured out the solution

The solution is: instead of specifying the value of the tab selectedTab="TabValue2" specify the id of the corresponding tab. As shown:

<sx:tabbedpanel cssStyle="width: 630px; height: 600px;" doLayout="true"
   id="tabbedPanel2" selectedTab="tab2">
   <s:if test="apptypes.size>0">

    <s:iterator value="apptypes" id="apptype" status="app_stat">
     <img id="indicator" src="/images/loader.gif"
      style="display: none" />
     <s:set var="i" name="counter1" value="#app_stat.count"/>
     <sx:div label="%{name}" id="tab%{counter1}" indicator="indicator"
      loadingText="Loading..." href="%{showTab}%{typeid}"
      refreshOnShow="true" preload="false" >

     </sx:div>
    </s:iterator>

   </s:if>

  </sx:tabbedpanel>
Sameer Malhotra