2014-11-30 2 views
0

Struts2 jQuery에서 탭을 사용하고 있습니다. 클릭하면 다음 탭으로 이동할 수있는 첫 번째 탭 끝의 NEXT 버튼이 필요합니다. 그러나이 작업을 수행 할 때 버튼 클릭시 div은 URL에만 표시됩니다. 페이지를 새로 고침 할 때로드됩니다. 코드는 다음과 같습니다.Struts 2에서 다른 탭으로 이동하기위한 단추. jQuery tabbedpanel

<form action="applyhere" method="post" id="companyapply"> 
<sj:tabbedpanel id="localtabs" cssClass="list"> 
    <sj:tab id="tab1" target="tone" label="Personal Information"/> 
    <sj:tab id="tab2" target="ttwo" label="Educational Qualifications"/> 
    <sj:tab id="tab3" target="tthree" label="Local Tab Three"/> 
    <sj:tab id="tab4" target="tfour" label="Local Tab Four"/> 
</sj:tabbedpanel> 

<div id="tone"> 
<table> 
    <p style="font-size: small; color: red; float: right;">*required fields</p>  
    <tr> 
    <td>Enter Firstname: *</td> 
    <td><input type="text" name="firstname" required 
     value=<s:property value="#session.USERNAME"/> /></td> 
     <input type="button" onclick="#ttwo"/><!-- onclick the button should link to the next div having an id TTWO. It shows the URL in the link, but the next tab gets loaded only when the page is refreshed. --> 
    </tr> 
</table>  
</div> 

<div id="ttwo"> 
<table> 
<p style="font-size: small; color: red; float: right;">*required fields</p> 

<tr> 
<td></td> 
</tr> 
</table> 

답변

0

다음 탭으로 이동하려면 항목을 게시해야합니다. 당신이 탐색이 버튼을 배치하면

<sj:a href="#" onClickTopics="nextTopic" button="true">Next</sj:a> 

수신 코드는 그것은 가입 핸들러

$(function(){ 
    $.subscribe('nextTopic', function(event, data) { 
    var size = $("#localtabs").find(">ul >li").size(); 
    var active = $("#localtabs").tabs('option', 'active'); 
    $("#localtabs").tabs('option', 'active', active + 1 >= size ? 0: active + 1); 
    }); 
}); 
해야한다
관련 문제