我是struts新手,所以我知道包命名空间中“/”的含义。 IE。 当我将 namespace 设置为“/Home”时
<package name="base" namespace="/Home" extends="struts-default">
<action name="HelloWorld" class="controller.HelloWorld">
<result>/message.jsp</result>
</action>
</package>
并在浏览器中输入此网址:“localhost:8080/Struts2Example/Home/HelloWorld.action”,然后打开页面。
但是当我将命名空间更改为“Home”时,它会给出“错误:404”。
那么这个“/”是什么意思?
最佳答案
摘自Struts手册http://download.oracle.com/otn_hosted_doc/jdeveloper/j2ee101302/working_with_struts/f1_struts_ide/f1_strutsconfigactionmappings.html
这里
http://struts.apache.org/release/2.1.x/docs/namespace-configuration.html
请求 URI 路径,当 Struts servlet 操作 Controller 接收到该路径时,将调用操作映射。 路径名是相对路径,必须包含正斜杠 (/)。
关于java - struts.xml中package元素的namespace属性中的 "/"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21414124/