﻿<?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-路过白云-文章分类-Java Web技术</title><link>http://www.blogjava.net/oxl/category/9291.html</link><description>专注于Web应用，专注于Unix网络管理。</description><language>zh-cn</language><lastBuildDate>Fri, 02 Mar 2007 07:12:12 GMT</lastBuildDate><pubDate>Fri, 02 Mar 2007 07:12:12 GMT</pubDate><ttl>60</ttl><item><title>WebWork中利用ActionContext得到Parameter,moxie的教程有误!</title><link>http://www.blogjava.net/oxl/articles/44560.html</link><dc:creator>oxl</dc:creator><author>oxl</author><pubDate>Thu, 04 May 2006 14:27:00 GMT</pubDate><guid>http://www.blogjava.net/oxl/articles/44560.html</guid><wfw:comment>http://www.blogjava.net/oxl/comments/44560.html</wfw:comment><comments>http://www.blogjava.net/oxl/articles/44560.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/oxl/comments/commentRss/44560.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/oxl/services/trackbacks/44560.html</trackback:ping><description><![CDATA[
		<font face="Courier New" size="2">看下面这段代码:<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">ActionContext context </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ActionContext.getContext();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />Map params </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> context.getParameters();<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />String username </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> (String) params.get(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">username</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);</span></div><p>这会抛出一个一异常,因为在params.get("username")返回的是一个字符串数组,所以不能这样转换.<br /><br />正确的做法是:<br />String username = ((String[])params.get("username"))[0];<br /><br /><br /><br /><br /><br /><br /><br /></p></font>
<img src ="http://www.blogjava.net/oxl/aggbug/44560.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/oxl/" target="_blank">oxl</a> 2006-05-04 22:27 <a href="http://www.blogjava.net/oxl/articles/44560.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WebWork 2.2 学习笔记(二) </title><link>http://www.blogjava.net/oxl/articles/44490.html</link><dc:creator>oxl</dc:creator><author>oxl</author><pubDate>Wed, 03 May 2006 17:02:00 GMT</pubDate><guid>http://www.blogjava.net/oxl/articles/44490.html</guid><wfw:comment>http://www.blogjava.net/oxl/comments/44490.html</wfw:comment><comments>http://www.blogjava.net/oxl/articles/44490.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/oxl/comments/commentRss/44490.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/oxl/services/trackbacks/44490.html</trackback:ping><description><![CDATA[
		<font face="Courier New" size="2">逐个讲解WebWork中的一些配置文件的基本用法:<br />----------------------------------------------------------------------------<br />web.xml<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">webwork</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">com.opensymphony.webwork.dispatcher.FilterDispatcher</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-class</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-mapping</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">webwork</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/*</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">url-pattern</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-mapping</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">listener</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">listener-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">org.springframework.web.context.ContextLoaderListener</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">listener-class</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">listener</span><span style="COLOR: #0000ff">&gt;</span></div><br />这里使用了一个Filter来对所有的url进行过滤,而只有在webwork.properties中的设定的webwork.action.extension作为扩展名才会被解悉为一个action.<br />而定义了一个监听器主要是用Spring的监听Web容器里的变化,这里主要是用于Spring作为WebWork的IoC.如果想让Spring有多个context配置文件,那就可加入下面的代码:<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">context-param</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">param-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">contextConfigLocation</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">param-name</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">param-value</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">param-value</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">context-param</span><span style="COLOR: #0000ff">&gt;</span></div>*param-value是用逗号隔开的配置文件列表,记住是用相对于Web应用的路径.<br /><br />这里如果想定义一个WebWork tag,那么就可加入以下的代码:<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">taglib</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">taglib-uri</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">webwork</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">taglib-uri</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">taglib-location</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/WEB-INF/lib/webworkxx.jar</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">taglib-location</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">taglib</span><span style="COLOR: #0000ff">&gt;</span></div>这样,在视图jsp文件中引用WebWork tag时,只须要把uri="webwork"就行了,而不用写成这样uri="/webwork".<br /><br />--------------------------------------------------------------------------------<br />在说xwork.xml之前,我们先了解webwork-default.xml文件,这个文件是由webwork.jar文件里有的,存放在classpath中,所以我们不用创建这个文件,因为每次运行webwork应用时,webwork都会自动去classpath查找这个文件.这个文件预先设置好了一些默认的参数,比如result type, interceptors等,可以说是我们xwork.xml中的默认值,同时也为我们的xwork.xml提供好了很多工具,比如params拦截器就是最典型的一个.<br /><br />在编写xwork.xml时,我们一般都要导入这个webwork-default.xml文件,代码如下:<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">include </span><span style="COLOR: #ff0000">file</span><span style="COLOR: #0000ff">="webwork-default.xml"</span><span style="COLOR: #0000ff">/&gt;</span></div><br />具体的xwork.xml配置,由以后的学习中给出...(呵....我也还不清楚,没有实践过呢..)<br />xwork.xml文件必须放在/WEB-INF/classes/中.<br /><br />--------------------------------------------------------------------------------<br /><br />下面说一下webwork.properties文件,这个文件是配置webwork行为特性的文件,他可以改变webwork的扩展名,以及编码等.这个文件的详细说明可以参考官方的文档:<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## Webwork default properties<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />###(can be overridden by a webwork.properties file in the root of the classpath)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />###<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### Specifies the Configuration used to configure webwork<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### one could extend com.opensymphony.webwork.config.Configuration<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### to build one's customize way of getting the configurations parameters into webwork<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /># webwork.configuration=com.opensymphony.webwork.config.DefaultConfiguration<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### This can be used to set your default locale and encoding scheme<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /># webwork.locale=en_US</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">i18n</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">encoding</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">UTF</span><span style="COLOR: #000000">-</span><span style="COLOR: #800000">8</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## if specified, the default object factory can be overridden here<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### Note: short-hand notation is supported in some cases, such as "spring"<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />###       Alternatively, you can provide a com.opensymphony.xwork.ObjectFactory subclass name here<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /># webwork.objectFactory = spring<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### specifies the autoWiring logic when using the SpringObjectFactory.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### valid values are: name, type, auto, and constructor (name is the default)</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">objectFactory</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">spring</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">autoWire </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> name<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## Parser to handle HTTP POST requests, encoded using the MIME-type multipart/form-data<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /># webwork.multipart.parser=cos<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /># webwork.multipart.parser=pell</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">multipart</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">parser</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">jakarta<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000"> uses javax.servlet.context.tempdir by default</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">multipart</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">saveDir</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">multipart</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">maxSize</span><span style="COLOR: #000000">=</span><span style="COLOR: #800000">2097152</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## Load custom property files (does not override webwork.properties!)<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /># webwork.custom.properties=application,com/webwork/extension/custom<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### How request URLs are mapped to and from actions</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">mapper</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">class</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">com</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">opensymphony</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">dispatcher</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">mapper</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">DefaultActionMapper<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## Used by the DefaultActionMapper</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">action</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">extension</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">action<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## use alternative syntax that requires %{} in most places<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### to evaluate expressions for String attributes for tags</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">tag</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">altSyntax</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">true<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## when set to true, WebWork will act much more friendly for developers. This<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### includes:<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### - webwork.i18n.reload = true<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### - webwork.configuration.xml.reload = true<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### - raising various debug or ignorable problems to errors<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />###   For example: normally a request to foo.action?someUnknownField=true should<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />###                be ignored (given that any value can come from the web and it<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />###                should not be trusted). However, during development, it may be<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />###                useful to know when these errors are happening and be told of<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />###                them right away.</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">devMode </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> false<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## when set to true, resource bundles will be reloaded on _every_ request.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### this is good during development, but should never be used in production</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">i18n</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">reload</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">false<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## Standard UI theme<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### Change this to reflect which path should be used for JSP control tag templates by default</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">ui</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">theme</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">xhtml<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">ui</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">templateDir</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">template<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">sets the default template type. Either ftl, vm, or jsp</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">ui</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">templateSuffix</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">ftl<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## Configuration reloading<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### This will cause the configuration to reload xwork.xml when it is changed</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">configuration</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">xml</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">reload</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">false<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## Location of velocity.properties file.  defaults to velocity.properties<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /># webwork.velocity.configfile = velocity.properties<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### Comma separated list of VelocityContext classnames to chain to the WebWorkVelocityContext<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /># webwork.velocity.contexts =<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### used to build URLs, such as the UrlTag</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">url</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">http</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">port </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">80</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">url</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">https</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">port </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #800000">443</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## Load custom default resource bundles<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /># webwork.custom.i18n.resources=testmessages,testmessages2<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### workaround for some app servers that don't handle HttpServletRequest.getParameterMap()<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### often used for WebLogic, Orion, and OC4J</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">dispatcher</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">parametersWorkaround </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> false<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #008000">#</span><span style="COLOR: #008000">## configure the Freemarker Manager class to be used<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### Allows user to plug-in customised Freemarker Manager if necessary<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### MUST extends off com.opensymphony.webwork.views.freemarker.FreemarkerManager<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />#webwork.freemarker.manager.classname=com.opensymphony.webwork.views.freemarker.FreemarkerManager<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />### See the WebWorkBeanWrapper javadocs for more information</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #000000">webwork</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">freemarker</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">wrapper</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">altMap</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">true</span></div><br />好,大至上已经清楚了这些文件的大至用途,下一步,弄清xwork的配置.<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></font>
<img src ="http://www.blogjava.net/oxl/aggbug/44490.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/oxl/" target="_blank">oxl</a> 2006-05-04 01:02 <a href="http://www.blogjava.net/oxl/articles/44490.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WebWork 2.2 学习笔记(一)</title><link>http://www.blogjava.net/oxl/articles/44272.html</link><dc:creator>oxl</dc:creator><author>oxl</author><pubDate>Mon, 01 May 2006 06:33:00 GMT</pubDate><guid>http://www.blogjava.net/oxl/articles/44272.html</guid><wfw:comment>http://www.blogjava.net/oxl/comments/44272.html</wfw:comment><comments>http://www.blogjava.net/oxl/articles/44272.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/oxl/comments/commentRss/44272.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/oxl/services/trackbacks/44272.html</trackback:ping><description><![CDATA[
		<font face="Courier New" size="2">今天开始学习WebWork，呵……结合《WebWork教程－0.90版》和Webwork官方的教程来学习。<br /><br />WebWork2.2和WebWork2.1在配置上有一些区别，现在把WebWork2.2的一些配置放进来。<br /><br />web.xml<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml version="1.0" encoding="UTF-8"</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">web-app </span><span style="COLOR: #ff0000">version</span><span style="COLOR: #0000ff">="2.4"</span><span style="COLOR: #ff0000"> xmlns</span><span style="COLOR: #0000ff">="http://java.sun.com/xml/ns/j2ee"</span><span style="COLOR: #ff0000"> xmlns:xsi</span><span style="COLOR: #0000ff">="http://www.w3.org/2001/XMLSchema-instance"</span><span style="COLOR: #ff0000"> xsi:schemaLocation</span><span style="COLOR: #0000ff">="http://java.sun.com/xml/ns/j2ee <br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">webwork</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">com.opensymphony.webwork.dispatcher.FilterDispatcher</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-class</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-mapping</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">webwork</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/*</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">url-pattern</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">listener</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">listener-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">org.springframework.web.context.ContextLoaderListener</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">listener-class</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">listener</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">web-app</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><br />xwork.xml<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml version="1.0" encoding="UTF-8"</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><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.1.1//EN"<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />"http://www.opensymphony.com/xwork/xwork-1.1.1.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">xwork</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><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000"> Include webwork defaults (from WebWork JAR). </span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">include </span><span style="COLOR: #ff0000">file</span><span style="COLOR: #0000ff">="webwork-default.xml"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    </span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000"> Configuration for the default package. </span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />   </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="default"</span><span style="COLOR: #ff0000"> extends</span><span style="COLOR: #0000ff">="webwork-default"</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><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000"> Include webwork defaults (from WebWork JAR). </span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />     </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">default-interceptor-ref </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="completeStack"</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />      </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="helloWorld"</span><span style="COLOR: #ff0000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />         class</span><span style="COLOR: #0000ff">="org.javadream.webwork.ch01.HelloWorld"</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="success"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">hello.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">xwork</span><span style="COLOR: #0000ff">&gt;</span></div><br /><br />webwork.properties<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />webwork.locale</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">zh_CN<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />webwork.i18n.encoding</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">GB2312<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />webwork.objectFactory</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">spring</span></div><br />这里中文有问题，必须要在webwork.properties中进入设置.webwork.objectFactory=spring是用spring作为默认的IoC容器。<br /><br /><br />编写一个Action:<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000"> org.javadream.webwork.ch01;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> com.opensymphony.xwork.Action;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> java.text.DateFormat;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> java.util.</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_168_495_Open_Image" onclick="this.style.display='none'; Codehighlighter1_168_495_Open_Text.style.display='none'; Codehighlighter1_168_495_Closed_Image.style.display='inline'; Codehighlighter1_168_495_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_168_495_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_168_495_Closed_Text.style.display='none'; Codehighlighter1_168_495_Open_Image.style.display='inline'; Codehighlighter1_168_495_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> HelloWorld </span><span style="COLOR: #0000ff">implements</span><span style="COLOR: #000000"> Action </span><span id="Codehighlighter1_168_495_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_168_495_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> String message;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_220_439_Open_Image" onclick="this.style.display='none'; Codehighlighter1_220_439_Open_Text.style.display='none'; Codehighlighter1_220_439_Closed_Image.style.display='inline'; Codehighlighter1_220_439_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_220_439_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_220_439_Closed_Text.style.display='none'; Codehighlighter1_220_439_Open_Image.style.display='inline'; Codehighlighter1_220_439_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> String execute() </span><span id="Codehighlighter1_220_439_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_220_439_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   message </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Hello, WebWorld!,你好,Web世界\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   message </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">The time is:\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   message </span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000"> DateFormat.getDateInstance().format(</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Date());;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   <br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">message = message.replaceAll("\n", "&lt;br&gt;");</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> SUCCESS;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span></span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img id="Codehighlighter1_470_492_Open_Image" onclick="this.style.display='none'; Codehighlighter1_470_492_Open_Text.style.display='none'; Codehighlighter1_470_492_Closed_Image.style.display='inline'; Codehighlighter1_470_492_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_470_492_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_470_492_Closed_Text.style.display='none'; Codehighlighter1_470_492_Open_Image.style.display='inline'; Codehighlighter1_470_492_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> String getMessage() </span><span id="Codehighlighter1_470_492_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_470_492_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />   </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> message;<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /> }</span></span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><br /><br />编写一个视图jsp文件:<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img id="Codehighlighter1_2_85_Open_Image" onclick="this.style.display='none'; Codehighlighter1_2_85_Open_Text.style.display='none'; Codehighlighter1_2_85_Closed_Image.style.display='inline'; Codehighlighter1_2_85_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_2_85_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_2_85_Closed_Text.style.display='none'; Codehighlighter1_2_85_Open_Image.style.display='inline'; Codehighlighter1_2_85_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_2_85_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"></span><span id="Codehighlighter1_2_85_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ page language</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">java</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> contentType</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">text/html; charset=gb2312</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> pageEncoding</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">gb2312</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_91_125_Open_Image" onclick="this.style.display='none'; Codehighlighter1_91_125_Open_Text.style.display='none'; Codehighlighter1_91_125_Closed_Image.style.display='inline'; Codehighlighter1_91_125_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_91_125_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_91_125_Closed_Text.style.display='none'; Codehighlighter1_91_125_Open_Image.style.display='inline'; Codehighlighter1_91_125_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_91_125_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"></span><span id="Codehighlighter1_91_125_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ taglib prefix</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">ww</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> uri</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">/webwork</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Hello Page</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        The message generated by my first action is:<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br</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><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">font </span><span style="COLOR: #ff0000">color</span><span style="COLOR: #0000ff">="red"</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">ww:property </span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="message"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">font</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</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><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div><br />这里要注意，&lt;%@ taglib prefix="ww" uri="/webwork"%&gt;必须要用uri="/webwork"，因为要让他在webwork.jar中查找webwork.tld，因为我们在web.xml并没有定义这个"webwork"这个uri。<br /><br /></font>
<img src ="http://www.blogjava.net/oxl/aggbug/44272.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/oxl/" target="_blank">oxl</a> 2006-05-01 14:33 <a href="http://www.blogjava.net/oxl/articles/44272.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于文件上传的问题,利用适配器模式统一调用接口.</title><link>http://www.blogjava.net/oxl/articles/43669.html</link><dc:creator>oxl</dc:creator><author>oxl</author><pubDate>Thu, 27 Apr 2006 14:41:00 GMT</pubDate><guid>http://www.blogjava.net/oxl/articles/43669.html</guid><wfw:comment>http://www.blogjava.net/oxl/comments/43669.html</wfw:comment><comments>http://www.blogjava.net/oxl/articles/43669.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/oxl/comments/commentRss/43669.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/oxl/services/trackbacks/43669.html</trackback:ping><description><![CDATA[
		<p>
				<font face="Courier New" size="2">关于文件上传的问题:<br />Java Servlet没有从根本上支持网络文件上传,这是一个极不好的也极不爽的事情.<br />从而就延生了commonsUpload和cos这些东东类库,呵.....还算好,也好用,不过没仔细去研究他们的实现代码,用起来总是心大心小的.<br /><br />也正因为这样多的第三方类库,大家的接口都不同,从而也就出现了让Service层无所适从的感觉.因为不论是从Struts还是从WebWork或者从最简单的cos这些类库得到的接口都是一种具体实现,没有统一的接口,如果Service层与某一种具体实现相关联,则必然与这种具体实现的框架或者类库硬编码绑定,以后就不好用其它类库了,这是不好的设计,真的,一点灵活度都没有.<br /><br />能不能这样呢?在Service定义一个UploadFile接口,所有Service层接受的只是UploadFile的实现类的实例,从而统一了所有Service的调用,而且也使Service可以在各种MVC或者第三方类库中迁移.<br /><br />这里用到了一个设计模式:适配器模式.<br /><br />代码如下: <br /></font>
		</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #0000ff">package</span>
						</font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">org.springstudy.ch03;<br /><br /></span>
								<span style="COLOR: #0000ff">import</span>
						</font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">java.io.InputStream;<br /></span>
								<span style="COLOR: #0000ff">import</span>
						</font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">java.io.File;<br /><br /></span>
								<span style="COLOR: #0000ff">public</span>
								<span style="COLOR: #0000ff">interface</span>
						</font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">UploadFile {<br />    </span>
								<span style="COLOR: #0000ff">public</span>
								<span style="COLOR: #0000ff">byte</span>
						</font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">[] getBytes();<br />    </span>
								<span style="COLOR: #0000ff">public</span>
						</font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">String getContentType();<br />    </span>
								<span style="COLOR: #0000ff">public</span>
						</font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">InputStream getInputStream();<br />    </span>
								<span style="COLOR: #0000ff">public</span>
						</font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">String getName();<br />    </span>
								<span style="COLOR: #0000ff">public</span>
						</font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">String getOriginalFilename();<br />    </span>
								<span style="COLOR: #0000ff">public</span> <span style="COLOR: #0000ff">long</span></font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">getSize();<br />    </span>
								<span style="COLOR: #0000ff">public</span> <span style="COLOR: #0000ff">boolean</span></font>
				</font>
				<font size="2">
						<font face="Courier New">
								<span style="COLOR: #000000">isEmpty();<br />    </span>
								<span style="COLOR: #0000ff">public</span> <span style="COLOR: #0000ff">void</span></font>
				</font>
				<span style="COLOR: #000000">
						<font face="Courier New" size="2">transferTo(File dest);<br />}</font>
				</span>
		</div>
		<p>
				<br />
				<font face="Courier New" size="2">
						<br />比如这里有一个具体实现:<br /></font>
		</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #0000ff">package</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000"> org.springstudy.ch03.uploadimpl;<br /><br /></span>
								<span style="COLOR: #0000ff">import</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000"> java.io.InputStream;<br /></span>
								<span style="COLOR: #0000ff">import</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000"> java.io.File;<br /><br /></span>
								<span style="COLOR: #0000ff">import</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000"> org.springframework.web.multipart.MultipartFile;<br /></span>
								<span style="COLOR: #0000ff">import</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000"> org.springstudy.ch03.UploadFile;<br /><br /></span>
								<span style="COLOR: #0000ff">public</span> <span style="COLOR: #0000ff">class</span><span style="COLOR: #000000">UploadFileSpringImpl </span><span style="COLOR: #0000ff">implements</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000"> UploadFile {<br />    </span>
								<span style="COLOR: #0000ff">private</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">MultipartFile multipartFile;<br />    <br />    </span>
								<span style="COLOR: #0000ff">public</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">UploadFileSpringImpl(MultipartFile multipartFile) {<br />        </span>
								<span style="COLOR: #0000ff">this</span>
								<span style="COLOR: #000000">.multipartFile</span>
								<span style="COLOR: #000000">=</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000"> multipartFile;<br />    }<br />    <br />    </span>
								<span style="COLOR: #0000ff">public</span> <span style="COLOR: #0000ff">byte</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">[] getBytes() {<br />        </span>
								<span style="COLOR: #0000ff">return</span> <span style="COLOR: #0000ff">this</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">.multipartFile.getBytes();<br />    }<br />    <br />    </span>
								<span style="COLOR: #0000ff">public </span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">String getContentType() {<br />        </span>
								<span style="COLOR: #0000ff">return</span> <span style="COLOR: #0000ff">this</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">.multipartFile.getContentType();<br />    }<br />    <br />    </span>
								<span style="COLOR: #0000ff">public</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">InputStream getInputStream() {<br />        </span>
								<span style="COLOR: #0000ff">return</span> <span style="COLOR: #0000ff">this</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">.multipartFile.getInputStream();<br />    }<br />    <br />    </span>
								<span style="COLOR: #0000ff">public</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">String getName() {<br />        </span>
								<span style="COLOR: #0000ff">return</span> <span style="COLOR: #0000ff">this</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">.multipartFile.getName();<br />    }<br />    <br />    </span>
								<span style="COLOR: #0000ff">public</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">String getOriginalFilename() {<br />        </span>
								<span style="COLOR: #0000ff">return</span> <span style="COLOR: #0000ff">this</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">.multipartFile.getOriginalFilename();<br />    }<br />    <br />    </span>
								<span style="COLOR: #0000ff">public</span> <span style="COLOR: #0000ff">long</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">getSize() {<br />        </span>
								<span style="COLOR: #0000ff">return</span> <span style="COLOR: #0000ff">this</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">.multipartFile.getSize();<br />    }<br />    <br />    </span>
								<span style="COLOR: #0000ff">public</span> <span style="COLOR: #0000ff">boolean</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">isEmpty() {<br />        </span>
								<span style="COLOR: #0000ff">return</span> <span style="COLOR: #0000ff">this</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">.multipartFile.isEmpty();<br />    }<br />    <br />    </span>
								<span style="COLOR: #0000ff">public</span> <span style="COLOR: #0000ff">void</span></font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">transferTo(File dest) {<br />        </span>
								<span style="COLOR: #0000ff">this</span>
						</font>
				</font>
				<font face="Courier New">
						<font size="2">
								<span style="COLOR: #000000">.multipartFile.transferTo(dest);<br />    }<br />}</span>
						</font>
				</font>
		</div>
		<p>
				<br />
				<br />
				<font face="Courier New" size="2">你也可以写commonsupload或者cos的实现,Service接受的参数是UploadFile接口的,所以你必须实现UploadFile接口才能使用Service层的功能.<br /><br />(后话:看来学习设计模式还是很有用处的)<br /><br /></font>
		</p>
<img src ="http://www.blogjava.net/oxl/aggbug/43669.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/oxl/" target="_blank">oxl</a> 2006-04-27 22:41 <a href="http://www.blogjava.net/oxl/articles/43669.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>第一个筹划要做的Java项目.&lt;网上电子分类信息&gt;系统.</title><link>http://www.blogjava.net/oxl/articles/40751.html</link><dc:creator>oxl</dc:creator><author>oxl</author><pubDate>Wed, 12 Apr 2006 15:48:00 GMT</pubDate><guid>http://www.blogjava.net/oxl/articles/40751.html</guid><wfw:comment>http://www.blogjava.net/oxl/comments/40751.html</wfw:comment><comments>http://www.blogjava.net/oxl/articles/40751.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/oxl/comments/commentRss/40751.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/oxl/services/trackbacks/40751.html</trackback:ping><description><![CDATA[
		<p>
				<font face="Courier New" size="2">在银沙里现在就是负责这方面的开发,经过这段时间的对系统的了解,我想这是一个很有趣的项目.于是就想到写一个对应的Java的Web程序.</font>
		</p>
		<p>
				<font face="Courier New" size="2">当也要抛弃那些原来php系统里不好的设计和方法.</font>
		</p>
		<p>
				<font face="Courier New" size="2">新的Java实现会用到什么技术呢?</font>
		</p>
		<p>
				<font face="Courier New" size="2">Spring + Hibernate + WW + Ajax</font>
		</p>
		<p>
				<font face="Courier New" size="2">开发时间,1年.从2006年6月10号开始.</font>
		</p>
		<p>
				<font face="Courier New" size="2">注意的地方:<br />不要急着写代码,要先做好需求分析和设计<br />注意扩展性和对编程模式的更好应用.</font>
		</p>
		<p>
				<font face="Courier New" size="2">打算开源该项目.</font>
		</p>
<img src ="http://www.blogjava.net/oxl/aggbug/40751.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/oxl/" target="_blank">oxl</a> 2006-04-12 23:48 <a href="http://www.blogjava.net/oxl/articles/40751.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>仍然在思考：如何理解业务逻辑层。</title><link>http://www.blogjava.net/oxl/articles/38743.html</link><dc:creator>oxl</dc:creator><author>oxl</author><pubDate>Sun, 02 Apr 2006 08:23:00 GMT</pubDate><guid>http://www.blogjava.net/oxl/articles/38743.html</guid><wfw:comment>http://www.blogjava.net/oxl/comments/38743.html</wfw:comment><comments>http://www.blogjava.net/oxl/articles/38743.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/oxl/comments/commentRss/38743.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/oxl/services/trackbacks/38743.html</trackback:ping><description><![CDATA[总是没法子弄清楚业务逻辑层和控制层的关系，控制层仅仅只是控制流吗？那么业务逻辑就没有控制流了吗？<br /><br />我现在分析得出：<br />1、控制层调用业务层得到要显示的数据，然后把数据返回给视图层。<br />2、业务层则是由业务接口和业务操作组成。比如： <br /><br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img id="Codehighlighter1_0_19_Open_Image" onclick="this.style.display='none'; Codehighlighter1_0_19_Open_Text.style.display='none'; Codehighlighter1_0_19_Closed_Image.style.display='inline'; Codehighlighter1_0_19_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_0_19_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_0_19_Closed_Text.style.display='none'; Codehighlighter1_0_19_Open_Image.style.display='inline'; Codehighlighter1_0_19_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /><span id="Codehighlighter1_0_19_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">/** */</span><span id="Codehighlighter1_0_19_Open_Text"><span style="COLOR: #008000">/**</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /> * A Service<br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> </span><span style="COLOR: #008000">*/</span></span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img id="Codehighlighter1_47_167_Open_Image" onclick="this.style.display='none'; Codehighlighter1_47_167_Open_Text.style.display='none'; Codehighlighter1_47_167_Closed_Image.style.display='inline'; Codehighlighter1_47_167_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_47_167_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_47_167_Closed_Text.style.display='none'; Codehighlighter1_47_167_Open_Image.style.display='inline'; Codehighlighter1_47_167_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> UserService </span><span id="Codehighlighter1_47_167_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_47_167_Open_Text"><span style="COLOR: #000000">{<br /><img id="Codehighlighter1_102_165_Open_Image" onclick="this.style.display='none'; Codehighlighter1_102_165_Open_Text.style.display='none'; Codehighlighter1_102_165_Closed_Image.style.display='inline'; Codehighlighter1_102_165_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_102_165_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_102_165_Closed_Text.style.display='none'; Codehighlighter1_102_165_Open_Image.style.display='inline'; Codehighlighter1_102_165_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> UserView login(String name, String password) </span><span id="Codehighlighter1_102_165_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_102_165_Open_Text"><span style="COLOR: #000000">{<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" />.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" />.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" />.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" />.<br /><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/dot.gif" /><img src="http://www.blogjava.net/images/dot.gif" />.</span><span style="COLOR: #008000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" /></span><span style="COLOR: #000000">    }</span></span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><br /><br />业务操作则是业务接口调用相关的数据持久层和一些其它相关操作组成。<br /><br />3、实体：实体就是一个对象，对象拥有数据，可以把对象放到Dao进行保存，也可以通过Dao得到对象，然后对象对自己的数据来进行操作，比如说改变静态页面，保存图片或删除图片等。其实实体就是两种角色，一个是持久对象PO，一个是实体对象EO<img src ="http://www.blogjava.net/oxl/aggbug/38743.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/oxl/" target="_blank">oxl</a> 2006-04-02 16:23 <a href="http://www.blogjava.net/oxl/articles/38743.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>