首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

001 - struts2_helloworld_有关问题记录

2012-11-09 
001 - struts2_helloworld_问题记录???在struts.xml中加入constant namestruts.devMode valuetrue

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最好也用模块来进行命名

热点排行