你可以这样写
String str="";然后根据需要写出你要跳转的页面到str中
action="<%=str%>"

解决方案 »

  1.   

    不再form里面写,使用javascript手工提交。
    <HTML>
    <HEAD></HEAD>
    <script language="javascript">
    function action1
    {
       document.form1.action="aaa.jsp";
       document.form1.submit();
    }
    function action2
    {
       document.form1.action="bbb.jsp";
       document.form1.submit();
    }
    </script><BODY>
    <FORM name=form1>
    ......
    <INPUT TYPE="BUTTON" ONCLICK="action1" NAME="提交1">
    <INPUT TYPE="BUTTON" ONCLICK="action2" NAME="提交2">
    </FORM>
    </BODY>
    </HTML>
      

  2.   

    用javascript可以实现的。action可以定义你提交的页面。不过注意按钮要定义为none<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <script language="JavaScript">
    function act1()
    {
    document.testForm.action="a.jsp";
    document.testForm.submit();

    }
    function act2()
    {
    document.testForm.action="b.jsp";
    document.testForm.submit();

    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><body>
    <form name="testForm" method="post" action="">
      <input name="Name" type="text" id="Name">
      <input type="button" name="Button" value="Act1" onClick="act1();">
      <input type="button" name="Submit2" value="Act2" onClick="act2();">
    </form>
    </body>
    </html>
      

  3.   

    最普通的方法就是使用JS来给ACTION赋值。
    当然也可以在一个ACTION里面处理不同的名字的SUBMIT的过程(就是写多个过程或函数)
      

  4.   

    我照做了,执行时显示“ACTION1未定义”,怎么解决呢???
    谢谢!!!!!
      

  5.   

    TO: liangyuhan318(鱼鱼)
    你可以这样写
    String str="";然后根据需要写出你要跳转的页面到str中
    action="<%=str%>"
    =======================
    你这么写不行的,,在你请求到这个页面的时候,,action的目标已经确定了,就不能根据情况来发送到不同的action了,,使用javascript来写就可以了,,上面各位已经提供了具体方法,我就不多说了。
      

  6.   

    上面说的都很好,我综合了一下,有两种方法:
     1)用onclick,在javascript里写, 2)直接在onclick后面链接,并加上?dd=<%=rs("dd")%>传值,我试过多次, 屡试不爽!
      

  7.   

    <form name="frm1" action="javascript:void(0)" method="post">
    a.jsp <input type="radio" name="rad" checked><br>
    b.jsp <input type="radio" name="rad"><br>
    <input type="button" name="btn" value="Submit" onClick="sub(frm1,'_self')">
    </form><script language=javascript>
    function sub(form, target)
    {
    if (form.rad[0].checked) {
    url = "/a.jsp";
    form.action = url;
    form.target = target;
    form.submit();
    } else if (form.rad[1].checked) {
    url = "/b.jsp";
    form.action = url;
    form.target = target;
    form.submit();
    }
    }
    </script>
      

  8.   


    <form method="post" name="form1" action="">