在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最好也用模块来进行命名
Struts与MyEclipse配置技巧
本文介绍了在Struts框架下如何通过配置避免频繁重启Tomcat的方法,并提供了在MyEclipse中更改项目名称后的正确配置步骤。同时,还详细解释了struts.xml文件中namespace属性的作用及设置方式。
1810

被折叠的 条评论
为什么被折叠?



