struts2_day01_14_Action的方法访问(使用method属性)
来源:互联网 发布:java abstract final 编辑:程序博客网 时间:2024/05/16 08:27
使用action标签method属性
1 创建action,创建多个方法
package com.hlg.action;import com.opensymphony.xwork2.ActionSupport;public class BookAction extends ActionSupport{public String add(){System.out.println("add.....");return NONE;}public String update(){System.out.println("update.....");return NONE;}}
2 使用method配置
<?xml version="1.0" encoding="UTF-8"?><!-- struts2约束 start --><!DOCTYPE struts PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN""http://struts.apache.org/dtds/struts-2.3.dtd"><!-- struts2约束 end --><struts><!-- 常量 --> <constant name="struts.i18n.encoding" value="UTF-8"></constant> <!-- <package name="hellodemo" extends="struts-default" namespace="/"> <action name="myhello" class="com.hlg.action.HelloAction"><result name="ok">/hello.jsp</result></action></package> --><!-- <include file="hello.xml"></include> --><package name="methoddemo" extends="struts-default" namespace="/"><action name="add" class="com.hlg.action.BookAction" method="add"></action><action name="update" class="com.hlg.action.BookAction" method="update"></action></package></struts>
缺陷:action每个方法都需要配置,如果action里面有多个方法,配置很多的action
阅读全文
0 0
- struts2_day01_14_Action的方法访问(使用method属性)
- 动态方法调用和使用action元素的method属性
- Struts的Action接口---(2)Method属性方法调用。
- Spring init-method和destroy-method属性的使用
- Spring init-method和destroy-method属性的使用
- Spring init-method和destroy-method属性的使用
- java Method 访问方法
- 使用反射操作类的私有属性(Field)和私有方法(Method)
- 使用$this变量访问方法和属性
- Method的invoke()方法的使用
- Method的invoke()方法的使用
- 在使用私有属性公有方法访问的时候在get方法里使用判断
- Method类invoke方法的使用
- Method类invoke方法的使用
- Method类invoke方法的使用
- Method之invoke()方法的使用
- PHP面向对象----(私有属性的访问方法)
- C#反射的学习(二)--访问字段、属性、方法
- 第四篇(十种算法)
- storm的第一个例子
- “自顶向下,逐步求精”的编程方法
- Closures(闭包)
- Java并发知识点总结
- struts2_day01_14_Action的方法访问(使用method属性)
- H
- C++——黑白棋(右上)
- Android-X86 创始人
- python基础知识
- 使用Gson解析Json为Map对象探索(下)
- C++——黑白棋(落子)
- css3 中transition监听事件
- Python 爬虫项目示例