动态方法调用:通过url动态调用Action中的方法。

action声明:

<package name="struts-app2" namespace="/" extends="struts-default">
<action name="Product" class="org.simpleit.app.Product">
</package>

URI:

--/struts-app2/Product.action:struts调用Product类的execute

--/struts-app2/Product!save.action:struts调用Product类的save()方法。

默认情况下,struts的动态方法调用处于禁用状态。

<!-- 打开允许动态方法调用的开关,默认是false -->
<constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>

在连接中访问Product!save.action可以调用Product的save方法。

但是不推荐这样使用,因为这样就暴露了Bean里面的方法。

Struts2学习第七课 动态方法调用的更多相关文章

  1. Struts2学习笔记 - Action篇<动态方法调用>

    有三种方法可以使一个Action处理多个请求 动态方法调用DMI 定义逻辑Acton 在配置文件中使用通配符 这里就说一下Dynamic Method nvocation ,动态方法调用,什么是动态方 ...

  2. struts2视频学习笔记 11-12(动态方法调用,接收请求参数)

    课时11 动态方法调用 如果Action中存在多个方法时,可以使用!+方法名调用指定方法.(不推荐使用) public String execute(){ setMsg("execute&q ...

  3. struts2.3.15.3中动态方法调用默认是关闭的

    初学ssh,用的struts2.3.15.3,使用了如下表单: <form action="/spring3/index/login.action" method=" ...

  4. Struts2之action 之 感叹号 ! 动态方法调用

    struts2的动态方法调用的方式: 1.第一种方式:设置method属性 在Action类中定义一个签名与execute方法相同.只是名字不同的方法,如定义为: public String logi ...

  5. Struts2学习第七课 OGNL

    request变成了struts重写的StrutsRequestWrapper 关于值栈: helloWorld时,${productName}读取productName值,实际上该属性并不在requ ...

  6. Struts2学习第七课 result

    result 是action节点的子节点 result 代表action方法执行后,可能去的一个目的地 一个action节点可以配置多个result子节点. result的name属性值对应着acti ...

  7. Struts2学习第七课 ActionSupport

    com.opensymphony.xwork2.ActionSupport类是默认的Action类,如果某个Action节点没有配置class属性,则ActionSupport即为待执行的Action ...

  8. Struts2学习第七课 通配符映射

    一个WEB应用可能有长百上千个action声明,可以利用struts提供的通配符映射机制吧多个彼此相识的映射关系简化为一个映射关系. 通配符映射规则: --若找到多个匹配,没有通配符的那个将胜出(精确 ...

  9. Struts2-整理笔记(二)常量配置、动态方法调用、Action类详解

    1.修改struts2常量配置(3种) 第一种 在str/struts.xml中添加constant标签 <struts> <!-- 如果使用使用动态方法调用和include冲突 - ...

随机推荐

  1. python内置方法补充all

    all(iterable) 版本:该函数在python2.5版本首次出现,适用于2.5以上版本,包括python3,兼容python3版本. 说明:如果iterable的所有元素不为0.''.Fals ...

  2. 剑指offer之 斐波那契数列

    package Problem9; public class Fibonacci { /* * 题目描述: 写一个函数,输入n,求斐波那契数列的第n项,斐波那契数列的定义如下: n=0,f(n)=0 ...

  3. shell 中 exec 和 source 命令解析

    文章大部分来源于:http://www.cnblogs.com/zhaoyl/archive/2012/07/07/2580749.html 作为笔记留存博客备忘. exec和source都属于bas ...

  4. eclipse从Git获取项目更新

    1.项目上右键 ——> Team ——> pull   如果报错:   解决方法:   依次打开:Window ——> Preferences ——> Team ——> ...

  5. jquery 实现动态表单设计

    只是实现了前台页面的动态表单的设计,并未实现后台绑定数据到数据库等功能.技术使用到的为jquery和bootstrap.俗话说有图有真相,先说下具体效果如下: 点击添加一个面板容器: 容器添加成功: ...

  6. matlab之sub2ind()函数

    将下标转换为线性索引 语法 linearInd = sub2ind(matrixSize, rowSub, colSub) 说明 linearInd = sub2ind(matrixSize, row ...

  7. C++判断一个文件是否可以正确打开的代码

    /* fopen example */ #include <iostream> #include <conio.h> using namespace std; int main ...

  8. spring学习(5)

    bean配置 启用注解 <context:annotation-config/> 使用spring的特殊bean 对bean BeanPostProcessor spring本身提供的特殊 ...

  9. zTree的后台数据绑定

    前台js: var treeNodes; $.ajax({ async: false, cache: false, type: 'POST', contentType: "applicati ...

  10. L106 Three things we learned from day one at the World Cup

    Hosts Russia got the World Cup off to a flying start by hammering Saudi Arabia 5-0 in the opening ga ...