Samuel Learning

  • 联系
  •  
  • 管理

文章分类(203)

  • 01 ASP/HTML(6)
  • 02 Script/CSS(16)
  • 03 C/C++
  • 04 XML(4)
  • 05 微软编程(26)
  • 06 J2EE(60)
  • 09 Linux(14)
  • 10 Database(27)
  • 11 报表打印
  • 12 打包安装(1)
  • 13 模式重构(2)
  • 14 系统架构
  • 15 敏捷开发(11)
  • 16 案例分析(30)
  • 17 Workflow(1)
  • 18 配置管理(1)
  • 19 项目管理
  • 20 英语(4)

新闻分类(52)

  • CXF学习
  • Hibernate学习(1)
  • iBatis学习(16)
  • Struts1学习(1)
  • Struts2学习(34)

.NET资源

  • adxmenu
  • C# Open Source
  • DNN Directory
  • M2Land
  • Windows Form FAQ
  • 中国DNN
  • 中国DNN联盟

Ajax

  • DoJo
  • GWT
  • JQuery
  • jquery autocomplete
  • jquery flexgrid
  • JQuery Form
  • jquery masked input
  • JQuery UI
  • jquery validation
  • Jquery 图表
  • jquery报表
  • jquery插件集合
  • Qooxdoo
  • Tibco GI
  • YUI
  • YUI-EXT
  • ZeroKode

Java开源

  • ABLE
  • Agile Tao
  • Ajax4JSF
  • Alfresco
  • AppFuse
  • Compiere
  • Equinox
  • Findbugs
  • Geronimo
  • Grails
  • Harmony
  • Hibernate论坛
  • JAG
  • Java开源大全
  • Java视线论坛
  • jBPM工作流
  • JSFTutorials
  • Nereide ERP
  • Ofbiz ERP
  • Opentaps ERP
  • operamasks
  • Petstore
  • Prototype.js
  • RIFE
  • Runa
  • SpringSide
  • Struts Menu
  • Sun Glassfish
  • Trails
  • YUI4JSF
  • 满江红

Mobile

  • Sencha

WEB资源

  • DHTML中心
  • DHTML参考手册
  • DHTML文档
  • EclipsePlugin
  • Firebug
  • GRO Clinux
  • jMaki
  • JSTL文档
  • LoadIcon
  • Openlaszlo
  • Struts Menu 展示
  • Web Test Tools
  • WebCtrs
  • Webdeveloper
  • 中国RIA开发者论坛

Workflow

  • E-Workflow
  • JBPM
  • OpenWFE
  • OSWorkflow
  • WFMC
  • Workflow Research

其他连接

  • confach
  • CPP
  • ejay
  • Giovanni
  • 丹佛
  • 交大e-learning
  • 交大研究生院
  • 可恶的猫
  • 天天@blog
  • 我的相册
  • 阿飞

大牛人

  • 32篇JBPM
  • David.Turing
  • HongSoft@业务集成
  • Joel
  • Koen Aers
  • Martinfowler
  • Raible Matt
  • Raible Wiki
  • Scott W.Ambler
  • Tom Baeyens
  • Uncle Bob
  • 一个世界在等待
  • 子在川上曰
  • 小布老师
  • 小明
  • 差沙
  • 徐昊
  • 江南白衣
  • 汪博士
  • 汪小金
  • 银狐999

开源软件

  • 2Bizbox ERP
  • CompiereCRM&ERP
  • EGW
  • Vtiger CRM
  • webERP

敏捷

  • Canoo
  • Cruisecontrol
  • DBUnit
  • EL4Ant
  • Extreme Programming
  • Fit
  • Fitnesse
  • JFrog
  • Liquibase
  • Maven
  • MockObjects
  • Selenium
  • Squish
  • xpairtise
  • XPlanner
  • XProgramming
  • 敏捷联盟

数据库

  • Oracle 中国
  • Oracle-ERP
  • Oracle在线社区

未归类

  • Aquarius Orm Studio
  • mambo建站系统
  • Oracle产品下载
  • 远程同步管理工具Capivara

经典框架

  • Apache Shale
  • formdef-struts
  • FreeMarker 主页
  • JBoss Seam
  • JSF 中心
  • JSF 入门应用
  • JSF中国
  • MyFaces官方
  • Spring 社区
  • Spring专业网站
  • Spring中文论坛
  • Spring参考手册
  • Spring官方网站
  • strecks-struts
  • Struts1
  • Struts2
  • Struts-layout
  • StrutsWiKi
  • Tapestry WIKI
  • Tapestry 官方
  • Tapestry4开发指南
  • Tapestry中文文档
  • Webwork2文档
  • Wicket

网络教程

  • Laliluna
  • RoseIndia
  • Sang Shin
  • Visualbuilder

著名站点

  • Buildix
  • Dev2Dev
  • IBM dev中国
  • InfoQ
  • ITPub
  • Java Eye
  • Java Research
  • JavaRead
  • JavaWorldTW
  • Matrix
  • PHP100
  • PHPX
  • SpringSideWiKi
  • TheServerSide
  • TWPHP
  • 中国工作流论坛

项目管理

  • 管理人网

最新评论

View Post

Cookbook-struts1.3.8案例分析-Bean Tags

 

Cookbook-struts1.3.8案例分析-Bean Tags

l Bean Tags

入口Action配置

<action path="/prepareBean"

           type="examples.bean.PrepareBeanAction">

           <forward name="success" path="/jsp/bean/Bean.jsp" />

</action>

SuccessAction,继承自Action,execute方法如下

public ActionForward execute(

        ActionMapping mapping,

        ActionForm form,

        HttpServletRequest request,

        HttpServletResponse response)

        throws Exception {

        // Set-up an example bean

        ExampleBean example = new ExampleBean();

        example.getList().add("List entry #1");

        example.getList().add("List entry #2");

        example.getList().add("List entry #3");

        example.getList().add("List entry #4");

        // Add a nested bean

        example.setNested(new NestedBean());

        // Place the example bean in the request scope

        request.setAttribute("example", example);

        // Forward to the test page

        return mapping.findForward("success");

}

ExampleBean的定义

/**Abooleanvalue*/

    privatebooleanbooleanValue = false;

    /**Adoublevalue*/

    privatedoubledoubleValue = 45213.451;

    /**Afloatvalue*/

    privatefloatfloatValue = -123.582F;

    /**Anintegervalue*/

    privateintintValue = 256;

    /**Alongintegervalue*/

    privatelonglongValue = 1321546L;

    /**Ashortintegervalue*/

    privateshortshortValue = 257;

    /**Astringvalue*/

    private String stringValue = "Hello, world!";

    /**AdateValuevalue*/

    private java.util.Date dateValue = new java.util.Date();

    /**Alist*/

    private List list = new ArrayList();

    /**Anarray*/

    private String[] array = { "Red", "Green", "Blue", "Black", "Orange" };

    /**Anestedbean*/

    private NestedBean nested = null;

    /**HTMLformattedmarkup*/

    private String html =

          "<p>This is a <strong>simple</strong> example of "

        + "<em>HTML</em> formatted text.</p>";


NestedBean的定义

/**Astringvalue*/

private String stringValue = "This is a string from NestedBean";

JSP文件对Bean标签的处理

输出request范围内example这个bean的原始属性

<bean:write name="example" property="booleanValue" />

输出request范围内example这个bean的String属性

<bean:write name="example" property="stringValue" />

输出request范围内example这个bean的date属性

<bean:write name="example" property="dateValue" />

格式化数字

<bean:write name="example" property="doubleValue" format="$0,000.00"/>

格式化数字

<bean:write name="example" property="floatValue" formatKey="format.currency"/>

格式化日期

<bean:write name="example" property="dateValue" format="MMM d yyyy '@' HH:mm"/>

格式化日期

<bean:write name="example" property="dateValue" formatKey="format.date"/>

输出列表元素

<bean:write name="example" property="list[2]" />

输出数组元素

<bean:write name="example" property="array[3]" />

输出嵌套的string值

<bean:write name="example" property="nested.stringValue"/>

过滤html里的<&>等符号

<bean:write name="example" property="html"/>

不过滤html符号

<bean:write name="example" property="html" filter="false"/>

定义和显示bean值

<bean:define id="define1" value="This is a test string"/>

<bean:write name="define1" />

定义bean值,值取自request范围内的变量

<bean:define name="example" property="nested" id="define2" />

<bean:write name="define2" property="stringValue" />

取得并显示request header的值

<bean:header name="Accept-Encoding" id="encodings" />

<bean:write name="encodings" />

从资源文件获取值

<bean:message key="message.example.simple"/>

<bean:message key="message.example.replaceable" arg0="a slightly more complex" arg1="2 replaceable" />

从parameter里获取值,赋给变量,然后显示该变量

<bean:parameter name="param1" id="p1" value=""/>

<bean:write name="p1" />

<bean:parameter name="param3" id="p3" value="DEFAULT"/>

<bean:write name="p3" />

取得list的大小,并显示他

<bean:size name="example" property="list" id="listSize" />

<bean:write name="listSize" />

定义cookie值,并显示其属性

<bean:cookie id="sess" name="JSESSIONID" value="JSESSIONID-IS-UNDEFINED"/>

<bean:write name="sess" property="value"/>

posted on 2008-07-08 02:13 MingIsMe 阅读(115) 评论(0)  编辑  收藏 所属分类: 16 案例分析

 
Powered by:
BlogJava
Copyright © MingIsMe