001 - struts2_helloworld_问题记录
?
?
?
在struts.xml中加入<constant name="struts.devMode" value="true" />可不用老手动重起tomcat
?
在refactor改变项目名后,就在project ->reference ->myEclipse ->web 中的web context-root中改成新的项目名,否则应由老的项目名去访问
?
struts.xml
?
<package name="hello" namespace="/hello/hello" extends="struts-default">
??????? <action name="hello">
??????????? <result>/index.jsp</result>???//? 如果这里写成index.jsp(没有/)的话,会出现找不到
??????????????????????????????????????????????????????????????? /001_Helloworld/hello/hello/index.jsp,
??????????????????????????????????????????????????????????????? 因为web-root里没有对应目录下的对应文件?????????????
??????? </action>
??? </package>
</struts>
?
?
namespace决定了action的访问路径,默认为"",可以接收所有路径的action
namespace可以写为/,或者/xxx,或者/xxx/yyy,对应的action访问路径为/index.action,
/xxx/index.action,或者/xxx/yyy/index.action.<br/>
namespace最好也用模块来进行命名