有一个页面如下:<%@ 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,不会因为我下拉列表的选项改变而改变。
怎么将下拉列表选中的值,作为参数,通过后面的链接传递过去?有高手知道怎么传的,麻烦回复下,非常感谢。

解决方案 »

  1.   

    页面给个隐藏的组件
    <input type="hidden" name="xxx" id="xxx">给select一个onchange事件,方法为doChange(this);写一段js代码:
    function doChange(obj){
        document.getElementById("xxx").value = obj.value;
    }这样在后台可以得到xxx的值
      

  2.   

    如果是通过url传递,那么直接在url后面拼上值就可以了
      

  3.   

    我就是想知道,通过url的方式,怎么知道页面下拉选中的对应的值
      

  4.   

    <html:select id = xxx>
    上一页传值用?Svalue=<%xxx.value%>
    试试
      

  5.   

    用struts2 request.get...("TrainContentActionForm");