<table>
<tr>
<td>
名字
</td>
<td>
<input type="text" name="name">
</td> <td>
地址
</td>
<td>http://
<input type="text" name="href">
</td>
<td>
<a href="/toba/static/manageAdministration?name=**&href=**" target="show2">
</td>
</tr>
</table>我想把name和href的值传过去,不用form表单的方法。。谢谢

解决方案 »

  1.   

    一.通过Form表单提交传值客户端通过Form表单提交到服务器端,服务器端通过request.getParameter(String xx);来取得参数(xx)为参数名称。二.通过隐藏域传值通过在表单中加入一个隐藏域来提交到服务器端,这种方式的好处是可以在客户端加入一些自己想要加入的参数,以便到得相应的值。客户端代码: 
    <input type="hidden" name="id" value="<%=request.getAttribute("id") %>"/> 服务器端取值: St ... 
    在name和href那两个文本框前面加上隐藏域看怎么样,然后在处理他、页面用request.getParameter(String xx);来获得
      

  2.   

    我要读取的是用户输入的name和href的值,表单没问题,但是我不想用form。
      

  3.   


    function getHref(obj) {
    var _f1 = document.getElementById('f1').value;
    var _f2 = document.getElementById('f2').value;
    var _href = "test.jsp?valF=" + _f1 + "&href=" + _f2;
    //alert(_href);
    obj.href = _href;
    }
    <input type="text" name="valF" id="f1">
    <input type="text" name="href" id="f2">
    <a id="hf" href="" target="ifm" onclick="getHref(this);">test</a>
    <iframe name="ifm"></iframe>
      

  4.   

    同楼主问这个问题,因为比如在首页的时候,比如想在首页直接显示数据库里的数据,但是没有提交的`到现在我也不知道怎么解决,因为一般用request或session来传值,一般都要通过表单,而主页的话``一开始就载入了`是没有提交的按忸而言的。
    我试过在取出数据的时候在这个页面下String s=request.getAttribute("id");
    然后再点超连接的时候request.getAttribute("s");但是我在前个页面下是没有表单来提交,完全依靠一个超连接的`所以不行
    我查了相关资料还有3个方法1就是在首页前先加载一个一闪既过画面,在里面添加表单(显然不好)
    2就是利用JS脚本来传action
    3就是通过上述说的隐藏(现在在实验)
      

  5.   

    function submit(obj) {
           document.forms[0].action="/action.do?NAME="+document.forms[0].name.value+"&&herf="+document.forms[0].herf.value;
           document.forms[0].submit();
        }在对应的action中用:
    request.getParameter("NAME");
    request.getParameter("herf");
    就可以取到了