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> <head><title>Ajax_TabbedPannel_Tag_Example</title></head> <body> <h1>Ajax_TabbedPannel_Tag_Example</h1><hr> <a href="remoteContentAction.action">--Remote contant Tabbed Pannel--</a><br> <a href="localContentAction.action">--Local contant Tabbed Pannel--</a><br> </body> </html> |
2_ LocalContenttabbedPannel.jsp
|
<%@ taglib prefix="s" uri="/struts-tags" %> <%@taglib uri="/struts-dojo-tags" prefix="sx" %> <html> <head><title>Ajax_TabbedPannel_Tag_Example</title> <style type="text/css"> .d{width: 350; height: 50}</style> <sx:head /> </head> <body><h1>Ajax_TabbedPannel_Tag_Example</h1><hr> <b>Local Content Example</b><br><br> <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> 5-Thursday<br> 6-Friday<br> 7-Saturday </sx:div> <sx:div id="two" label="Name of Month" >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> <sx:div id="three" label="Name of city" >1-Lucknow<br> 2-Delhi<br> 3-Noida<br> 4-Bareilly </sx:div> </sx:tabbedpanel> </body></html> |
3_ RemoteContentTabbedPannel.jsp
|
<%@ taglib uri="/struts-tags" prefix="s"%> <%@taglib uri="/struts-dojo-tags" prefix="sx" %> <html> <head><title>Ajax_TabbedPannel_Tag_Example</title><sx:head/> <style type="text/css"> .d{width: 350; height: 50}</style></head> <body><h1>Ajax_TabbedPannel_Tag_Example</h1><hr> <b>Remote Content Example</b><br><br><s:url id="days" action="daysName.action"></s:url> <sx:tabbedpanel id="text" cssClass="d"> <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> </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> <constant name="struts.devMode" value="false" /> <package name="roseindia" extends="struts-default"> <action name="localContentAction" > <result >PagesJSP/LocalContenttabbedPannel.jsp</result> </action> <action name="remoteContentAction" class="roseindia.action.TabbedPannelAction"> <result name="success">PagesJSP/RemoteContentTabbedPannel.jsp</result> </action><action name="daysName" class="roseindia.action.TabbedPannelAction" method="display"> <result name="success">PagesJSP/daysName.jsp</result> </action> </package> </struts> |
6_ daysName.jsp
|
<html> <head><title>Insert title here</title></head> <body> 1-Sunday<br> 2-Monday<br> 3-Tuesday<br> 4-Wednesday<br> 5-Thursday<br> 6-Friday<br> 7-Saturday </body> </html>
|
6_ monthName.jsp
|
<html> <head><title>Insert title here</title></head> <body> 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> </body> </html> |
Output




