﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-铁手剑谱-随笔分类-框架</title><link>http://www.blogjava.net/SteelHand/category/1600.html</link><description>&lt;strong&gt;上善若水&lt;/strong&gt;</description><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 13:29:23 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 13:29:23 GMT</pubDate><ttl>60</ttl><item><title>Struts Classic 的变迁（下），从1.1到1.2</title><link>http://www.blogjava.net/SteelHand/archive/2005/12/28/25731.html</link><dc:creator>铁手</dc:creator><author>铁手</author><pubDate>Wed, 28 Dec 2005 07:41:00 GMT</pubDate><guid>http://www.blogjava.net/SteelHand/archive/2005/12/28/25731.html</guid><wfw:comment>http://www.blogjava.net/SteelHand/comments/25731.html</wfw:comment><comments>http://www.blogjava.net/SteelHand/archive/2005/12/28/25731.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.blogjava.net/SteelHand/comments/commentRss/25731.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/SteelHand/services/trackbacks/25731.html</trackback:ping><description><![CDATA[


<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>Untitled Document</title>


<h1>Struts1.2.4</h1>
<h2>新特征</h2>
<h3>主要修改：</h3>
<p><strong>不赞成特征</strong><strong> </strong><br>
  Struts1.1中已经有很多构造不再赞成使用。许多已经被删除了。所以在升级到1.2.4时，请clean-compile 你的应用，并且使deprecation warnings 被打开。在升级到1.2.4之前强烈建议解决所有decprecated 的用法。最可能应用开发人员的用法是： </p>
<ol>
  <ol>
    <li>org.apache.struts.Action  statics: 如今使用org.apache.struts.Global statics </li>
    <li>Action.perform:  如今使用Action.execute</li>
  </ol>
</ol>
<p>虽然没有被删除也没有被标明为不赞成使用，最好还是将ActionErrors 替换为ActionMessages 以确保正确的操作。 <br>
    <strong>TagUtils </strong><strong>和</strong><strong>ModuleUtils</strong><br>
  许多以前在org.apache.struts.utils.RequestUtils中找到的工具方法如今移动到了org.apache.struts.taglibs.TagUtils 或org.apache.struts.utils.ModuleUtils包中。 <br>
  <strong>GenericDataSource  / GenericConnection </strong><strong>实现被删除</strong><strong> </strong><br>
  datasources  manager 仍然支持，但是我们自己的datasource <em>implementation</em>is 并不被支持。很欢迎你插入自己的DataSource 实现，但是我们没有资源来维护我们自己的实现。如果你的容器不支持DataSource实现，推荐使用Jakarta Commons的 DBCP package。 <br>
  <strong>Validator </strong><strong>增强</strong><strong> </strong></p>
<ol>
  <li>ValidWhen </li>
</ol>
<p>Struts Validator 如今支持ValidWhen  规则，以便一个验证可以依赖于另一个验证。</p>
<ol>
  <li>IntRange  现在可以检测select-one 和radio 字段。比如：这使得我们可以使用一些有效的选项加上一个具有诸如"Choose one" 标题并且值为"-1"的附加选项来组装一个组合框。那么当用户试图提交一个表单时，你可以检测值是否为-1，从而决定是否没有选择选项。 </li>
  <li>你现在可以强制进行客户端Javascript  验证来检测所有约束，而不是停留在第一个错误之处。方法是设置Validator PlugIn上的一个新的属性stopOnFirstError为false。<a href="http://struts.apache.org/struts-doc-1.2.4/userGuide/dev_validator.html#stopOnFirstError"></a> </li>
  <li>"required"  验证现在可以检测checkboxes, radio,select-one, 和 select-multiple 字段类型。参见修改后的Validator 示例来看如何使用这些新的特征。 </li>
  <li>一个标准的validateUrl 规则可以让你能够检测某一个属性是否包含一个格式正确的URL。 </li>
</ol>
<p><strong>DigestingPlugIn</strong><br>
  一个新的标准PlugIn 可以帮助你在application范围内创建你自己的对象图（object graph）。这是创建供Action调用的业务对象的快捷方式。请参见最新的MailReader 示例来看如何使用DigestingPlugin。 <br>
  <strong>ModuleConfigVerifier</strong><br>
  虽然不是全新的，一个标准类，用来验证模块配置，位于PlugIn 包。ModuleConfigVerifier  主要确认Struts对象图的各中组件被载入。但是，开发人员可扩展此类来检查确保Struts 配置文件的内部一致性。 <br>
  <strong>提供了支持Maven的项目文件</strong>.<br>
  <strong>新的配置</strong><strong>DTD</strong><br>
  推荐使用<a href="http://struts.apache.org/dtds/struts-config_1_2.dtd">struts-config_1_2.dtd</a>。新的DTD 添加了两个新的元素&lt;display-name&gt;  和 &lt;description&gt; 到struts-config 元素中。这些元素可用于struts配置文件工具和文档产生工具。在Struts 1.2.x 中，已有的Struts 配置文件可以使用两个版本的DTD 都可载入。 <br>
  <strong>新的</strong><strong>Taglib URIs</strong><br>
  标签库的URI已经被修改已反映Struts从Jakarta 移到了Apache  的顶级项目。为了兼容，使用旧的URI的TLD仍然有效，但是鼓励使用新的URI。 <br>
  <strong>Struts-Chain</strong> <br>
  试验性的，这个新的"contrib" package 使用了Jakarta Sandbox中的Responsibilty  package 的Chainin 来创建一个新的RequestProcessor的Breed。未来版本可能会成为默认实现。.<br>
  <strong>MappingDispatchAction</strong><br>
  一个新的标准Action，将控制转发到ActionMapping 参数命名的一个方法。 <br>
  <strong>Cancel  handlers</strong><br>
  DispatchAction,  LookupDispatchAction, 和  MappingDispatchAction ，如今提供了默认的可以覆写的cancel  handler。也可以指定默认的handler name。 <br>
  <strong>Session-scoped  ActionMessages</strong><br>
  现在你可以将ActionMessages 保存在session 中and  have them cleaned up after the first use。现在除了Action.saveMessages() 将消息保存在session中还有了另外一种选择。在消息已经被访问过一次之后ActionMessages.isAccessed() 返回true。RequestProcessor.processCachedMessages()  查询isAccessed() 已决定是否应该将消息从session中删除。 <br>
  <strong>JA Mailreader</strong><br>
  Struts  Mailreader Example 应用现在包含Japanese 资源文件。 <br>
  <strong>Tiles EL</strong><br>
  Tiles tags 如今可以通过Struts EL taglib使用EL，后者基于JSTL。 <br>
  <strong>Wildcard  Mappings</strong><br>
  现在可以在actiponMapping中使用通配符。详细信息参见Struts Mailreader Example application。 <br>
  <strong>Action  attributes</strong><br>
  html img tag 添加了Action 属性，以匹配html link tag。 <br>
  <strong>Module  attribute</strong><br>
  Forward元素以及多个核心标签中新增一个"module" 属性。这个属性允许你通过名称（或者前缀）指定另一个模块来创建模块间的直接链接。新的module 属性优于contextRelative属性，并且可以常用于"SwitchAction"中。 </p>
<h1>Struts 1.2.7</h1>
<h2>主要修改</h2>
<h3>依赖性</h3>
<p>Struts 对下列组件的依赖性发生了改变： </p>
<table border="1" cellpadding="0" cellspacing="0">
  <tbody><tr>
    <td valign="top" width="340"><br>
      依赖性 </td>
    <td valign="top" width="340"><p>新的版本</p></td>
  </tr>
  <tr>
    <td valign="top" width="340"><p>Commons BeanUtils</p></td>
    <td valign="top" width="340"><p>Version 1.7.0</p></td>
  </tr>
  <tr>
    <td valign="top" width="340"><p>Commons Digester</p></td>
    <td valign="top" width="340"><p>Version 1.6</p></td>
  </tr>
  <tr>
    <td valign="top" width="340"><p>Commons Validator</p></td>
    <td valign="top" width="340"><p>Version 1.1.4</p></td>
  </tr>
  <tr>
    <td valign="top" width="340"><p>Commons Collections</p></td>
    <td valign="top" width="340"><p>removed</p></td>
  </tr>
  <tr>
    <td valign="top" width="340"><p>Commons Lang</p></td>
    <td valign="top" width="340"><p>removed</p></td>
  </tr>
</tbody></table>
<h3>Core Struts</h3>
<h4>Saving Messages in the Session</h4>
<p>在action也新增了一个方法[saveErrors(HttpSession, ActionMessages)]来将<em>errors</em> 保存在Session 中，并且在其第一次被访问之后被自动从Session中删除。这是等同于1.2.4 中message上新增的功能。 </p>
<h4>Re-directing ActionForward</h4>
<p><em>ActionRedirect</em> 是ActionForward  的一个子类，其设计来用于重定向请求，支持在运行时添加参数。 </p>
<h4>Download Action</h4>
<p><em>DownloadAction</em> 是一个提供了下载文件的具体细节的抽象Action。 </p>
<h4>Dispatch Helper</h4>
<p><em>ActionDispatcher</em> 是一个提供<em>DispatchAction</em> 类型的行为但是不必继承自<em>DispatchAction</em>。 </p>
<h4><em>Lazy</em> Validator Form</h4>
<p><em>DynaBean</em> 风格的ActionForm，它不需要其属性被定义，并提供<em>Lazy List</em> 和<em>Lazy Map</em> 行为。 </p>
<h4>jars 中的配置文件 </h4>
<p>配置文件(如. Struts config, Validator config 和 Tiles 配置文件)现在可以被保存在jars。Struts 会像以前一样检查servlet context，但是如果没找到， Struts 会尝试classloader 去查找。 </p>
<h3>Tag Library 改变</h3>
<h4>Highlighting Errors</h4>
<p>Struts现在可以使用HTML Input Tags上的<em> errorKey</em>, <em>errorStyle</em>, <em>errorStyleClass</em> 和 <em>errorStyleId</em> 属性自动高亮错误字段。 </p>
<h4>Readonly / Disabled Forms</h4>
<p>现在可以使用&lt;html:form&gt;  tag的<em>readonly</em> 和<em>disabled</em>属性来禁止或者使全部的字段只读。<br>
    <strong>N.B. </strong><em>readonly</em> 属性只影响&lt;html:text&gt;,  &lt;html:textarea&gt; 和 &lt;html:password&gt; as per the HTML 4 specification。 </p>
<h4>HTML Tag Refactoring</h4>
<p>许多<em>HTML</em>标签都被重构了，以便更易使用。</p>
<ol>
  <li><strong>添加了prepareOtherAttributes()</strong> 方法- 刚好在关闭元素之前调用，提供一个地方来渲染额外的属性。</li>
  <li><em>name</em> 属性渲染如今在<strong>prepareName()</strong> 方法中，以便更易提供定制行为。</li>
  <li><em>value</em> 属性如今在<strong>prepareValue()</strong> 方法中以便更易提供定制行为。</li>
  <li>当渲染一个属性时，这些标签现在使用属性的<em>getter</em> 而不是直接使用实际的属性，这意味着如果你想，比如覆盖TextTag的 <em>styleClass</em> ，那么一个选择是覆盖getStyleClass()方法。</li>
  <li>属性的渲染现在使用一个简单的 <strong>prepareAttribute()</strong> 方法来产生<em>name="attribute"</em> 格式，使多数属性渲染一个一行语句。</li>
</ol>
<h4>Bundle Attribute</h4>
<p><em>bundle</em> 属性被添加到了下列标签：ButtonTag, CancelTag,  CheckboxTag, FileTag, FrameTag, HiddenTag, LinkTag, MultiboxTag, PasswordTag,  RadioTag, ResetTag, SelectTag, SubmitTag, TextTag, TextareaTag。 </p>
<h4>ErrorTag</h4>
<p>现在新增了<strong>header</strong>, <strong>footer</strong>, <strong>prefix</strong>, <strong>suffix</strong><strong>属性。</strong> </p>
<h3>Validator</h3>
<h4>Resource Bundle Support</h4>
<p>Validator 配置文件中(e.g. <em>validation.xml</em>)的&lt;msg&gt; 和 &lt;arg&gt; 元素的<em>bundle</em> 属性现在随同&lt;msg&gt; 的<em>resource</em> 属性一起得到支持。 <br>
    <em>struts-examples</em> webapp 中添加了新的页面来展示对<em>Resource Bundle </em><em>的支持。</em> </p>
<h1>Struts1.2.8</h1>
<h2>主要改变</h2>
<p>Struts 1.2.8 的主要改变是修正了<em>Cross Site Scripting</em> (XSS) 弱点。 </p>
<p>&nbsp;</p>
<img src ="http://www.blogjava.net/SteelHand/aggbug/25731.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/SteelHand/" target="_blank">铁手</a> 2005-12-28 15:41 <a href="http://www.blogjava.net/SteelHand/archive/2005/12/28/25731.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts Classic 的变迁（上），从1.0到1.1</title><link>http://www.blogjava.net/SteelHand/archive/2005/12/28/25728.html</link><dc:creator>铁手</dc:creator><author>铁手</author><pubDate>Wed, 28 Dec 2005 07:23:00 GMT</pubDate><guid>http://www.blogjava.net/SteelHand/archive/2005/12/28/25728.html</guid><wfw:comment>http://www.blogjava.net/SteelHand/comments/25728.html</wfw:comment><comments>http://www.blogjava.net/SteelHand/archive/2005/12/28/25728.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/SteelHand/comments/commentRss/25728.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/SteelHand/services/trackbacks/25728.html</trackback:ping><description><![CDATA[

<u><font color="#ff0000"><i>最近在编写Struts教程的时候，把Struts1.1到1.2的个版本变化总结了一下，希望能够从整体上把握它的变迁脉络，在开发和维护的时候也可以参考参考</i>。</font></u><br><br><br><br>


<h1>Struts1.1的修改</h1>
<h2>新特征</h2>
<h3>引入新的配置DTD</h3>
<p>Struts 1.0 的配置DTD 已经不赞成使用，引入了新的struts-config_1_1.dtd。在Struts 1.1 中，已有的Struts 配置文件可以使用这两个版本的DTD载入。 </p>
<h3>新的Commons 包依赖性</h3>
<p>在Struts中使用了多个Apache Jarkarta commons的组件，而Commons组件并不仅仅可以用来构建Struts应用。在Struts1.1中，所使用的Commons组件已经重构来外部依赖于Jarkarta Commons项目，而不是1.0中的内部版本。 <br>
  下面的Commons包包括了对相应的Struts 1.0 中的类的替代： </p>
<ol>
  <li><strong>BeanUtils </strong>[org.apache.commons.beanutils]： </li>
  <ol>
    <li>org.apache.struts.utils.BeanUtils</li>
    <li>org.apache.struts.utils.ConvertUtils</li>
    <li>org.apache.struts.utils.PropertyUtils.</li>
  </ol>
  <li><strong>Collections </strong>[org.apache.commons.collections]</li>
  <ol>
    <li>org.apache.struts.util.ArrayStack</li>
    <li>org.apache.struts.util.FastArrayList</li>
    <li>org.apache.struts.util.FastHashMap</li>
    <li>org.apache.struts.util.FastTreeMap.</li>
  </ol>
  <li><strong>Digester </strong>[org.apache.commons.digester]</li>
  <ol>
    <li>org.apache.struts.digester.*.</li>
  </ol>
</ol>
<p>下面这几个包现在仍然被Struts框架的各种组件使用： </p>
<ol>
  <li><strong>FileUpload </strong>[org.apache.commons.fileupload]</li>
  <li><strong>Logging </strong>[org.apache.commons.logging]</li>
  <li><strong>Validator </strong>[org.apache.commons.validator]</li>
</ol>
<h3>XML解析器</h3>
<p><strong>另外，</strong>Struts 1.1 需要符合JAXP/1.1 (而不是JAXP/1.0)  API的XML解析器，比如JAXP/1.1 参考实现和Xerces 1.3.1+。 </p>
<h3>源代码</h3>
<p>如果需要从源代码开始构建Struts，请使用Ant  1.4 以上版本。 </p>
<h3>集成Struts Validator</h3>
<p>一个新的Commons Validator组件被集成到Struts 1.1中，包含在新的Validator包中。 </p>
<h3>Tiles </h3>
<p>引入了一个新的JSP模板组装机制Tiles，通过标签库提供集成。 </p>
<h3>Nested </h3>
<p>Nested taglib 绑定到了Struts1.1中，增强了现有Struts标签的功能。 </p>
<h3>新的示例应用</h3>
<p>Struts1.1发布包中包括了针对Validator 和Tiles的新的示例。 </p>
<h3>新的可选组件</h3>
<p>CVS源代码库中新增了一个目录contrib，包含了很有用的，但是没有集成到标准代码基中的扩展。 </p>
<ol>
  <li>Scaffold  – 一个对Commons Scaffold 工具包扩展，旨在提供可重用的构建Web应用的类 </li>
  <li>Struts-EL  – 可选的Struts-EL taglib 使得在Struts 中使用JSTL更加容易。(需要Servlet 2.3 +容器支持)</li>
</ol>
<h3>Action 包的增加</h3>
<p>基本的控制器框架 [org.apache.struts.action]新增了一下特征： </p>
<ol>
  <li>ActionServlet  现在提供了对模块化应用的支持，并且新增了多个扩展点。 </li>
  <li>新增了一个ActionMessages 类，支持ActionErrors功能的一个超集，可以用于通用的消息收集传递，不仅仅针对errors。 </li>
</ol>
<h3>Upload 包</h3>
<p>文件上传类[org.apache.struts.upload]新增了一下特征： </p>
<ol>
  <li>CommonsMultipartRequestHandler：这个新类使用Jakarta Commons FileUpload 包实现了文件上传。这也是Struts的默认文件上传实现。 </li>
</ol>
<h3>Util 包</h3>
<p>工具（utility）类  [org.apache.struts.util]新增了以下特征： </p>
<ol>
  <li>LocalStrings:  修正了与可替换参数相关的消息，以便它不会添加一个外来的无关的字符。 </li>
  <li>LabelValueBean:  一个新类，定义了一个名值对的集合，可以用在&lt;html:options&gt; 和&lt;html:optionsCollection&gt;标签，或者其它地方。 </li>
  <li>MessageResources:  转移包含在特定消息字符串中的单引号。 </li>
  <li>computeParameters:  允许事务令牌是唯一的参数。 </li>
  <li>RequestUtils:  在构建一个查询字符串时，修改来编码一个&amp;号。 </li>
</ol>
<h3>Bean Taglib </h3>
<p><em>struts-bean</em> 标签库[org.apache.struts.taglib.bean]中新增了以下特征： </p>
<ol>
  <li>&lt;bean:write&gt;：加入了format, locale 和  bundle 属性以支持根据用户当前场所进行格式化的功能，格式化来自属性或者来自字符串资源的字符串。 </li>
  <li>&lt;bean:cookie&gt;,  &lt;bean:header&gt;, 或&lt;bean:parameter&gt;：纠正了在标签使用"multiple"属性时，所产生的脚本变量类型。 </li>
  <li>&lt;bean:message&gt;：加入了name, property, 和scope  属性，以便消息资源key 可以动态地从一个bean 或者bean 属性获得。 </li>
</ol>
<h3>HTML Taglib</h3>
<p><em>struts-html</em> [org.apache.struts.taglib.html]加入了如下新特征： </p>
<ol>
  <li>&lt;html:link&gt;:  添加了'action' 属性 </li>
  <li>&lt;html:options&gt;:  如果'property' 属性制定的属性（property）返回null，现在标签将抛出一个错误消息指名实际问题而不是造成NPE。 </li>
  <li>&lt;html:option&gt;  和 &lt;html:options&gt;：添加了'style' 和'styleClass'  属性。 </li>
  <li>&lt;html:optionsCollection&gt;：新标签。提供了一个更清晰的方式来从集合组装HTML options。 </li>
  <li>&lt;bean:message&gt;：添加了'name', 'property' 和'scope'  属性，以便消息资源key 可以动态地从bean获得。 </li>
  <li>&lt;html:messages&gt;：新标签。可以通过新的ActionMessages 类中的一个消息集合进行迭代。 </li>
  <li>ActionForm：现在，此标签在它初始化ActionForm Bean的时候会调用reset() 方法。它也要求被标签所实例化的bean 是ActionForm  的一个子类。 </li>
  <li>&lt;html:image&gt;：添加了'align' attribute。 </li>
  <li>&lt;html:img&gt;：添加了mouse 事件属性('onclick',  'ondblclick', 'onmousedown', 'onmouseup', 'onmouseover', 'onmousemove',  'onmouseout')。 </li>
  <li>SubmitTag,  SelectTag, LinkTag.java, CheckboxTag, ButtonTag, ImageTag, RadioTag, 和TextArea 标签： 添加了indexed 属性。 </li>
</ol>
<h3>Logic Taglib</h3>
<p><em>struts-logic</em> 标签库[org.apache.struts.taglib.logic]加入了如下新特征： </p>
<ol>
  <li>&lt;logic:empty&gt;  和&lt;logic:notEmpty&gt;：新标签。类似于&lt;logic:present&gt; 和&lt;logic:notPresent&gt;，但对空字符串的处理不同。 </li>
</ol>
<h3>Template Taglib </h3>
<p>无变化，但无赞成使用。推荐使用Tiles.<strong> </strong></p>
<h2>运性层面的改变</h2>
<h3>加入了Config Package</h3>
<ol>
  <li>ControllerConfig：添加了inputForward 属性以指示ActionMapping.input是一个forward 而不是URI。 </li>
  <li>ControllerConfig：添加了forwardPattern 和inputPattern  到help 应用面模块的管理页面目录 </li>
  <li>添加了一个新的包以提供更多的灵活性来支持控制器配置和多模块应用的支持。 </li>
</ol>
<h3>Action 包<br></h3>
<p>基本框架(org.apache.struts.action)进行了如下修改或者修正： </p>
<ol>
  <li>Action  类中的所有常数：不赞成使用。提取到新的Globals类中。 </li>
  <li>ActionMapping：如果模块的ControllerConfig bean  [org.apache.struts.config.ControllerConfig]的inputForward  设置为true，input  属性将引用一个ActionForward 而不是模块相对的路径。 </li>
  <li>ActionServlet：添加了convertNull 参数以在组装Form时仿真Struts 1.0 行为。如果设置为true，数值numeric Java  wrapper 类类型 (如java.lang.Integer)  将默认为null (而不是0)。 </li>
  <li>ActionServlet：添加了"config/$foo" 参数，不赞成使用包中的其他参数。 </li>
  <li>ActionForms  和相关类：为了保存资源，现在在响应toString请求的时候使用一个StringBuffer。 </li>
  <li>LookupDispatchAction：添加的新的标准Action，以帮助在国际化的按钮之间进行选择。 </li>
  <li>ActionForm  类：修改来使用ActionServletWrapper 而不是暴露ActionServlet。 </li>
  <li>ActionServletWrapper  类：添加的新类，用于ActionForm，以防止ActionServlet 的公开字符串属性被通过查询字符串改写。 </li>
  <li>Action.MAPPING_KEY的 request 属性： 如果没有指定form bean，无条件地将选择的mapping 传递为请求属性("org.apache.struts.action.mapping.instance")。 </li>
  <li>ActionServlet:避免了在初始化Servlet失败的时候导致的NullPointerException。 </li>
  <li>ActionForm  类：现在是真正的serializable，因为两个非serializable 的实例变量(servlet 和multipartRequestHandler) 已经成为transient。但是，如果你的确需要序列化和解序列化这个实例，你要自己负责重设这两个属性。 </li>
  <li>ActionMessages  和ActionErrors：The initial order a property/key is added in is  now retained.</li>
  <li>processActionForward():  不赞成，推荐使用processForwardConfig</li>
</ol>
<h3>Upload包</h3>文件上传 (package org.apache.struts.upload) [ Upload 应用的一部分]作了如下修改和修正： 
<ol>
  <li>CommonsMultipartRequestHandler：基于Jakarta Commons FileUpload 包的文件上传的新实现。这个新实现如今是默认实现。 </li>
  <li>BufferedMultipartInputStream：解决了丢失字节的问题。 </li>
  <li>ArrayIndexOutOfBoundsException：解决了已知的错误。 </li>
  <li>Multipart  requests：Better reporting for premature closing  of input streams while reading multipart requests.</li>
  <li>新行字符（New line  characters）：解决了上传和新换行字符时导致的文件损坏问题。 </li>
</ol>
<h3>Utility包</h3><p>utilities  (package org.apache.struts.util)发生如下修改和修正： </p>
<ol>
  <li>RequestUtils：添加了对ControllerConfig 的forwardPattern,  pagePattern, 和inputForward 属性的支持。 </li>
  <li>GenericDataSource：不赞成。修改为作为[org.apache.commons.dbpc.BasicDataSource]的一个薄的Wrapper。建议直接使用BasicDataSource 或其它兼容组件。 </li>
  <li>RequestUtils  类：修改为使用ActionServletWrapper而不是暴露 ActionServlet。 </li>
  <li>为getActionErrors 和 getActionMessages 方法添加了错误消息。 </li>
  <li>getActionErrors  和 getActionMessages：添加了根据基于传入的消息关键字从Request范围获取的对象来产生正确的相应对象的方法。 </li>
  <li>ActionErrors  或 ActionMessages：创建一个这种对象的逻辑被移到了RequestUtils中的一个工具方法。.</li>
  <li>JspException  消息：现在在RequestUtils中生成。 </li>
  <li>ConvertUtils.convertCharacter()：现在将检测空字符串并返回默认值。 </li>
</ol>
<h3>Bean Taglib包</h3><em>struts-bean</em> c标签库  [org.apache.struts.taglib.bean]发生了如下修改和修正： 
<ol>
  <li>&lt;html:errors&gt;：当指定了属性标签时，如果指定的属性没有发生错误，则不会输出错误。而前面的错误将总是会被输出。未来的增强版本将包括额外的属性来关闭header 或  footer。 </li>
  <li>将helper 方法从"private"改为  "protected" 。 </li>
</ol>
<h3>HTML Taglib 包</h3>
<p><em>struts-html</em> 标签库(package  org.apache.struts.taglib.html)发生了如下修改和修正： </p>
<ol>
  <li>FormTag：修正为，当指定了action mapping的名称时，要排除查询字符串。 </li>
  <li>ImgTag：如果只有一个参数，能正确地URLEncode 查询字符串参数。 </li>
  <li>MultiboxTag.doAfterBody():：修正为返回SKIP_BODY 而不是SKIP_PAGE。 </li>
  <li>Errortag：不赞成使用defaultLocale方法。 </li>
</ol>
<h3>Documentation 示例应用</h3>
<p>Struts  Documentation 应用(对应Struts  网站的内容)发生了如下修改： </p>
<ol>
  <li>重新组织了资源到单独的页面中。 </li>
  <li>在Tag Developers Guide中，添加了更详细的文件上传要求。 </li>
  <li>在Building View  Components，澄清了额外的i18n 支持可以由浏览器提供，并且超出了框架的范围。 </li>
  <li>在Building Controller  Components一节，文档 'validating' init-param，添加了各种参数的默认值，澄清了某些web.xml 设置不是Struts特定的。 </li>
  <li>Tag  library 文档：移到User's Guide下。 </li>
</ol>
<h3>MailReader 示例应用</h3>
<p>Struts  MailReader Example Application 发生如下修改和修正： </p>
<ol>
  <li>添加了应用资源的 Russian 和Japanese 翻译，并且设置JSP的字符集为"UTF-8"以便其可以显示English 或Japanese。 </li>
  <li>在Struts配置文件中交换了Edit mappings的"attribute"  属性的"name" 。 </li>
  <li>删除了对"tour"文档中的保存的数据库数据的引用，因为这个功能已经被删除。 </li>
</ol>
<h3>Exercise Taglib 示例应用</h3>
<p>Struts Exercise  Taglib Example Application 发生了如下修改和修正： </p>
<ol>
  <li>添加了针对使用了"action"属性的&lt;html:link&gt; 的test  case 。 </li>
  <li>添加了针对基于保存在page上下文中的集合使用&lt;html:options&gt; 和 &lt;html:optionsCollection&gt;的&lt;html:select&gt; 的test  case。 </li>
</ol>
<h2>不同之处</h2>
<p>这里列出1.0到1.1中新增的类和已经不赞成使用的类： </p>
<h3>1.0中不赞成使用，1.1中已经删除的类。</h3>
<ol>
  <li>删除：org.apache.struts.utils.BeanUtils,  org.apache.struts.utils.ConvertUtils, and org.apache.struts.utils.PropertyUtils  – 替换为org.apache.commons.beanutils </li>
  <li>删除：org.apache.struts.util.ArrayStack,  org.apache.struts.util.FastArrayList, org.apache.struts.util.FastHashMap,  org.apache.struts.util.FastTreeMap – 替换为org.apache.commons.collections </li>
  <li>删除：  org.apache.struts.digester.* - 替换为org.apache.commons.digester </li>
  <li>删除：struts-config.dtd –  替换为struts-config_1_1.dtd.</li>
  <li>删除：omnibus  "struts" taglib 和其相应的TLD – 替换为bean, logic, 和html  taglib。 </li>
  <li>删除："form"  taglib 和其相应的TLD – 替换为html  taglib.</li>
</ol>
<h3>Struts 1.1新增的包</h3>
<ol>
  <li>config</li>
  <li>taglib.nested</li>
  <li>taglib.nested.bean</li>
  <li>taglib.nested.html</li>
  <li>taglib.nested.logic</li>
  <li>validator</li>
</ol>
<h3>Struts 1.1新增的类</h3>
<p><strong>action</strong></p>
<ol>
  <li>ActionMessage</li>
  <li>ActionMessages</li>
  <li>DynaActionForm</li>
  <li>DynaActionFormClass</li>
  <li>ExceptionHandler</li>
  <li>RequestProcessor</li>
</ol>
<p><strong>actions</strong></p>
<ol>
  <li>LookupDispatchAction</li>
</ol>
<p><strong>taglib.html</strong></p>
<ol>
  <li>FrameTag</li>
  <li>JavascriptValidatorTag</li>
  <li>MessagesTag</li>
  <li>OptionsCollectionTag</li>
</ol>
<p><strong>taglib.logic</strong></p>
<ol>
  <li>EmptTag</li>
  <li>MessagesNotPresentTag</li>
  <li>MessagesPresentTag</li>
  <li>NotEmptyTag</li>
</ol>
<p><strong>upload</strong></p>
<ol>
  <li>CommonsMultipartRequestHandler</li>
</ol>
<p><strong>util</strong></p>
<ol>
  <li>LabelValueBean</li>
</ol>
<h3>Struts 1.1中新增的类成员</h3>
<p><strong>action.Action</strong></p>
<ol>
  <li>ACTION_SERVLET_KEY</li>
  <li>APPLICATION_KEY</li>
  <li>MESSAGE_KEY</li>
  <li>PLUG_INS_KEY</li>
  <li>REQUEST_PROCESSOR_KEY</li>
  <li>execute</li>
  <li>getResources(javax.servlet.http.HttpServletRequest)</li>
  <li>saveMessages</li>
</ol>
<p><strong>action.A<u>ctionServlet</u></strong></p>
<ol>
  <li>configDigester</li>
  <li>convertHack</li>
  <li>log</li>
  <li>processor</li>
  <li>getInternal</li>
  <li>destroyApplications</li>
  <li>destroyConfigDigester</li>
  <li>getApplicationConfig</li>
  <li>getRequestProcessor</li>
  <li>initApplicationConfig</li>
  <li>initApplicationDataSources</li>
  <li>initApplicationPlugIns</li>
  <li>initApplicationMessageResources</li>
  <li>initConfigDigester</li>
  <li>methods  created for backward-compatiblity only </li>
  <ol>
    <li>defaultControllerConfig</li>
    <li>defaultFormBeansConfig</li>
    <li>defaultForwardsConfig</li>
    <li>defaultMappingsConfig</li>
    <li>defaultMessageResourcesConfig</li>
  </ol>
</ol>
<p><strong><u>taglib.html.BaseHandlerTag</u></strong><strong> </strong></p>
<ol>
  <li>indexed</li>
  <li>setIndexed</li>
  <li>getIndexed</li>
</ol>
<h3>Struts 1.0 到Struts 1.1不赞成的类</h3>
<p><strong>action</strong></p>
<ol>
  <li>ActionException</li>
  <li>ActionFormBeans</li>
  <li>ActionForwards</li>
  <li>ActionMappings</li>
</ol>
<h3>Struts 1.0 不赞成的类成员</h3>
<p><strong>action.Action</strong></p>
<ol>
  <li>FORM_BEANS_KEY</li>
  <li>FORWARDS_KEY</li>
  <li>MAPPINGS_KEY</li>
  <li>getResources()</li>
  <li>perform</li>
</ol>
<p><strong>ActionServlet</strong></p>
<ol>
  <li>findDataSource</li>
  <li>findFormBean</li>
  <li>findForward</li>
  <li>findMapping</li>
  <li>initDataSources</li>
  <li>methods  created for backward-compatiblity only </li>
  <ol>
    <li>defaultControllerConfig</li>
    <li>defaultFormBeansConfig</li>
    <li>defaultForwardsConfig</li>
    <li>defaultMappingsConfig</li>
    <li>defaultMessageResourcesConfig</li>
  </ol>
</ol>
<img src ="http://www.blogjava.net/SteelHand/aggbug/25728.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/SteelHand/" target="_blank">铁手</a> 2005-12-28 15:23 <a href="http://www.blogjava.net/SteelHand/archive/2005/12/28/25728.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Struts秘籍之第2段：第3.7式： 动态产生JavaScript</title><link>http://www.blogjava.net/SteelHand/archive/2005/06/07/5654.html</link><dc:creator>铁手</dc:creator><author>铁手</author><pubDate>Tue, 07 Jun 2005 04:32:00 GMT</pubDate><guid>http://www.blogjava.net/SteelHand/archive/2005/06/07/5654.html</guid><wfw:comment>http://www.blogjava.net/SteelHand/comments/5654.html</wfw:comment><comments>http://www.blogjava.net/SteelHand/archive/2005/06/07/5654.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/SteelHand/comments/commentRss/5654.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/SteelHand/services/trackbacks/5654.html</trackback:ping><description><![CDATA[<H3>第3.7式. 动态产生JavaScript</H3>
<H4><A name=jakartastrutsckbk-CHP-3-SECT-7.1></A>问题</H4>
<P>你想要根据从应用模型获得的数据动态产生JavaScript。</P>
<H4><A name=jakartastrutsckbk-CHP-3-SECT-7.2></A>动作要领</H4>
<P>使用Struts 标签在你想要包含在HTML中的JavaScript 代码中渲染数据：<BR><BR></P>
<DIV style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid">
<DIV><IMG id=Codehighlighter1_30_139_Open_Image onclick="this.style.display='none'; Codehighlighter1_30_139_Open_Text.style.display='none'; Codehighlighter1_30_139_Closed_Image.style.display='inline'; Codehighlighter1_30_139_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_30_139_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_30_139_Closed_Text.style.display='none'; Codehighlighter1_30_139_Open_Image.style.display='inline'; Codehighlighter1_30_139_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align=top><SPAN style="COLOR: #0000ff">&lt;</SPAN><SPAN style="COLOR: #800000">script&nbsp;</SPAN><SPAN style="COLOR: #ff0000">language</SPAN><SPAN style="COLOR: #0000ff">="JavaScript"</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN id=Codehighlighter1_30_139_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_30_139_Open_Text><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><BR><IMG id=Codehighlighter1_60_138_Open_Image onclick="this.style.display='none'; Codehighlighter1_60_138_Open_Text.style.display='none'; Codehighlighter1_60_138_Closed_Image.style.display='inline'; Codehighlighter1_60_138_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><IMG id=Codehighlighter1_60_138_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_60_138_Closed_Text.style.display='none'; Codehighlighter1_60_138_Open_Image.style.display='inline'; Codehighlighter1_60_138_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">function</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;showMessage(&nbsp;&nbsp;)&nbsp;</SPAN><SPAN id=Codehighlighter1_60_138_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.blogjava.net/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_60_138_Open_Text><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&nbsp;</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Hello,&nbsp;&lt;bean:write&nbsp;name='myForm'&nbsp;property='name'/&gt;!</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&nbsp;);<BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>&nbsp;&nbsp;&nbsp;&nbsp;}</SPAN></SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></SPAN><SPAN style="COLOR: #0000ff">&lt;/</SPAN><SPAN style="COLOR: #800000">script</SPAN><SPAN style="COLOR: #0000ff">&gt;</SPAN><SPAN style="COLOR: #000000"><BR><IMG src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align=top></SPAN></DIV></DIV>
<P><A name=jakartastrutsckbk-CHP-3-SECT-7.3></A>&nbsp;</P>
<H4>动作变化</H4>
<P>上述方案产生了一个JavaScript 函数，弹出一个消息框，消息文本为"Hello, name!" <EM>name</EM>的值是使用<A name=jakartastrutsckbk-CHP-3-ITERM-1545></A><A name=jakartastrutsckbk-CHP-3-ITERM-1546></A>bean:write标签产生的。此方案展示了使用Struts 标签创建JavaScript 和它们创建HTML一样的容易。</P>
<P>JSTL也可以按这种方式使用。</P>
<P>虽然这种方法很明显，但是很奇怪很多人都在问这个问题。通常问题还可能是："我如何才能从Struts中调用HTML中的<A name=jakartastrutsckbk-CHP-3-ITERM-1547></A>JavaScript 函数？" 技术上讲，你并不能从Struts调用一个HTML页面中的JavaScript 函数。Struts 和JSP 技术都运行在服务器端。相反，JavaScript确是在客户端的浏览器中处理的。但是，通过这里所述的动态产生JS的能力，基本上还是相当于所需的这个行为。</P>
<P>这个方法的一个重要基础是JSP的转换过程。JSP 页面由JSP 声明，标准JSP 标签 (比如jsp:useBean), 定制JSP 标签(比如Struts 和JSTP 标签), 运行是表达式，以及脚本小程序（scriptlets）组成。除此之外的其他东西都是模板文本（<A name=jakartastrutsckbk-CHP-3-ITERM-1548></A><A name=jakartastrutsckbk-CHP-3-ITERM-1549></A><EM>template text</EM><EM>）。</EM>模板文本可以是任何不会被JSP转换处理的内容。人们通常会认为模板文本就是HTML 标记，但是它其实是JavaScript 或者其他非JSP 处理的文本。JSP 翻译器并不关心模板文本采用何种形式。因此，你可以象在HTML元素中产生文本一样容易地在JavaScript 函数中产生文本。</P>
<P>如果你使用JSP 来产生良构的（well-formed）<A name=jakartastrutsckbk-CHP-3-ITERM-1550></A>XHTML, 那么动态JavaScript 模版文本必须使用jsp:text元素和CDATA section的方式结合来指定。具体信息参见Hans Bergsten的ONJava 文章：<A href="http://www.onjava.com/pub/a/onjava/2004/04/21/JSP2part3.html">http://www.onjava.com/pub/a/onjava/2004/04/21/JSP2part3.html</A>。</P>
<P>这里的例子仅仅列出了很简单的使用场景。如果要访问的模型数据需要使用复杂的JavaScript数据结构，比如，数组，你可以使用迭代标签，比如<A name=jakartastrutsckbk-CHP-3-ITERM-1552></A><A name=jakartastrutsckbk-CHP-3-ITERM-1553></A>logic:iterate和<A name=jakartastrutsckbk-CHP-3-ITERM-1554></A><A name=jakartastrutsckbk-CHP-3-ITERM-1555></A>c:forEach来组装这些结构。</P>
<H4><A name=jakartastrutsckbk-CHP-3-SECT-7.4></A>相关动作</H4>
<P>下一动3.8或会使用迭代标签来产生客户端的JavaScript 数组。</P><img src ="http://www.blogjava.net/SteelHand/aggbug/5654.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/SteelHand/" target="_blank">铁手</a> 2005-06-07 12:32 <a href="http://www.blogjava.net/SteelHand/archive/2005/06/07/5654.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>J2EE vs .NET: 应用开发何去何从？ 元框架？</title><link>http://www.blogjava.net/SteelHand/archive/2005/06/03/5522.html</link><dc:creator>铁手</dc:creator><author>铁手</author><pubDate>Fri, 03 Jun 2005 03:50:00 GMT</pubDate><guid>http://www.blogjava.net/SteelHand/archive/2005/06/03/5522.html</guid><wfw:comment>http://www.blogjava.net/SteelHand/comments/5522.html</wfw:comment><comments>http://www.blogjava.net/SteelHand/archive/2005/06/03/5522.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/SteelHand/comments/commentRss/5522.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/SteelHand/services/trackbacks/5522.html</trackback:ping><description><![CDATA[<P>JDJ上面有一篇<!--StartFragment --> <A href="http://java.sys-con.com/author/5718Mills.htm">Duncan Mills</A> 的文章，论述了框架技术的下一个发展，那就是Java世界需要一个元框架（Meta-Framework）。原文地址见：<A href="http://java.sys-con.com/read/49198.htm"><BR>http://java.sys-con.com/read/49198.htm</A><BR><BR>他认为，.NET之所以也很成功并且吸引很多人，总体来说，.net的技术成本要低的多（当然商业成本不低），这是因为.Net环境下有一个集成的统一框架，而java世界，则疲于整合各种JSR，各种技术，各种实现和各种框架。从Struts，WebWork, Tapstry, Hibernate, Spring, Keel....框架层出不穷。我们比较、学习、整合.....累啊。<BR>&nbsp;<BR>因此，一个元框架的出现，应该符合以下的特征：<BR><!--StartFragment -->&nbsp;</P>
<UL>
<LI><STRONG>范围广阔（Broad Scope）</STRONG> 框架应该涵盖从UI，到页面流控制器，到与多个底层服务 provider的集成，包括EJB, Web services, POJO...。 </LI>
<LI><STRONG>并存（Coexistence）</STRONG> - 框架不能实现所有需要的功能，但是能够提供可插入的集成点。</LI>
<LI>抽象（<STRONG><EM>Abstraction）</EM> </STRONG>-足够抽象，并且你可以选择。以便能够对某些组件的具体实现进行替换。</LI>
<LI><STRONG><EM>呵呵， 还有</EM>长寿（Longevity</STRONG></LI>
<LI><STRONG>工具支持（<EM>Tooling）</EM></STRONG></LI></UL>
<P><FONT size=3><STRONG>这其中最流行的是什么？POJO，IoC/DIP？想想， 重量级的EJB3.0能否重整雄风？而轻量的Spring已经繁花似锦。另外， JSF整合了JSP, JSTL和Portel API之后，能否成为前端的标准？毕竟标准的事件模型还是令人鼓舞的，而且，浏览器的兼容问题也好解决一些。这些都有可能成为metaFramework的候选。<BR>Oracle的ADF已经从ADF UIX迁移到JSF，这下厉害了。ADF(JSF+bizmodule)+TOPLINK， 是否有能够和 SPring + Hibernate有的一拼呢？<BR><BR>另外，Keel是否显得比较乱？<BR>而 NetKernel 呢？<BR></STRONG></FONT></P><img src ="http://www.blogjava.net/SteelHand/aggbug/5522.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/SteelHand/" target="_blank">铁手</a> 2005-06-03 11:50 <a href="http://www.blogjava.net/SteelHand/archive/2005/06/03/5522.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>