Struts 2.0的Action讲解
有Struts 1.x经验的朋友都知道Action是Struts的核心内容,当然Struts 2.0也不例外。不过,Struts 1.x与Struts 2.0的Action模型很大的区别。 Struts 1.x Stuts 2.0
无须继承任何类型或实现
任何接口
表单数据包含在Action中,
通过Getter和Setter获取 必须继承接口 org.apache.struts.action.Action或者其子类 表单表单数据封装在FormBean中 数据
虽然,理论上Struts 2.0的Action无须实现任何接口或继承任何类型,但是,我们为了方便实现Action,大多数情况下都会继承
com.opensymphony.xwork2.ActionSupport类,并重载(Override)此类里的String execute()方法。具体的实现,如例1所示: <%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s"uri="/struts-tags"%>
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<h2><s:property value="message"/></h2>
</body> </html> 例1 HelloWorld.jsp package

tutorial; import

java.text.DateFormat;
importjava.util.Date;
importcom.opensymphony.xwork2.ActionSupport;
publicclassHelloWorld extendsActionSupport {
privateString message;
publicString getMessage() {
returnmessage;
}
Struts2的Action讲解_IT/计算机_专业资料。Struts2.0 的 Action 讲解 有 Struts1.x 经验的朋友都知道 Action 是 Struts 的核心内容,当然 Struts2.0 也不例外...
值得提的是 Struts2.0 中的 result 不仅仅是 Struts1.x 中 forward 的别名, 它可以实现除 forward 外的很激动人心的功能,如将 Action 输出到 FreeMaker 模板...
Struts2.0之Action详解(一)_计算机软件及应用_IT/计算机_专业资料 暂无评价0人阅读0次下载举报文档 Struts2.0之Action详解(一)_计算机软件及应用_IT/计算机...
在struts1.x版本中存在哪些问题 版本中存在哪些问题 Struts2系列能够给我们带来以下特点: 系列能够给我们带来以下特点: 系列能够给我们带来以下特点 基于Action Action...
摘要详解struts2.0摘要详解struts2.0隐藏>> 对于任何的 MVC 框架而言,其实只...(2)Action 无需与 WebWork 耦合,代码重用率高 WebWork 的 Action 其实就是...
? ? ? Struts 2.0的Action 的 撑握ActionSupport 的用法 撑握 struts.xml 中的配置 ActionSupport访问request、response或 session 3 Struts 2.0的Action 的 ...
struts2的基础三(action的讲解)_计算机软件及应用_IT/计算机_专业资料。struts2的基础三(action的讲解)今日推荐 180份文档 2014证券从业资格考试...
Struts 2.0的Action讲解 暂无评价 13页 免费 struts 2.0系列3Struts 2... 13页 5财富值 Struts2.0之Action详解 14页 1财富值 struts2.0之action 37页 ...
4页 8财富值 Struts基础详解 81页 5财富值 Struts 2.0的Action讲解 17页 免费 Struts框架讲解 22页 免费 Struts实例讲解 25页 免费...
Struts 2.0的Action讲解 17页 20财富值 Struts 2.0的Action讲解 暂无评价 ...在介绍常用标志前,我想先从总体上,对 Struts 1.x 与 Struts 2.0 的标志库...
热门文档