struts2 action动态方法调用
2015-09-08 15:37
567 查看
1.直接在请求地址后指定要调用的方法名(在请求地址后加?method:方法名)
http://localhost:8080/1/test.action?method:testFunction
2.用隐藏域,添加请求方法
<input type="hidden" name="method:testFunction"/>
3.直接调用
http://localhost:8080/1/test!testFunction.action
4.配置中给命令指定通配符,method属性值用{通配符序号}引用通配符代表的字符
<action
name="test_*_*"
class="cn.com.xalead.action.testAction"
method="{1}_{2}">
<result
name="hello">/Hello.jsp</result>
<result
name="add_input">/add_input.jsp</result>
</action>
调用示例:
http://localhost:8080/1/simple_test_input.action
http://localhost:8080/1/test.action?method:testFunction
2.用隐藏域,添加请求方法
<input type="hidden" name="method:testFunction"/>
3.直接调用
http://localhost:8080/1/test!testFunction.action
4.配置中给命令指定通配符,method属性值用{通配符序号}引用通配符代表的字符
<action
name="test_*_*"
class="cn.com.xalead.action.testAction"
method="{1}_{2}">
<result
name="hello">/Hello.jsp</result>
<result
name="add_input">/add_input.jsp</result>
</action>
调用示例:
http://localhost:8080/1/simple_test_input.action
相关文章推荐
- 今天这个是mybatis与spring的整合
- java中的中文乱码处理
- Java String的经典问题(new String() ,String )
- struts2
- Description Resource Path Location Type Java compiler level does not match the version of the instal
- SpringMVC从Controller跳转到另一个Controller
- spring4声明式事务—02 xml配置方式
- spring_150805_datasource
- 关于spring mvc web工程上传下载中文文件出现乱码的问题
- java向MySQL插入当前时间的四种方式和java时间日期格式化的几种方法(案例说明)
- Java中的转义字符
- Java中的转义字符
- eclipse安装反编译插件
- eclipse安装反编译插件
- 【Java基础】--异常处理
- java script3
- spring mvc3中的addFlashAttribute方法
- 怎么样导入JAVA类?
- 15_09_08 Eclipse导入Android时出现红色感叹号的异常
- 今天看了一个利用MYeclipse进行Struts讲解的视频和大家分享一下