我先说说问题吧: 跳转过后,新的页面的action URL 是上一个页面form表单的那个!流程是这样的:            登录后,添加员工基本信息
     <form action="../admin.do?command=add" method="post">
         ……
         ……
     </form>
            当我提交这个表单,会进入Action,完成逻辑后跳转。
            代码我这样写的:  return mapping.findForward("to_add_emp_detail");
            struts-config.xml中的代码:  <forward name="to_add_emp_detail" path="/admin/add_emp_detail.jsp"/>            能够跳转到add_emp_detail.jsp这个页面,于是我开始添加员工的详细信息。
            这里的表单代码如下:
       <form action="../admin.do?command="addDetail" method="post">
         ……
         ……
       </form>            当我一点提交时,就报 HTTP 400 错误!    我右键查看该页面的属性发现URL是上一个表单的URL:
            http://localhost:8080/employee_manager/admin.do?command=add   不知这里是否有问题呢?        如果不是,这个问题要怎么解决呢?

解决方案 »

  1.   

     <form action="../admin.do?command="addDetail" method="post"> 
            …… 
            …… 
          </form> 
      
    addDetail前多一个引号,另外,你把这两个action后的路径写成绝对路径,
      

  2.   

    <form action="../admin.do?command="addDetail" method="post"> 
            …… 
            …… 
          </form> "addDetail"不要引号,action写成绝对路径。
    问题就解决了
      

  3.   

    我补充一下问题!
    你们说得对!
    <form action="../admin.do?command=addDetail" method="post"> 
            …… 
            …… 
          </form> 
    "addDetail"不要引号前是不要引号,是我笔误了!那个绝对路径? 意思是不是让我在ACTION中写成! retrun request.getSession().getServletContext().getRealPath("to_add_emp_detail");
      

  4.   

    <form action="../admin.do?command="addDetail" method="post"> 
    红色部分不用写吧?
      

  5.   

    回复 #4楼:      红色部分要写!  因为这个JSP文件是放在/WebRoot/admin/下的,并不是直接位于/WebRoot/下。
    所以../是为了退到根路径下!
      

  6.   

    在jsp文件中如果定义了根目录也就是basePath<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
    %>
    就直接写action="<%=basePath%>/admin.do?command="addDetail" 就行了
      

  7.   

    的确,不过我用的是 基础JSP,没定义basePath的,所以只能用白痴的../啦哈!^_^请回到楼主的正题!
    其实我的目的就是想模拟一下   添加USER信息时,从“基本信息”----下一步----“详细信息”这样一个流程。