问题描述:
struts版本:1.2.9
当前应用的路径为 http://localhost:8080/ContextRelativeTest/
显示为首页 hello.jsp
hello.jsp有一个可以提交action的form <html:form action="/relativeAction.do">
struts-config.xml中的action的配置如下:
<action path="/loginAction"
type="cn.dragonsun.aciton.HelloAction"
name="helloForm"
validate="false"
input="/hello.jsp">
<forward name="success" path="/welcome.jsp" contextRelative="true" redirect="true"/>
</action>action类中的代码是直接return mapping.findForward("success");成功执行按照我对contextRelative="true"的理解,action执行后应该转到http://localhost:8080/welcome.jsp
可是结果还是 http://localhost:8080/ContextRelativeTest/welcome.jsp网上对contextRelatvie也有介绍,其中有一个很清晰的说法是:
如果当前路径为http://localhost/moduleA/ 
<forward name="..." path="/target.jsp" redirect="true" contextRelative="false"/> 
执行以上forward时会转向http://localhost/moduleA/target.jsp 
如contextRelative="true"时,会转向http://localhost/target.jsp 
但是我怎么也实现不了这个问题,十分迷惑
希望高手能帮助指点指点,帮帮小弟,谢谢了