struts 中关于xml配置文件中namespace的理解
来源:互联网 发布:软件功能结构图 visio 编辑:程序博客网 时间:2024/05/21 06:53
先看一下配置文件中的语句:
<package name="shit1" namespace=“eg1” extends="struts-default"></package>
<package name="shit2" namespace=“eg2” extends="struts-default"></package>
此时假如有两个action同名,都为login。 但是一个属于命名空间eg1,一个属于命名空间eg2,此时为了区分这两个名字相同但是功能(实现)不同的两个方法,命名空间的作用就体现出来了。 如果在eg1中调用eg2的login方法,就会出现404错误。
此外,更简单明了的例子: 如果有这样一个配置语句:
<package name="shit1" namespace=“eg1” extends="struts-default">
<action name="goindex" class="com.action.IndexAction">
<result>/view/IndexTemp.jsp</result>
</action>
</package>
假如你在JSP页面中写了一个form:<name='shit' id='shitt' action='goindex'></form>
此时form表单的提交就会报错404,因为goindex这个action在eg1命名空间下,你需要改变action为'eg1/goindex'
个人的理解
0 0
- struts 中关于xml配置文件中namespace的理解
- 配置文件struts.xml中 namespace 和 result 格式
- struts.xml中package的namespace属性
- struts.xml中package的namespace属性
- 关于openlayers中namespace的一点理解
- Struts2 的 struts.xml 配置中 namespace 的使用
- Struts2 的 struts.xml 配置中 namespace 的使用
- Struts2 的 struts.xml 配置中 namespace 的使用
- Struts2 的 struts.xml 配置中 namespace 的使用
- Struts2 的 struts.xml 配置中 namespace 的使用
- Struts2 的 struts.xml 配置中 namespace 的使用
- Struts2中struts.xml的Action、namespace配置详解
- struts.xml中namespace的配置之浏览器兼容性
- 3.1.struts.xml中package的namespace属性
- struts中包的namespace
- Struts框架中struts-config.xml配置文件的作成说明
- Struts中struts.xml配置文件的主要元素(package,action)
- Struts中struts.xml配置文件的主要元素(result)
- 敏捷项目管理学习笔记
- 在Activity的onCreate方法中显示PopupWindow导致异常的原因分析及解决方案
- unity lua
- 英语美句——正能量
- 最近WiFi共享的应用似乎很火爆啊,是不是考虑也做一个?
- struts 中关于xml配置文件中namespace的理解
- 8款最新超酷HTML5/CSS3特效及源码
- log4j学习总结
- 微信点餐外卖系统,让餐厅变得更智慧
- 时间限制没有交货sql语句
- 使用 Bluemix 分析来自 Oculus Rift 的游戏数据
- fcntl.h与unistd.h
- [Java](NumberFormat) DecimalFormat
- 技术点汇总(待补充)