我是靠谱客的博主 高大草丛,这篇文章主要介绍action method配置,现在分享给大家,希望可以做个参考。

使用action标签method属性
1、创建action,创建多个方法

package zmx.itcast.method;
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..........11111");
return NONE;
}
}

2 使用method配置

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="methoddemo" extends="struts-default" namespace="/">
<!-- 有method属性,写要执行的action里面的方法的名称 -->
<action name="addAction" class="zmx.itcast.method.BookAction" method="add"></action>
</package>
</struts>

最后

以上就是高大草丛最近收集整理的关于action method配置的全部内容,更多相关action内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(114)

评论列表共有 0 条评论

立即
投稿
返回
顶部