path basePath 与 不写的区别:
path 表示项目名称;
basePath 表示: http://localhost:8080/CRM/【请求路径页面】
不写 表示:当前的js 与这个页面在同一级目录下
function page_go()
{
document.forms[0].action="/CRM/html/right.do?method=initSysUser";
document.forms[0].submit();
}
function Seacher()
{
document.forms[0].action="html/right.do?method=SeacherSysUser";
document.forms[0].submit();
}
//这两者相同 http://localhost:8889/CRM/html/index.jsp
是因为在请求的时候是这样的 前缀 http://localhost:8889/CRM/ 会加上 如果写:
function Seacher()
{
document.forms[0].action="/html/right.do?method=SeacherSysUser";
(加了一个斜杠报 400 错误 这时路径为 http://localhost:8889/CRM//html/xx.do?method=方法名)
(如果加了一个斜杠 必须加 全路径 /CRM/html/right.do?method=initSysUser 这样子会覆盖)
document.forms[0].submit();
}
struts 表单的话可以带xx.do 的请求 如果带了的话 struts 就会默认的去写
<html:form action="html/role?method=updateSysRoleById" method="post" οnsubmit="return check()">
<html:form action="/html/~right/rightManage.do?method=editUser" method="post">
这两者都是正确的
但是他们两者的stutsConfig不同:
前者:
<!--用户管理 -->
<action path="html/right"
type="com..crm.right.zl.web.action.SysUserAction"
name="SysUserForm"
scope="request"
parameter="method"
>
<forward name="userList" path="/html/~right/user/list.jsp"></forward>
<forward name="add" path="/html/~right/user/add.jsp"></forward>
<forward name="detail" path="/html/~right/user/detail.jsp"></forward>
<forward name="dispatch" path="/html/~right/user/dispatch.jsp"></forward>
<forward name="edit" path="/html/~right/user/edit.jsp"></forward>
后者:
<!-- 权限管理 -->
<action path="/html/~right/rightManage"
type="com..crm.rightmanage.xmc.web.action.RightManageAction"
name="rightForm"
parameter="method"
scope="request"
>
<forward name="loginfail" path="/login.jsp" redirect="true"></forward>
<forward name="loginsuccess" path="/html/index.jsp" redirect="true"></forward>
<forward name="userList" path="/html/~right/user/list.jsp"></forward>
<forward name="toEditUser" path="/html/~right/user/edit.jsp"></forward>
<forward name="dispacth" path="/html/~right/user/dispatch.jsp"></forward>
<forward name="details" path="/html/~right/user/detail.jsp"></forward>
<forward name="roleList" path="/html/~right/role/list.jsp"></forward>
<forward name="toUpdateRole" path="/html/~right/role/roleAndRights.jsp"></forward>
</action>
注意带.do的表单 必须加上一个/
如: <!-- 权限管理 -->
<action path="/html/~right/rightManage" 这个路径与那个超链接匹配
type="com.crm.rightmanage.xmc.web.action.RightManageAction"
name="rightForm"
parameter="method"
scope="request"
>
http://localhost:8080/CRM/html/~right/rightManage.do?method=selectSalaryStandard
表单提交为:
<html:form action="/html/~right/rightManage.do?method=editUser" method="post">
<html:form action="html/~right/right?method=EditUser" method="post" οnsubmit="return check()">
//HR 路径问题:
超链接:显示: http://localhost:8080/HR/page/salaryCriterion/salaryCriterion.do?method=selectSalaryStandard
那么在struts-config中应该这样配置:
<action path="/page/salaryCriterion/SalaryCriterion"
name="salaryCriterionForm"
type="org.springframework.web.struts.DelegatingActionProxy"
parameter="method"
scope="request"
>
<forward name="salarystandard_query_list"path="/page/salaryCriterion/salarystandard_query_list.jsp"></forward>
</action>
因为:它提交是截取: http://localhost:8080/HR
另外有一个在webRoot的下有一个文件夹: page page下有一个文件夹 salaryCriteria 有 jsp 页面 当我请求
当我 点击jsp 页面的时候,,又要在jsp 连接到 文件夹 salaryCriteria 的 jsp 页面中,,那么page不需要带了
因为在先前请求jsp页面 已经带了
<a href="salaryCriterion/SalaryCriterion.do?method=selectSalaryStandard" target="mainFrame">薪酬标准登记复核</a>
salaryCriterion/salarystandard_change_locate.jsp
http://www.myexception.cn/java%20exception/120.html
path 表示项目名称;
basePath 表示: http://localhost:8080/CRM/【请求路径页面】
不写 表示:当前的js 与这个页面在同一级目录下
function page_go()
{
document.forms[0].action="/CRM/html/right.do?method=initSysUser";
document.forms[0].submit();
}
function Seacher()
{
document.forms[0].action="html/right.do?method=SeacherSysUser";
document.forms[0].submit();
}
//这两者相同 http://localhost:8889/CRM/html/index.jsp
是因为在请求的时候是这样的 前缀 http://localhost:8889/CRM/ 会加上 如果写:
function Seacher()
{
document.forms[0].action="/html/right.do?method=SeacherSysUser";
(加了一个斜杠报 400 错误 这时路径为 http://localhost:8889/CRM//html/xx.do?method=方法名)
(如果加了一个斜杠 必须加 全路径 /CRM/html/right.do?method=initSysUser 这样子会覆盖)
document.forms[0].submit();
}
struts 表单的话可以带xx.do 的请求 如果带了的话 struts 就会默认的去写
<html:form action="html/role?method=updateSysRoleById" method="post" οnsubmit="return check()">
<html:form action="/html/~right/rightManage.do?method=editUser" method="post">
这两者都是正确的
但是他们两者的stutsConfig不同:
前者:
<!--用户管理 -->
<action path="html/right"
type="com..crm.right.zl.web.action.SysUserAction"
name="SysUserForm"
scope="request"
parameter="method"
>
<forward name="userList" path="/html/~right/user/list.jsp"></forward>
<forward name="add" path="/html/~right/user/add.jsp"></forward>
<forward name="detail" path="/html/~right/user/detail.jsp"></forward>
<forward name="dispatch" path="/html/~right/user/dispatch.jsp"></forward>
<forward name="edit" path="/html/~right/user/edit.jsp"></forward>
后者:
<!-- 权限管理 -->
<action path="/html/~right/rightManage"
type="com..crm.rightmanage.xmc.web.action.RightManageAction"
name="rightForm"
parameter="method"
scope="request"
>
<forward name="loginfail" path="/login.jsp" redirect="true"></forward>
<forward name="loginsuccess" path="/html/index.jsp" redirect="true"></forward>
<forward name="userList" path="/html/~right/user/list.jsp"></forward>
<forward name="toEditUser" path="/html/~right/user/edit.jsp"></forward>
<forward name="dispacth" path="/html/~right/user/dispatch.jsp"></forward>
<forward name="details" path="/html/~right/user/detail.jsp"></forward>
<forward name="roleList" path="/html/~right/role/list.jsp"></forward>
<forward name="toUpdateRole" path="/html/~right/role/roleAndRights.jsp"></forward>
</action>
注意带.do的表单 必须加上一个/
如: <!-- 权限管理 -->
<action path="/html/~right/rightManage" 这个路径与那个超链接匹配
type="com.crm.rightmanage.xmc.web.action.RightManageAction"
name="rightForm"
parameter="method"
scope="request"
>
http://localhost:8080/CRM/html/~right/rightManage.do?method=selectSalaryStandard
表单提交为:
<html:form action="/html/~right/rightManage.do?method=editUser" method="post">
<html:form action="html/~right/right?method=EditUser" method="post" οnsubmit="return check()">
//HR 路径问题:
超链接:显示: http://localhost:8080/HR/page/salaryCriterion/salaryCriterion.do?method=selectSalaryStandard
那么在struts-config中应该这样配置:
<action path="/page/salaryCriterion/SalaryCriterion"
name="salaryCriterionForm"
type="org.springframework.web.struts.DelegatingActionProxy"
parameter="method"
scope="request"
>
<forward name="salarystandard_query_list"path="/page/salaryCriterion/salarystandard_query_list.jsp"></forward>
</action>
因为:它提交是截取: http://localhost:8080/HR
另外有一个在webRoot的下有一个文件夹: page page下有一个文件夹 salaryCriteria 有 jsp 页面 当我请求
当我 点击jsp 页面的时候,,又要在jsp 连接到 文件夹 salaryCriteria 的 jsp 页面中,,那么page不需要带了
因为在先前请求jsp页面 已经带了
<a href="salaryCriterion/SalaryCriterion.do?method=selectSalaryStandard" target="mainFrame">薪酬标准登记复核</a>
salaryCriterion/salarystandard_change_locate.jsp
http://www.myexception.cn/java%20exception/120.html