Struts2之form标签的action及namespace属性的组合使用
来源:互联网 发布:java编写贪吃蛇教程 编辑:程序博客网 时间:2024/06/04 23:24
jsp页面:
<s:form name="login" method="post" action="login" namespace="/hello" >
struts.xml文件:
<struts>
<package name="users" namespace="/hello" extends="default">
<actionname="login" class="com.loginAction" method="login">
······
</action>
</package>
<struts>
解释:
jsp页面中form标签的action属性对应于struts.xml文件中action标签的name属性
jsp页面中form标签的namespace属性对应于struts.xml文件中package标签的namespace属性
注意:
1.不能写成<s:form name="login" method="post" action="login.action" namespace="/hello" >
.action不能由我们手工添加,Struts2会自动为你完成这个工作。不然会出现以下错误:
警告:No configuration found for the specified action: 'ShowMessage' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
2.尽量不要写成<s:form name="login" method="post" action="/hello/login" >
既然Struts2为我们提供了namespace属性,使用它让我们的代码更规范。- Struts2之form标签的action及namespace属性的组合使用
- 普通html中<form>标签和struts2中<s:form>标签action属性的不同
- 普普通通html中<form>标签和struts2中<s:form>标签action属性的不同
- HTML <form> 标签的 action 属性
- HTML <form> 标签的 action 属性
- struts2 的form 标签theme属性
- Struts2学习(三):namespace属性的使用
- Struts2学习(三):namespace属性的使用
- jsp表单中form标签的action属性的值
- struts2的form提交时action属性的配置
- struts2 中,@NameSpace 和 @Action 的使用示例
- Struts2 namespace的使用
- struts2系列二之namespace 的使用
- struts2.0 的action标签使用
- struts2之form标签theme属性详解
- struts2之form标签theme属性详解
- struts2之form标签theme属性详解
- struts2之form标签theme属性详解
- MYSQL 主从配置
- call与apply
- Java RMI之HelloWorld篇
- 深入java 自定义异常以及常用
- REM转换脚本
- Struts2之form标签的action及namespace属性的组合使用
- hibernate单表,一对多,多对多注解详解
- JSP的四种作用域
- JSTL中foreach标签结合select标签使用
- 二叉树前序、中序、后序遍历非递归写法的透彻解析
- iOS事件响应链详解(The Responder Chain)
- 括号画家
- MyEclipse2014/2015 安装Activiti插件
- html <object>标签