struts.xml 部分配置如下:
[img]http://www.iteye.com/upload/attachment/137353/83a539db-f006-38d9-9aa8-6172af5f7c5d.bmp[/img]
index.jsp 和四个login.jsp页面body区如下:
http://localhost:8080/bookcode/index.jsp 对应login.action
http://localhost:8080/bookcode/package1/login.jsp 对应login1.action
http://localhost:8080/bookcode/package2/login.jsp 对应login2.action
http://localhost:8080/bookcode/package3/login.jsp
对应:
[quote]HTTP Status 404 - /bookcode/bookcode/index.jsp
--------------------------------------------------------------------------------
type Status report
message /bookcode/bookcode/index.jsp
description The requested resource (/bookcode/bookcode/index.jsp) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.10[/quote]
<struts>
<!-- 包bookcode 命名空间是默认命名空间("namespace="";")-->
<package name="bookcode" extends='struts-default'>
<action name="submit" class="action.Login">
<result name="success">index.jsp</result>
</action>
</package>
<!-- 包package1 命名空间package1 -->
<package name="package1" extends="struts-default" namespace="/package1">
<action name="submit" class="action.Login1">
<result>/package1/login.jsp</result>
</action>
</package>
<!-- 包package2 命名空间package2 -->
<package name="package2" extends="struts-default" namespace="/package2">
<action name="submit" class="action.Login2">
<result>/package2/login.jsp</result>
</action>
</package>
<!-- 包package3 命名空间 根namespace -->
<package name="package3" extends="struts-default" namespace="/">
<action name="submit" class="action.Login3">
<result>/package3/login.jsp</result>
</action>
</package>
[img]http://www.iteye.com/upload/attachment/137353/83a539db-f006-38d9-9aa8-6172af5f7c5d.bmp[/img]
index.jsp 和四个login.jsp页面body区如下:
<body>
<s:form action="submit">
<s:submit value="submit"/>
</s:form>
</body>
http://localhost:8080/bookcode/index.jsp 对应login.action
http://localhost:8080/bookcode/package1/login.jsp 对应login1.action
http://localhost:8080/bookcode/package2/login.jsp 对应login2.action
http://localhost:8080/bookcode/package3/login.jsp
对应:
[quote]HTTP Status 404 - /bookcode/bookcode/index.jsp
--------------------------------------------------------------------------------
type Status report
message /bookcode/bookcode/index.jsp
description The requested resource (/bookcode/bookcode/index.jsp) is not available.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.10[/quote]