struts2 iterator 标签问题,如何用struts2 的标签实现以下功能?急!!!!!!!!!!!!
这是我的代码...
<body>
<s:iterator value="forums" status="st" id="forum">
<s:property value="#st.count" />
<s:text name="." />
<s:property value="forumTitle"/> <br>
</s:iterator>
我的Action里有getForums,上面这段能正常显示.
然后我想在每个forumTitle加一个连接,每当点击这个连接时提交表单!!
是这么做的:
<body>
<s:iterator value="forums" status="st" id="forum">
<s:form action="lookForum" name="lookForum">
<a href="javascript:lookForum.submit();">
<s:property value="#st.count" />
<s:text name="." />
<s:property value="forumTitle"/> <br>
</a>
</s:form>
</s:iterator>
</body>
我不知道这么做得对不对,但是能出来,我说每个连接都能出来就是能跳转到下一个网页。。。。
但是我想我想到下一个网页的同时,每一个连接能提交不同的forumId,我用了很多方法,都不行,比如:用hidden
<s:iterator value="forums" status="st" id="forum">
<s:form action="lookForum" name="lookForum">
<a href="javascript:lookForum.submit();">
<s:property value="#st.count" />
<s:text name="." />
<s:property value="forumTitle"/><br>
</a>
<input type="hidden" name="forumId" value="<s:property value="forumId"/>">
</s:form>
</s:iterator>
这样做不可能到下以个页面,,
页面自动生成的源代码:
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form id="lookForum" name="lookForum" onsubmit="return true;" action="/gd/lookForum.action" method="post"><table class="wwFormTable">
<a href="javascript:lookForum.submit();">
1
.
第一次<br>
</a>
<input type="hidden" name="forumId" value="1">
</table></form>
<form id="lookForum" name="lookForum" onsubmit="return true;" action="/gd/lookForum.action" method="post"><table class="wwFormTable">
<a href="javascript:lookForum.submit();">
2
.
第二次<br>
</a>
<input type="hidden" name="forumId" value="2">
</table></form>
<form id="lookForum" name="lookForum" onsubmit="return true;" action="/gd/lookForum.action" method="post"><table class="wwFormTable">
<a href="javascript:lookForum.submit();">
3
.
第三次<br>
</a>
<input type="hidden" name="forumId" value="3">
</table></form>
<form id="lookForum" name="lookForum" onsubmit="return true;" action="/gd/lookForum.action" method="post"><table class="wwFormTable">
<a href="javascript:lookForum.submit();">
4
.
第四次<br>
</a>
<input type="hidden" name="forumId" value="4">
</table></form>
</body>
</html>
每个hidden的值都不一样,可是在Action里提取hidden的值却都一样,不知道怎么回事,
我没什么开发经验,不知道这样做行不行,希望大家帮我看看是哪里错了,或者还有什么别得方法实现同样的
功能,如果说不清楚的话,可以加我的QQ:57321772,谢谢大家了。。。