Example of tabbedpanel(Ajax) in struts2.2.1
Posted on: January 19, 2011 at 12:00 AM
In this section, we will introduce you to about the tabbedpanel tag.

Example of tabbedpanel(Ajax) in struts2.2.1

In this section, we will introduce you to about the tabbedpanel tag. It is a Ajax tag, each tab is either a local content or a remote content. It refreshed  page each time when user selects that tab. 

 1- index.jsp

<html>ADS_TO_REPLACE_1

<head><title>Ajax_TabbedPannel_Tag_Example</title></head>

<body>

<h1>Ajax_TabbedPannel_Tag_Example</h1><hr>ADS_TO_REPLACE_2

<a href="remoteContentAction.action">--Remote contant Tabbed Pannel--</a><br>

<a href="localContentAction.action">--Local contant Tabbed Pannel--</a><br>

</body>ADS_TO_REPLACE_3

</html>

2_ LocalContenttabbedPannel.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>

<%@taglib uri="/struts-dojo-tags" prefix="sx" %>

<html>ADS_TO_REPLACE_4

<head><title>Ajax_TabbedPannel_Tag_Example</title>

<style type="text/css">

.d{width: 350; height: 50}</style> <sx:head />ADS_TO_REPLACE_5

</head>

<body><h1>Ajax_TabbedPannel_Tag_Example</h1><hr>

<b>Local Content Example</b><br><br>ADS_TO_REPLACE_6

<sx:tabbedpanel id="test" cssClass="d">

<sx:div id="one" label="Name of Days" labelposition="top" >

1-Sunday<br> 2-Monday<br> 3-Tuesday<br> 4-Wednesday<br>ADS_TO_REPLACE_7

5-Thursday<br> 6-Friday<br> 7-Saturday

</sx:div>

<sx:div id="two" label="Name of Month" >ADS_TO_REPLACE_8

1-January<br> 2-February<br> 3-March<br> 4-April<br> 5-May<br> 

6-June<br> 7-July<br> 8-August<br> 10-September<br>12-December<br>

</sx:div>ADS_TO_REPLACE_9

<sx:div id="three" label="Name of city" >

1-Lucknow<br> 2-Delhi<br> 3-Noida<br> 4-Bareilly </sx:div>

</sx:tabbedpanel>ADS_TO_REPLACE_10

</body>

</html>

3_ RemoteContentTabbedPannel.jsp

<%@ taglib uri="/struts-tags" prefix="s"%>

<%@taglib uri="/struts-dojo-tags" prefix="sx" %>ADS_TO_REPLACE_11

<html>

<head><title>Ajax_TabbedPannel_Tag_Example</title><sx:head/>

<style type="text/css">ADS_TO_REPLACE_12

.d{width: 350; height: 50}</style>

</head>

<body><h1>Ajax_TabbedPannel_Tag_Example</h1><hr>ADS_TO_REPLACE_13

<b>Remote Content Example</b><br><br>

<s:url id="days" action="daysName.action"></s:url>

<sx:tabbedpanel id="text" cssClass="d">ADS_TO_REPLACE_14

<sx:div id="month" label="Name Of Month" 

href="PagesJSP/monthName.jsp" cssClass="d"></sx:div>

<sx:div id="days" label="Name Of days" href="%{days}" ></sx:div>ADS_TO_REPLACE_15

</sx:tabbedpanel>

</body>

</html>

4_ TabbedPannelAction.java

package roseindia.action;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;

public class TabbedPannelAction extends ActionSupport{

public String execute() throws Exception {
return SUCCESS;
}

public String display()
{
return SUCCESS;
}
}

5_ struts.xml

<struts>ADS_TO_REPLACE_16

<constant name="struts.devMode" value="false" />

<package name="roseindia" extends="struts-default">

<action name="localContentAction" >ADS_TO_REPLACE_17

<result >PagesJSP/LocalContenttabbedPannel.jsp</result>

</action>

<action name="remoteContentAction" class="roseindia.action.TabbedPannelAction">ADS_TO_REPLACE_18

<result name="success">PagesJSP/RemoteContentTabbedPannel.jsp</result>

</action>

<action name="daysName" class="roseindia.action.TabbedPannelAction" ADS_TO_REPLACE_19

method="display">

<result name="success">PagesJSP/daysName.jsp</result>

</action>ADS_TO_REPLACE_20

</package>

</struts>

6_ daysName.jsp

<html>

<head><title>Insert title here</title></head>ADS_TO_REPLACE_21

<body>

1-Sunday<br> 2-Monday<br> 3-Tuesday<br> 4-Wednesday<br>

5-Thursday<br> 6-Friday<br> 7-SaturdayADS_TO_REPLACE_22

</body>

</html>

 

6_ monthName.jsp

<html>ADS_TO_REPLACE_23

<head><title>Insert title here</title></head>

<body>

1-January<br> 2-February<br> 3-March<br> ADS_TO_REPLACE_24

4-April<br> 5-May<br> 6-June<br> 7-July<br> 

8-August<br> 10-September<br>12-December<br>

</body>ADS_TO_REPLACE_25

</html>

Output

ADS_TO_REPLACE_26

ADS_TO_REPLACE_27

Download Source Code


Related Tags for Example of tabbedpanel(Ajax) in struts2.2.1:

Advertisements

Ads

 
Advertisement null

Ads