我的要求是使用struts 2在jsp页面中制作两个选项卡,这样当我从tab1调用该操作时,选项卡1将加载,当我从tab2调用该操作时,tab2将加载并显示更新的数据。我怎么能这样做呢?每当我从tab2调用一个动作,然后tab2将如何自动加载。?
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<s:head theme="ajax" debug="true"/>
</head>
<body>
<s:tabbedPanel id="test" >
<s:div id="one" label="Tab 1" theme="ajax">
<form action="tab1action">
</form>
</s:div>
<s:div id="two" label="Tab 2" theme="ajax" >
<s:form href="tab2action">
second Tab
</s:form>
</s:div>
</s:tabbedPanel>
</body>
</html>
答案 0 :(得分:0)
只需在tabbedpanel标记
中使用useSelectedTabCookie="true"
即可
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sd" uri="/struts-dojo-tags"%>
<html>
<head>
<sd:head/>
</head>
<body>
<sd:tabbedpanel id="test" useSelectedTabCookie="true">
<sd:div id="one" label="Tab 1" theme="ajax" >
<s:form action="tab1action">
<s:submit />
</form>
</sd:div>
<sd:div id="two" label="Tab 2" theme="ajax" >
<s:form action="tab2action">
<s:submit />
</s:form>
</sd:div>
</sd:tabbedpanel>
</body>
</html>