<form method="post" action="2.jsp">
<table width="738" height="40" border="0" align="center" cellpadding="0" cellspacing="0" >
<tr>
<td width="340" height="40" align="left">Book Critique</td>
<td width="235" align="left">up to  100,000  words</td>
<td width="157" align="left">Within 2 weeks
<input type="radio" name="type" value="3" />
</td>
</tr>
<tr>
<td height="40" align="left">Book Critique</td>
<td align="left">from 100,000 up to 250,000 words </td>
<td align="left">Within 3 weeks
<input type="radio" name="type" value="2" />
</td>
</tr>
<tr>
<td height="40" align="left">Book Critique</td>
<td align="left">from 250,000 words </td>
<td align="left">Within 4 weeks
<input type="radio" name="type" value="1" />
</td>
</tr>
</table>
<input type="submit" name="Submit" value="提交" />
</form>
这里有一段选择类型的代码,我想比如我选择的是type.value="1"的选项,之后把值传到2.jsp,在2.jsp页面上既拿到value的值,也拿到Book Critique 和 from 250,000 words   within 4 week这几个值
应该怎样呢,我是新手,请详细给我说说,谢谢。

解决方案 »

  1.   

    觉得你需要一个js二维数组,用来存放  <td width="340" height="40" align="left">Book Critique</td>
    <td width="235" align="left">up to  100,000  words</td>
    <td width="157" align="left">Within 2 weeks
    <input type="radio" name="type" value="3" />
    的值,然后通过js把这些值连接在一起传到下个页面
      

  2.   

    <td align="left">Within 4 weeks
    |
    <td align="left" name="a">Within 4 weeksvar aa=document.getElementbyName("a");
    request.setParameter(aa);
    我不负责任的 
      

  3.   

    可以把这几个值做成一个string,之间用个特殊符号分割,然后到2.jsp拿到这个值后在分割开split分割开!最简单的方法了!
      

  4.   

    你的想法本身是错误的,Book Critique 和 from 250,000 words  within 4 week这几个值是画面上显示的,如果下一画面也要用到则不应该直接写死在画面上,应该定义一个Constant.java的文件将其保存在里面如:
    public static final String RADIO_VALUE_1 = "up to  100,000  words Within 2 weeks";
    (或保存到properties文件中)然后当选1的时候,第二个画面进行判断,取得Constant.RADIO_VALUE_1。
      

  5.   

    关键是不知道那些值是不是固定的,如果固定的话就应该写在常量里.如果非要这么做也不是不可以,那些固定的值用<input type="hidden">来标记.另外我没明白你的意思,选中不同的radio只要传上不同的值就行还是要传到不同的页面呢?
      

  6.   

    你这个public static final String RADIO_VALUE_1 = "up to  100,000  words Within 2 weeks"; 
    是写在页面上的吗?
      

  7.   


    <tr>
    <td height="40" align="left"><span id="name3"> Book Critique</span></td>
    <td align="left" id="from3">from 250,000 words </td>
    <td align="left" id="time1">Within 4 weeks
    <input type="radio" name="type" value="3" onclick="getValues(this);"/>
    </td>
    </tr><tr>
    <td height="40" align="left"><span id="name2"> Book Critique</span></td>
    <td align="left" id="from2">from 250,000 words </td>
    <td align="left" id="time2">Within 4 weeks
    <input type="radio" name="type" value="2" onclick="getValues(this);"/>
    </td>
    </tr><tr>
    <td height="40" align="left"><span id="name1"> Book Critique</span></td>
    <td align="left" id="from1">from 250,000 words </td>
    <td align="left" id="time1">Within 4 weeks
    <input type="radio" name="type" value="1" onclick="getValues(this);"/>
    </td>
    </tr>
    -----------------------------------------
    function getValues(rad){
       var selectedIndex = rad.value;
       var name = document.getElementById("name"+selectedIndex).innerHTML;
       var from = document.getElementById("from"+selectedIndex).innerHTML;
       var time = document.getElementById("time"+selectedIndex).innerHTML;
       location.href("2.jsp?name="+name+"&from="+from+"&time="+time);
    }
      

  8.   

    纠正一下上面,有的没加<span>
      

  9.   

    <form method="post" action="2.jsp">
    <table width="738" height="40" border="0" align="center" cellpadding="0" cellspacing="0" >
    <tr>
    <td width="340" height="40" align="left">Book Critique</td>
    <td width="235" align="left">up to  100,000  words</td>
    <td width="157" align="left">Within 2 weeks
    <input type="radio" name="type" value="3" />
    </td>
    </tr>
    <tr>
    <td height="40" align="left">Book Critique</td>
    <td align="left">from 100,000 up to 250,000 words </td>
    <td align="left">Within 3 weeks
    <input type="radio" name="type" value="2" />
    </td>
    </tr>
    <tr>
    <td height="40" align="left">Book Critique</td>
    <td align="left">from 250,000 words </td>
    <td align="left">Within 4 weeks
    <input type="radio" name="type" value="1" />
    </td>
    </tr>
    </table>
    <!--以下是我删除的代码-->
    <input type="submit" name="Submit" value="提交" />
    <!--以上是我删除的代码-->
    <!--以下是我加的代码-->
    <anchor>
    <go href="2.jsp" accept-charset="GB2312" 
    method="post"><postfield name="One" value$(type:e)"/>
    <postfield name="Two" value="Book Critique"/>
    <postfield name="Three" value="from 250,000 words  within 4 week"/>
    </go>
    </anchor>
    <!--以上是我加的代码--></form>
      

  10.   


    写在Constant.java里,然后在页面有<%=  %>使用。正规的软件开发一般都是类似的。