问题描述:我使用的是DispatchBaseAction,这样就可以在一个页面中使用多个提交了。
但是这样就出现了问题。我把所有页面放入到一个叫pages的文件夹中。这样打开初始的url为
http://localhost:8088/KP/pages/workresult_examination.jsp
点击一个提交页面的url变成
http://localhost:8088/KP/chengguo.do?method=find
可以看到页面的路径变化了。我使用js来实现参数赋值的如下function goto(a,b){
      var frm=document.forms[0];
      var ac = "../chengguo.do?method="+a+"&bh="+b; 
      frm.action=ac;
      frm.submit(); 
       
    }
这就出现问题了,我再在当前页面中点提交按钮的时候路径就变成了
http://localhost:8088/chengguo.do?method=find结果自然就找不到了。有什么办法解决,比如用绝对路径一类的
大家帮帮忙。。 郁闷死

解决方案 »

  1.   

    用var ac = "<%=request.getContextPath()%>/chengguo.do?method="+a+"&bh="+b;
      

  2.   

    String contextPath = request.getContextPath();
    先获取一下绝对路径。
    这一句 var ac = "../chengguo.do?method="+a+"&bh="+b; 
    改成下面的试试
     var ac = "<%= contextPath %>/chengguo.do?method="+a+"&bh="+b; 
      

  3.   

    那就是method="+a+"&bh="+b;a的值是find  b没有得到值
      

  4.   

    在你的<html:form action="" 这后面 加个 onclick事件!!>试试看
      

  5.   

    frm.action = "<html:write href = 'xxx.do'>"
    frm.action = "<html:write page = 'xxx.do'>"