不页面跳转是不行的.
大不了跳向本页面.
不要用两个submit.
这样用的话要用两个body.
用button来出发javascript事件.
<input type="button" name="new" value="新增" onclick="javascript:add()">
<input type="button" name="edit" value="新增" onclick="javascript:modify()">

解决方案 »

  1.   

    上面说地对
    Http是无状态的,在客户端如果你不提交是不可能调用服务器 端的javabean的
    你这个就提交到本页面处理啦
      

  2.   

    楼上2位
    onclick="javascript:add()">  //不懂哦。
    请问,如何在avascript里调用javabean,请把代码写上,谢谢!!
      

  3.   



    <script language="javascript">
      function check()
      {
        ...
      }
    </script>

    <input type="button" name="new" value="新增" onclick="check()">请问能在javascript里调用javabean吗?
      

  4.   

    在jsp页面加个隐藏域 通过javascript给隐藏域付值 然后根据隐藏域的值 执行相应的函数
    如:
    <%@ page contentType="text/html; charset=GBK" language="java"%>
    <html>
    <head>
    <title>jisuan</title>
    </head>
    <jsp:useBean id="user" scope="page" class="test2.JisuanBean" />
    <jsp:setProperty name="user" property="*" />
    <%
    String act = request.getParament("act");
    if(act.equals("add")) {
      user.A();
    }else if(act.equals("modify")) {
      user.B();
    }
    %>
    <script language="javascript">
     function add(){
    with(form){
    form.act.value="add";
    form.action="jsp1.jsp";
    form.submit();
    }
    function modify(){
    with(form){
    form.act.value="modify";
    form.action="jsp1.jsp";
    form.submit();
    }
     }
    </script>
    <form  method="post" name="form">
       编号<input type="text" name="x">
       <input type="button" name="new" value="新增" onclick="javascript:add()">    
    <input type="button" name="edit" value="新增" onclick="javascript:modify()">  
     <input type="hidden" name="act" value="1">
    </form>
    </body>
    </html>
      

  5.   

    在javascript里 是不能调用javabean的
      

  6.   

    楼上的不用那么肯定,或许以下的函数能给你一些帮助:
    function sendRequestPost(url, data){
        var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");    var method = "POST";
        xmlhttp.open(method, url, false);
    xmlhttp.setrequestheader("content-type","application/x-www-form-urlencoded"); 
        xmlhttp.send(data);
        result = xmlhttp.responseText;
        return result;
    }
    其它的代码我就不想写出来了...这种方法的限制就是ie5.0加上MSXML2.dll
    一般ie5.5以上都可以很好的使用这个函数...
      

  7.   

    javascript是在客户端执行的  javabean运行在服务器端
    看看这个帖子吧http://search.csdn.net/Expert/topic/1381/1381310.xml?temp=.1570551