struts2与freeer结合开发struts.xml的配置文件为:
<action name="*">
<result type="freeer">/WEB-INF/ftl/{1}.ftl</result>
</action>
struts.properties的配置文件为:
struts.ui.theme=simple
struts.i18n.encoding=utf-8
!--struts.action.extension=do
struts.objectFactory =spring
当我把struts.action.extension=do注释去掉时,页面将找不到,即出现404 Not Found的错误。
若把struts.action.extension=do注释掉后,就能正常访问页面。
请教各位大虾有遇过这样的问题吗?指导下小弟,在此谢先了!
<action name="*">
<result type="freeer">/WEB-INF/ftl/{1}.ftl</result>
</action>
struts.properties的配置文件为:
struts.ui.theme=simple
struts.i18n.encoding=utf-8
!--struts.action.extension=do
struts.objectFactory =spring
当我把struts.action.extension=do注释去掉时,页面将找不到,即出现404 Not Found的错误。
若把struts.action.extension=do注释掉后,就能正常访问页面。
请教各位大虾有遇过这样的问题吗?指导下小弟,在此谢先了!
解决方案 »
- websphere7部署项目,用firefox访问出现html源代码
- 做论坛遇到的表设计问题
- 我用delphi自制了一个web浏览器, 但在一个有textarea标签的页面里, 不能回车换行?
- 求一套学习jdbc,mysql,orcle的视频资料
- 关于失去焦点的问题,会的进来帮帮忙!!!!
- struts编写的B/S程序使用tomcat做服务器有时会无法访问????急!!!!
- 英文可以,中文不传参数不乱码Struts2->Result->type="redirect"->test2Su.jsp?username=${username}
- 怎么才能同时提供TCP连接服务器和web服务?
- 100分!struts中类似的问题大家是如何实现的?
- 对应struts中struts-config.xml的配置不太明白
- spring+ibatis 调用存储过程的问题
- java连接oracle异常
struts.action.extension=do 这个是提示struts2的action默认后缀嘛,不写默认为action啊,和这个应该没关系嘛
若把struts.action.extension=do注释去掉时,页面将找不到,即出现404 Not Found的错误
后使用http://localhost:8080/xxx/login.action访问
http://localhost:8080/xxx/login使用struts2默认后缀名,struts2默认配置struts.action.extension=action,,。
即action或者不写。
http://localhost:8080/xxx/login
和
http://localhost:8080/xxx/login.action都能正常访问。2.
struts.action.extension=do是你自定义后缀名必须加do
即:http://localhost:8080/xxx/login.do
补充:
在我的项目中有WEB-INF/ftl/login.ftl,我是直接访问freeer的静态页面的,如http://localhost:8080/xxx/login,如果我把struts.action.extension=do注释掉,页面能正常访问,
若把struts.action.extension=do注释去掉时,页面将找不到,即出现404 Not Found的错误
<result type="freeer">/WEB-INF/ftl/{1}.ftl </result>
</action>以上配置是struts2通配符配置方式。http://localhost:8080/xxx/login.action
相当配置
<action name="login">
<result type="freeer">/WEB-INF/ftl/login.ftl </result>
</action>
struts.xml:
<action name="login" class="login">
<result name="error" type="freeer">/WEB-INF/ftl/error.ftl</result>
<result name="success" type="freeer">/WEB-INF/ftl/welcome.ftl</result>
</action>
<action name="*">
<result type="freeer">/WEB-INF/ftl/{1}.ftl</result>
</action>
</package>
</struts>
在我的项目中有WEB-INF/ftl/login.ftl。
我想访问login.ftl这个静态页面,请教应该怎样配置才好呢?
<action name="login" class="login">
<result name="error" type="freeer">/WEB-INF/ftl/error.ftl </result>
<result name="success" type="freeer">/WEB-INF/ftl/welcome.ftl</result>
</action>
这样的话是不是要为每个静态页面写个Action类?其实我不login.ftl是个静态页面,我不想通过action而是直接访问的,如我输入http://localhost:8080/xxx/login.ftl就直接访问login.ftl,而不用转,就像我项目中有一个纯静态的login.html页面那样,输入http://localhost:8080/xxx/login.html这个页面。非常感谢你能抽出这么多宝贵的时间来为我解答难题!