请教一个关于struts参数传递的问题,非常感谢,有重谢

jancky2001 2012-02-21 02:24:30
有一个页面如下:

<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-menu.tld" prefix="menu" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/app.tld" prefix="app" %><head>
<title><bean:message key="exam.title"/></title>
<link href="../css/main.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" type="text/css" media="screen" href="../css/global.css" />
<br><br>
<%@ include file="menu.jsp"%>


<html:html>
<html:base/>
<link rel="stylesheet" type="text/css" media="screen" href="../css/tabs.css" />
<script type="text/javascript" src="../js/tabs.js"></script>

<Script LANGUAGE="JavaScript">
if(self!=top){top.location=self.location;}
</script>
</head>
<body bgcolor="#ffffff">
<br />
<br />
<br />
<br />
<h1>
<table width="491" height="302" border="1" align="center" bordercolor="#FF6600">
<logic:iterate id="TrainContentActionForm" name="TrainContentActionForm" indexId="index">
<tr>
<td colspan="2"><div align="center" class="STYLE1">学习题目</div> <div align="center" class="STYLE1"></div></td>
</tr>
<tr>
<td colspan="2">
题目类型:
<html:select styleClass="input" name="TrainContentActionForm" property="q_class" style="width=110">
<html:optionsCollection name="q_classOpts"/>
</html:select></td>
</tr>

<tr>
<td width="64" height="182"><div align="center"><bean:message key="TrainContentActionForm.content"/></div></td>
<td width="344" height="182"> <div align="left">
<bean:write name="TrainContentActionForm" property="content"/>
</div></td>
</tr>

<tr>
<td height="27"><div align="left"><bean:message key="TrainContentActionForm.answer"/></div></td>
<td height="27"><div align="left"><bean:write name="TrainContentActionForm" property="answer"/></div></td>
</tr>
<tr>
<td height="27" colspan="2">
<div align="center">
<html:link action="/exam/startLearnAction.do?type=last" paramId="id" paramName="TrainContentActionForm" paramProperty="id" paramId="q_class" paramName="TrainContentActionForm" paramProperty="q_class.value">
上一题 </html:link>

<html:link action="/exam/startLearnAction.do?type=next" paramId="id" paramName="TrainContentActionForm" paramProperty="id" paramId="q_class" paramName="TrainContentActionForm" paramProperty="q_class">
下一题 </html:link> </div> </td>
</tr>
</logic:iterate>
</table>
</h1>
</body>
</html:html>


请教大家一个问题,我在上一题和下一题的链接中,怎么将

题目类型:
<html:select styleClass="input" name="TrainContentActionForm" property="q_class" style="width=110">
<html:optionsCollection name="q_classOpts"/>
</html:select></td>

这个地方下拉框选中的值传过去。

目前这种方式得到的q_class,不会因为我下拉列表的选项改变而改变。


怎么将下拉列表选中的值,作为参数,通过后面的链接传递过去?有高手知道怎么传的,麻烦回复下,非常感谢。
...全文
116 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
xyz_obj 2012-02-21
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 jancky2001 的回复:]
我就是想知道,通过url的方式,怎么知道页面下拉选中的对应的值
[/Quote]
用struts2 request.get...("TrainContentActionForm");
sd722522 2012-02-21
  • 打赏
  • 举报
回复
<html:select id = xxx>
上一页传值用?Svalue=<%xxx.value%>
试试
Acesidonu 2012-02-21
  • 打赏
  • 举报
回复
click时js获得值再拼接到url上
jancky2001 2012-02-21
  • 打赏
  • 举报
回复
我就是想知道,通过url的方式,怎么知道页面下拉选中的对应的值
安特矮油 2012-02-21
  • 打赏
  • 举报
回复
如果是通过url传递,那么直接在url后面拼上值就可以了
安特矮油 2012-02-21
  • 打赏
  • 举报
回复
页面给个隐藏的组件
<input type="hidden" name="xxx" id="xxx">

给select一个onchange事件,方法为doChange(this);

写一段js代码:
function doChange(obj){
document.getElementById("xxx").value = obj.value;
}

这样在后台可以得到xxx的值

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧