struts 路径

<!-- ========== Action Definitions ============================== -->

<action path="/orderBill" scope="request"
   type="com.sinosoft.chint.purchase.action.OrderBillAction">
   <forward name="save" path="/jsp/purchase/orderbillsavenew.jsp" />
   <forward name="confirm" path="/jsp/purchase/orderBillSaveConfirm.jsp" />
  </action>

《!--========== js ======================  -->

//提交单据
function billsubmit(){
  form1.action = "/orderBill.do?op=submit";
  checkprod();
}

 

 

出现错误 (/orderBill.do)  is  not available

原因为 在action中“path="/orderBill"”  这个路径直指根路径,如“eg/pr/orderBill” 

       而js中 "/orderBill.do?op=submit" 所用路径为"/orderBill"

其中  eg为项目名  pr为包名

而若设为 form1.action = "orderBill.do?op=submit",则路径为"pr/orderBill

所以修改有两种方式

1、js中添加request.getContextPath()+ "/orderBill.do?op=submit"; 这样为根路径,

2、在action中改为path="/pr/orderBill"   而js中改为form1.action = "orderBill.do?op=submit"; (去掉斜杠)

 

 

 

 

 

posted @ 2010-01-07 13:47  Ivan-zheng  阅读(204)  评论(0编辑  收藏  举报