你可以都提交到一个ACTION里在ACTION里分
public ActionForward execute(ActionMapping mapping,ActionForm form,
 HttpServletRequest request,HttpServletResponse response){
String operType=request.getParameter("operType");
if(operType.equals("buyRegist")){
return BuyRegist(mapping,form,request,response);
}else if(operType.equals("update")){
return Search(mapping,form,request,response);
}else if(operType.equals("search")){
return Search(mapping,form,request,response);
}else{
return null;
}
}

public ActionForward BuyRegist(ActionMapping mapping,
ActionForm form,HttpServletRequest request,HttpServletResponse response) {
}

public ActionForward Search(ActionMapping mapping,
ActionForm form,HttpServletRequest request,HttpServletResponse response) {
}

解决方案 »

  1.   

    楼上写的是struts里的写法,如果你用别的也差不多,只要从request里取得flag做个判断就行了.
      

  2.   

    楼上写的是struts里的写法,如果你用别的也差不多,只要从request里取得flag做个判断就行了.
      

  3.   

    谢谢赐教。我写了一个jsp,但有问题,还是判断不出来。请帮我看看错在那里,我写了其中的两个功能,查询和新增。代码如下:
    <%@ page language="java" contentType="text/html; charset=gb2312"%>
    <jsp:useBean id="re" scope="page" class="bank.registManagebean"/>
    <jsp:setProperty name="re" property="txtname" param="txtname"/>
    <jsp:setProperty name="re" property="txtpass" param="txtpass"/>
    <jsp:setProperty name="re" property="txtrepass" param="txtrepass"/>
    <jsp:setProperty name="re" property="txtadress" param="txtadress"/>
    <jsp:setProperty name="re" property="txtphone" param="txtphone"/>
    <jsp:setProperty name="re" property="txtemail" param="txtemail"/>
    <html>
    <head>
    <title>注册信息管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
      <%
    String judge=request.getParameter("flag");
    if (judge=="query")
    {
    out.println(judge);
    }

    if(judge=="insert")
    {
       //新增
       boolean validate=re.loadValidate();
       if(validate==true)
       {
         String str1=new String("");
            str1=request.getParameter("txtname");   
            int i=re.insertregist();
    //int userid=re.insertregist();

    if(i!=0)
    {
         //HttpSession ses=request.getSession(true);
             session.setAttribute("b1",str1);
         out.println(session.getAttribute("b1"));
         //out.println(txtname+",");  

    %>
                 <p><font color="#FF0000" face="黑体">恭喜!您已经添加成功,</font></p><br>
                
                 <a href=""></a>              
                <%
                }
                else
                {
                 out.println(str1+",");
                %>
                <p><font color="#FF0000" face="黑体">您在添加记录时发生错误</font></p>
                <%
                }    
       }
       else 
       {
        out.println("已有此用户名,请另起用户名!");
       %>
        <a href=""></a> 
       <%
       }
       }
     %>
      

  4.   

    可以用LookupDispathchAction来解决