动态方法调用:通过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. 跨平台(I版到K版)迁移实践总结

           所谓跨平台迁移,对于了解openstack冷迁移过程的同学来说,其实就是手动去执行冷迁移的代码行为,当然像我这种抵制体力劳动的人,肯定会想写脚本去跑,即使不会也要边学边用. 迁移并非想象 ...

  2. 纯CSS3实现关闭按钮

    在线演示 本地下载

  3. Vim 的命令模式转插入模式

    一.在命令模式输入下面的快捷方式: i 在当前光标前插入字符: I 在当前行行首插入字符: a 在当前光标后插入字符: A 在当前行行尾插入字符: o 在当前行下面另起一新行: O 在当前行上面另起一 ...

  4. POJ Layout

    A - Layout Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit S ...

  5. matlat之KDTreeSearcher()函数

    Create Kd-tree nearest neighbor searcher(创建kd-树最近邻搜索器). Description KDTreeSearcher model objects sto ...

  6. C语言链表结构体(学习笔记)

    #include <stdio.h> #define LENTEST 100 // 采取逐步删除的方法求的素数 //先假设1-100都是素数,然后剔除2的倍数, //3的倍数,直到剔除所有 ...

  7. cluster KMeans need preprocessing scale????

    Out: n_digits: 10, n_samples 1797, n_features 64 ___________________________________________________ ...

  8. codeforces 637D D. Running with Obstacles(dp,水题,贪心)

    题目链接: D. Running with Obstacles time limit per test 2 seconds memory limit per test 256 megabytes in ...

  9. PS 滤镜——漩涡 vortex

    %%% Vortex %%% 漩涡效果 clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS A ...

  10. mysql删除重复数据方法

    create table tmp SELECT * from lhb t where t.id not in (select max(id) from lhb group by code,date,r ...