同一个form中的数据我想提交到不同的action中去,怎么做?
我这样写“发送”按钮可以实现功能!“发送全部”按钮点击后可以找到相应的action中的方法,但是在那边显示接到的值是null!<form name="form" action="/manage/message.do?method=send_message"  method="post">
    <table width="80%" border="0" align="center" class="td">
      <tr>
        <td width="11%" align="right" class="td">收信人名称:</td>
        <td width="41%" class="td"><input name="addresseeName" type="text" value="" size="20"/>  
        注意:必须填写用户的真实用户名        </td>
      </tr>
      <tr>
        <td align="right" class="td">发布主题:</td>
        <td class="td"><input name="title" type="text" value="" size="20"/></td>
        
      </tr>
      <tr>
        <td align="right" class="td">发布内容:</td>
        <td class="td"><textarea name="content" cols="40" rows="5" class="buttonmain"></textarea></td>
      </tr>
      <tr>
        <td align="right" class="td">发布人:</td>
        <td class="td"><input name="senderName" type="text"  value="<%=username%>" size="20" /></td>
      </tr>
      <tr>
        <td align="right" class="td"><input type="submit" name="submit1" value="发送"  /></td>
        <td class="td"><input type="reset" name="reset" value="重置" />
        <input type="button" onclick="window.location.href='/manage/message.do?method=send_all'" value="发送全部"></td>
      </tr>
    </table>
</form>

解决方案 »

  1.   

    你发送的按钮的属性是submit 全部发送 是button 在全部发送中要首先修改form的action属性 然后将form提交
      

  2.   

    你的按钮不应该是submit类型的,而应该是普通的button类型,在你的button的onclick事件中动态的为表单赋以action,form.action=..,然后再作form.submit()..这样可以满足你的需求了。
      

  3.   

    window.location.href='/manage/message.do?method=send_all'默认GET方式,传递的只有method=send_all,其它的值当然传不过去啊.
      

  4.   

    <input type="button" onclick="sendall()" value="发送全部"><script>
    function sendall(){
    document.forms[0].action="<%=request.getContextPath()%>/manage/message.do?method=send_all";
    document.forms[0].submit();}
    </script>
      

  5.   

    你那个forms[0]是什么意思?
    <%=request.getContextPath()%>这又是什么?获取内容地址吗?
      

  6.   

    用javascript提交也是一样的,重新指定form的Action,然后提交submit,
    docment.forms[0].action = "你的action";
    docment.forms[0].submit();
    就这样就好了,不要贴代码,里面有全角字符;
      

  7.   

    to answer512() 
    forms[0]表示你的html页面上按顺序定义的所有的表单的第一个。
    有可能html页面仅有一个表单对象。
      

  8.   

    提示:网页上有错误!!!
    <script language="JavaScript" type="text/JavaScript">
    function sendall(){
    document.forms[0].action="<%=request.getContextPath()%>/manage/message.do?method=send_all";
    document.forms[0].submit();}
    </script>


    <form name="form1" action="/manage/message.do?method=send_message" method="post">收信人名称:<input name="addresseeName" type="text" value="" size="20"/>  发布主题:<input name="title" type="text" value="" size="20"/>发布内容:<textarea name="content" cols="40" rows="5" class="buttonmain"></textarea>发布人:<input name="senderName" type="text" value="" size="20" />
    <input type="submit" name="submit1" value="发送" /></td>
    <input type="reset" name="reset" value="重置" />
    <input type="button" onclick="sendall()" value="发送全部" />
    </form>
      

  9.   

    老弟,你怎么又是get,又是post,我都被你搞沪读了
      

  10.   

    我用lookupdispatchaction解决问题了!!!