??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产日本,久久爱www成人,亚洲一区精品视频http://www.aygfsteel.com/zqc/zh-cnTue, 17 Jun 2025 02:59:58 GMTTue, 17 Jun 2025 02:59:58 GMT60试Q测试,试Q给我tmd写测试!http://www.aygfsteel.com/zqc/archive/2007/07/17/130925.htmlwhere the amazing happenswhere the amazing happensTue, 17 Jul 2007 13:10:00 GMThttp://www.aygfsteel.com/zqc/archive/2007/07/17/130925.htmlhttp://www.aygfsteel.com/zqc/comments/130925.htmlhttp://www.aygfsteel.com/zqc/archive/2007/07/17/130925.html#Feedback0http://www.aygfsteel.com/zqc/comments/commentRss/130925.htmlhttp://www.aygfsteel.com/zqc/services/trackbacks/130925.html管很早开始就不止一ơ得对自pQ单元测试!单元试Q单元测试! 但是依然失望得发现现在所遇到所有的烦恼几乎都与试有关。曾l要一个h三天内搞定一个论?-功能q相当复杂:除了基本的crud发帖回帖搜烦什么的q要有用户分l、访问权限、子论坛Q等Q现在想当时是什么让我在撑过来的Q是那一个个单难看弱智的testcaseQ在我看来一个不懂得tdd不理解测试先行不清楚怎么写testcase的程序员几乎就不能是个合格得E序员。这不是技术问题,是政治问题。尤其是在你发现你的已经职的同事写的一个极为复杂的自定义控件在使用的时候出C大堆bug而你q要׃堆时间去U正时的l望。整个项目组没h写testcase?没问题,我自己写p?---整个软g框架模块可测试性太低?没问题,q旉把重要的c解耦出?-旉来不及?更没问题Q磨刀不误砍柴功?/p>

明天打算l那些组件所有public的方法写上测试用?-虽然花时间给别h的代码写试是极为无聊的行ؓQ但是现在我也认了,不能再这h心吊胆得写代码和手工试了,宁可׃一个上午甚x多的旉来写用例搭徏环境。Rod Johnson说得Ҏ?牛仔式真是编E害死:满天飞的工厂模式、单例、静态变量,什么注释都没有的监听接?---最重要的是Q没有测试用?-乃还程序员吗?知道老子׃多少旉来拜M攚w构step in,step over您的"大作"Qholy shit.

Del.icio.us :



]]>
ȝ杂记http://www.aygfsteel.com/zqc/archive/2007/06/19/125205.htmlwhere the amazing happenswhere the amazing happensTue, 19 Jun 2007 14:34:00 GMThttp://www.aygfsteel.com/zqc/archive/2007/06/19/125205.htmlhttp://www.aygfsteel.com/zqc/comments/125205.htmlhttp://www.aygfsteel.com/zqc/archive/2007/06/19/125205.html#Feedback0http://www.aygfsteel.com/zqc/comments/commentRss/125205.htmlhttp://www.aygfsteel.com/zqc/services/trackbacks/125205.html上周开始上班时Q原来以Zdweb开发,毕竟q方面比较熟l,不料被丢L桌面应用。基本上是一个springrcp开发的一个prototypeQ前几天先看看代码和tutorials熟悉下系l,然后写了几个功能demo。springrcp在java的桌面应用中不算LQ所以资料找h也比较困难,目l其他两人都忙得屁股朝天Q只能自己慢慢琢。ȝ下来srpc的几大问题,启动速度、自定义数据l定和输入校验。在设计理念上,srcp无疑适合胖客L的大型企业应?Thick Enterprise App)--Ҏbackbean自动生成ui、自动绑定数据和校验{,通过一堆(注意Q一堆。)spring contex和resource文gl装h。srcp无疑是个非常实在的开发框Ӟ太实在到以至于h们一提rcp马上是eclipsercpQ当Ӟeclipse rcp比v来,它可以算是已l?span style="TEXT-DECORATION: underline">不再更新了(?q前开始)?/h5>
  springframework.org论坛里有条评论,译q来大概是_srcpE序说到?是用几个jar和配|文件把你的swing应用l织h的有着复杂的设计结构的xx"Q好吧我不理解ؕ译Q,说vswingQؓ了兼֐个方面的因素(主要是concurrency)Qswing的开发者们不得不让swing的用者们在一个迂回曲折的环境中编写他们的应用。这好像在一座庞大的金字塔内部观察它的徏{结构一P你会发出阵阵惊叹Q也会绉L头迷惑不?-开始的时候后者是q远多过前者的。回q来看看现在如火如荼的web开发,xQweb开发是不是在走10?0q前的老\Q什么才是程序的真谛呢?
接下来准备学习一Ҏ据挖掘方面的知识Q具体点是语义分析。因为公司在数据采集q方面还相当原始的spider+手工收割Q和st谈到q个时也提到个可选的ҎQ天知道那个看上M良少q一L家伙脑袋里到底装了多东ѝ好了,q周打算拖拖拉拉地把自动更新updater写完Q顺便看看有没机会弄成一个通用的updater。第一期的业务逻辑不复杂,所以也暂时没我什么事Q正好可以一只脚站在门外l心瞅瞅Q其他等评估l果出来了再说。刚才收信时候看到有?4Loffer letterQ密密麻ȝ英文搞得foxmail都把它丢到垃圄里去了?br/>


]]>
全排列和其他http://www.aygfsteel.com/zqc/archive/2007/06/05/122137.htmlwhere the amazing happenswhere the amazing happensTue, 05 Jun 2007 06:47:00 GMThttp://www.aygfsteel.com/zqc/archive/2007/06/05/122137.htmlhttp://www.aygfsteel.com/zqc/comments/122137.htmlhttp://www.aygfsteel.com/zqc/archive/2007/06/05/122137.html#Feedback0http://www.aygfsteel.com/zqc/comments/commentRss/122137.htmlhttp://www.aygfsteel.com/zqc/services/trackbacks/122137.html昨天上午去面试的一道题Q当场没惛_来,回来׃Ҏ间补完了下发回去.

原题要求用javaQ用python只是Z方便。用回溯法快Q但是还是坚持用遍历林来写Q这也是面试时没惛_的思\Q呵呵,我就是自N烦的石头性格?/p>

最先想到用无向q通图q行深度优先搜烦Q但是没有考虑到结束条件。对于N个待排列的数字,每个节点都有N-1个出口和入口Q而用树状l构每个节点只有一个父节点Q存在递归q回的条件。但是这个方法的实用性只限制在当排列数很(N < 8Q时。当N>8时算法消耗的旉明显增加(一?*7*6*5*4*3*2*1=40320U组?Q当N>1000?当然Q这U情冉|不敢惛_?׃辑ֈpython的递归极限。所以真正如果要q点什么的?当然Q高中生都知道全排列?2张扑克牌出来排一下结果集是个天文数?Q这昄不是个好法?/p>

#coding=utf-8

# 数字全排?/span>
#
Chris Zheng 2007-06-05

import sys, os


#待排列的数字
NUMS = [1,2,3,4,5,6]

#l果集合
results = []

EXCLUDES
= (
lambda a,b,nums:abs(nums.index(a) - nums.index(b)) == 1, #a,b是否盔R
lambda a,b,idx_a,idx_b,nums:nums.index(a) == idx_a and nums.index(b) \
== idx_b #a,b是否同时W合特定位置
)

# 3?不能盔R ?在第1?不能在第7
EXT_PARAMS = (
(
3,4,NUMS),(2,6,1,7,NUMS)
)

#查排除条?/span>
def __check_conditions(nums):
matchs
= False
for f in EXCLUDES:
for params in EXT_PARAMS:
try:
params[
-1] = nums
matchs
= f(*params)
if matchs: return matchs
except Exception:continue
return matchs

#树节?/span>
class node(object):
def __init__(self, n):
self.value
= n
self.parent
= None
self.children
= []
def __eq__(self,other):
return self.value == other.value
def __str__(self):return str(self.value)

#L?/span>
def get_all(nums):
trees
= []
for n in nums:
trees.append(create_tree(node(n)))
for t in trees:
walk_tree(t)
global results
#qo条g
return (r for r in results if not __check_conditions(r))

#生成l果?/span>
def create_tree(root):
parent_elements
= __parents(root)
if len(parent_elements) == len(NUMS)+1:return root
nums
= (nums for nums in NUMS if node(nums) not in parent_elements)
for k in nums:
c
= node(k)
c.parent
= root
root.children.append(create_tree(c))
return root

def __parents(node):
parent_elements
= [node]
while node.parent:
parent_elements.append(node.parent)
node
= node.parent
return parent_elements

#遍历l果?/span>
def walk_tree(root):
if root.children:
for n in root.children:
walk_tree(n)
else:
k
= [root.value]
p
= root.parent
while p:
k.append(p.value)
p
= p.parent
k.reverse()
results.append(k)

#试输出
if __name__=='__main__':
rs
= get_all(NUMS)
f
= open('results.txt','w')
for k in rs:
f.write(str(k)
+'\n')
f.close()


.




]]>
法3:计算大数字整数乘法http://www.aygfsteel.com/zqc/archive/2006/09/25/71819.htmlwhere the amazing happenswhere the amazing happensMon, 25 Sep 2006 12:40:00 GMThttp://www.aygfsteel.com/zqc/archive/2006/09/25/71819.htmlhttp://www.aygfsteel.com/zqc/comments/71819.htmlhttp://www.aygfsteel.com/zqc/archive/2006/09/25/71819.html#Feedback1http://www.aygfsteel.com/zqc/comments/commentRss/71819.htmlhttp://www.aygfsteel.com/zqc/services/trackbacks/71819.html阅读全文

]]>
关于getParameterNames()http://www.aygfsteel.com/zqc/archive/2006/06/18/53546.htmlwhere the amazing happenswhere the amazing happensSat, 17 Jun 2006 20:51:00 GMThttp://www.aygfsteel.com/zqc/archive/2006/06/18/53546.htmlhttp://www.aygfsteel.com/zqc/comments/53546.htmlhttp://www.aygfsteel.com/zqc/archive/2006/06/18/53546.html#Feedback0http://www.aygfsteel.com/zqc/comments/commentRss/53546.htmlhttp://www.aygfsteel.com/zqc/services/trackbacks/53546.html

]]>
Comments on Mock-Based Testinghttp://www.aygfsteel.com/zqc/archive/2006/06/04/50308.htmlwhere the amazing happenswhere the amazing happensSun, 04 Jun 2006 10:53:00 GMThttp://www.aygfsteel.com/zqc/archive/2006/06/04/50308.htmlhttp://www.aygfsteel.com/zqc/comments/50308.htmlhttp://www.aygfsteel.com/zqc/archive/2006/06/04/50308.html#Feedback1http://www.aygfsteel.com/zqc/comments/commentRss/50308.htmlhttp://www.aygfsteel.com/zqc/services/trackbacks/50308.html很好的一文章,深入说了很多关于试的东ѝ?br />
A article from Technoetic
- Posted in
Software Dev., Agile by Steve Bate

I recently read a blog entry with criticisms of mock-based testing. The author raised several “issues?with using mocks to support unit testing. I’m commenting here since the author has closed comments on the original blog entry.

Issue 1: Poor integration tests, as everything is being tested in isolation

I’ve had good experience with mock-based testing. However, it’s obvious that mocks will only test classes in isolation. I use both unit tests and integration tests (sometimes called system or acceptance tests) together. The need for integration tests is not an issue for mock-based techniques and is not a good reason to use less mocks. It’s just a different aspect of testing. A more common issue in my experience is that people in the agile community who are new to testing often don’t understand these different aspects of testing and seem to believe that mock-based unit testing and integration testing are mutually exclusive options. The lack of common terminology in the community only worsens the problem. For some people, a “unit?is a class or small group of tightly coupled classes. For others, it’s a large portion of the software product. Most agile developers seem to call every test they write a unit test. It’s become so confusing for some teams that I’ve seen terminology like “integration unit tests?being used to describe testing strategies.

But, back to the topic. Poor integration testing is simply the result of lack of integration tests. Mocks do not cause a lack of integration tests. A team makes that choice, probably based on a weak understanding of the tradeoffs between isolation (unit) and integration (system) testing.

Issue 2: Mocks add complexity to the software design.

“I’ve seen numerous occasions where the introduction of mocks has added a large amount of complexity to an otherwise simple design. This complexity leads to higher implementation costs, a higher cognitive load on the developers working on the system, and higher maintenance costs (as there’s more code to maintain). ?/p>

The author appears to focused on the increased use of interfaces when using mock-based testing and expresses the opinion that interfaces should only be used where we’d want to be able to replace one implementation with another. First, there are other reasons to use interfaces. In general, interfaces are useful for managing dependencies between software components or subsystems. This can be beneficial even if the implementations do not change (see The Dependency Inversion Principle).

A modular software design will generally make it easier to use mock-based testing without altering the design specifically for the mocks. However, there are times when the software must be modified to support testing. Fortunately, the changes needed to support testing often, if done well, support the modularity goal.

In my experience, extra interfaces don’t add a significant maintenance overhead. Most effort is spent implementing the interface. The time writing the interface itself (or extracting it using an IDE’s refactoring tools) is negligible.

My Conclusions

In almost every case, I see the “simplicity?gained by not using mocks overshadowed by complex test setups to initialize large groups of dependent objects. The dark side of integration testing is that it’s often very slow for large numbers of tests. Some teams are using continuous integration tools like Cruise Control to run their “unit tests?(usually they are actually integration tests). This delays the feedback about broken builds but is often necessary because the tests run so slow. I realize there other reasons for using CC, but this is a common one from what I’ve seen and heard.

I’ve worked on teams where we had thousands of tests that ran in less than 15-20 seconds total on a developer workstation. This was a direct result of heavy use of mock-based testing. We also had a slower suite of integration tests that required 4-5 minutes to run. We didn’t need a continuous integration server because we were able to integrate and run our unit tests before every commit to the source control system. The team integrated 10-20 times/day and broken builds were practically nonexistent over the several years I worked with them. In the very rare cases when the build did break, it was typically fixed in a matter of minutes.

The other benefit of the isolation testing enabled by mocks is the ability to pinpoint problems much more quickly. It’s a form of the divide and conquer problem solving strategy, only the divide part is already done. The conquering is relatively easy compared to tracking down the cause of test failures when many classes are being exercised in a test.

My experience was that our mock based unit tests caught about 98% of the code problems before the code was ever committed to source control. The integration tests caught about another 1% beyond that (almost always because of a flaw in the mock-based testing) and manual testing caught the other 1%.



]]>
Waterfall framework 开发日?/title><link>http://www.aygfsteel.com/zqc/archive/2006/05/24/47845.html</link><dc:creator>where the amazing happens</dc:creator><author>where the amazing happens</author><pubDate>Wed, 24 May 2006 08:58:00 GMT</pubDate><guid>http://www.aygfsteel.com/zqc/archive/2006/05/24/47845.html</guid><wfw:comment>http://www.aygfsteel.com/zqc/comments/47845.html</wfw:comment><comments>http://www.aygfsteel.com/zqc/archive/2006/05/24/47845.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zqc/comments/commentRss/47845.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zqc/services/trackbacks/47845.html</trackback:ping><description><![CDATA[ <p>TODO:<br />l箋试和改q?不满意的地方:@ToSession标签<br /><br />更新日志:<br /><br />2006-06-18 增加和改q?@ToList 标签,用来修饰一个参Cؓjava.util.List<T>的setterҎ <br />2006-05-23 增加 VelocityView接口,方便velocity视图调用.<br />2006-05-23 增加 WebParam接口,装掉request和response以及ServletContext</p> <p>2006-05-22 增加 5.1 初始?velocity <br />2006-05-21 增加 4.1 - 4.2 HttpSession操作<br /><br /><br />更新note:<br />1.HttpServletRequest?a href="file:///D:/jakarta-tomcat-4.1.30/servlet%20api/javax/servlet/ServletRequest.html#getParameterNames()"><strong><font face="Courier New">getParameterNames</font></strong></a><font face="Courier New">()</font> Ҏq回的Enumeration相对于页面参数的物理序刚好是相反的,所以实现@ToList标签时候需要先用一个Stack来对所有参数进行反?不知tomcat在这个apiҎ上是怎么实现?Z么就倒过来。c语言函数可以Ҏ不同的callcd来指定不同的压栈的顺序,莫非q个惯例也被用到servlet里面来了Q挺有意思的东西Q看来需要留意一下?br /></p> <p>问题和解x?<br /><br />1.关于@ToSession标签.如果是登陆的?那么有个判断条件决定某个login token是否应该被加到session?q时候可以在@ToSession标记的getterҎ中加入逻辑判断,来决定返回一个token实体或者null(q样做有点古?.).<br /><br />2.路径的问?比如一?a href="http://host/logic/bbs/admin/ListUsers.wff">http://host/logic/bbs/admin/ListUsers.wff</a> 摸版的相兌源目?比如,囄,css,js{?必d在webproject/bbs/admin响应的目录下,有点像struts的多模块.<br /><br />开?<br /><br />Ruby on Rails有个设计思想是用~码规定代替J琐的配|文件。jvmq_已经有一些类似ror的实玎ͼ比如<br />grails(<a >http://docs.codehaus.org/display/GRAILS/2006/03/29/Groovy+on+Rails+(Grails)+0.1+Released</a>)</p> <p>虽然׃java自n的局限,它很隑ց出像ruby或者groovy那样动态语a那样随心所Ʋ的动作Q但是利用它的运行时反射、动态代理等Ҏ来可能实现“用~码规定代替J琐的配|文件”这一思想?br />下面转入正题?/p> <p>ServletAPI对HTTP协议q行了封?通过配置Web.xml来把不同的请求{发给不同的servlet来处理。Web框架则用一个ActionServletQ根据自q对Action的定义来转发h?br />抛开那些J琐的配|文Ӟ设想一下这样一U方?</p> <p>1.Web动作的处理和响应</p> <p>假设q样一个POSTh:</p> <p>  <form action="logic/group/NewTopic.wff" method="post"></p> <p>Web动作实现Bean:<br />   org.qqsns.web.logic.group.NewTopic   <br />注意后面的logic/group/NewTopic和logic.group.NewTopic, 动作cdWeb动作是通过h路径和包名相互关联?br />q样Q对Web动作的响应就依赖于编译期的代码的l织l构而不是执行期的配|文件。这L好处是避免了l护J琐的配|文?特别是在没有IDE支持的情况下?/p> <p>org.qqsns.web.logic.group.NewTopiccL一个实现net.wff.servlet.WebAction接口的POJOQ下面是NewTopic中execute的方法片D?   <br /> <br /> //Only method must be implemented for interface net.wff.servlet.WebAction<br /> public String execute(WebParam param, VelocityView view)<br /> throws ServletException, IOException{<br />  ...<br />  //return "redirect /success.html";  //h重定?br />  return "/success.jsp";              //h转发<br />}<br />executeҎ的返回值手动指定了一个{发或重定向的路径?/p> <p>2.输入验证</p> <p>普通的Web框架都带数据输入验证功能,一般复杂程度和功能强大与否成正比?br />q里单地要求从setterҎ里抛Z个包含验证信息的异常Q以此来实现输入异常处理?br />       <br />普通setterҎ<br />public void setName(String name){ <br />  this.name = name;<br />}</p> <p>d输入验证后的setterҎ</p> <p>public void setName(String name) throws InputException{    <br /> if(name.length()<3)<br />    throw new InputException("Topic name must has a length greater than 3"); <br />  this.name = name;<br />}</p> <p>在WaterFallServlet如何中处理验证信?</p> <p>    WebAction wa = <br />    (WebAction)Class.forName(classPath).newInstance();<br />          //procces forwarding<br />          try {<br />    ActionHelper.setProperties(request,wa);<br />   } catch (InputException e) {<br />    //return to input view<br />    //header:referer<br />    String rtn = request.getHeader("referer");<br />    //clear old errors<br />    if(rtn.indexOf("?")!=1){<br />     rtn = rtn.substring(0,rtn.indexOf("?"));<br />    }<br />    rtn=rtn+"?error="+URLEncoder.encode(e.getMessage(),"UTF-8");<br />    response.sendRedirect(rtn);<br />    return;<br />   }</p> <p>q样验证信息通过h参数传回到输入页?</p> <p>3.数据l定</p> <p>假设有这Lhtml输入:</p> <p>    <input type="text" name="name"/><br />    <input type="text" name="number"/><br />    <input type="text" name="price"/><br />    <br /> 下面是NewTopic中execute的方法全?   <br /> <br /> public String execute(WebParam param, VelocityView view)<br /> throws ServletException, IOException{<br />  System.out.println(getName());<br />  System.out.println(getNumber());<br />  System.out.println(getPrice());<br />  System.out.println(getLength());<br />  return "/success.html";<br />}<br />    <br />自动从request注入parameter,q也是Struts DynamicActionForm的好处之一?br />不过q里实现更类似多了类型{换的<jsp:setProperty name="bean" property="*"/><br />因ؓName的类型是String,Number的类型是Integer,Price的类型是float,length的类型是double.至于其他复杂的类?也许jsf的{换器是个更好的主意?br />q样初步解决了数据的输入绑定和验证。余下的是业务逻辑的问题?/p> <p>4.如何操作Session中的信息<br /> <br /> 获取session中的信息:</p> <p>  @FromSession(<br />     sessionKey=User.key<br />     )<br /> public void setCurrentUser(String currentUser) {<br />  this.currentUser = currentUser;<br /> }</p> <p> 信息保存到session? </p> <p>  @ToSession(<br />      sessionKey = User.key  <br />    )<br /> public String getName() {<br />  if(login())return name;<br />  else return null;<br /> }</p> <p> q?个方法定义在WebAction的实现类中?br /> 框架在execute()之前执行@FromSession动作Q在execute()之后执行@ToSession动作?br /> q里使用了annotation,所以要求必Ljdk5.0以上版本.<br /> <br /> 5.1 Velocity<br />  waterfall启动时候自动在WEB-INF目录下寻扑ƈ初始化Velocity.properties文g<br /> 操作:<br /> public String execute(WebParam param, VelocityView view)<br /> throws ServletException, IOException{<br />  view.addElement("msg","Hello");<br />  view.go("index.vm");<br />  return null;<br />}<br /><br /></p> <img src ="http://www.aygfsteel.com/zqc/aggbug/47845.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zqc/" target="_blank">where the amazing happens</a> 2006-05-24 16:58 <a href="http://www.aygfsteel.com/zqc/archive/2006/05/24/47845.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hibernate3.0中HQL中文不能的解军_?/title><link>http://www.aygfsteel.com/zqc/archive/2006/05/23/47564.html</link><dc:creator>where the amazing happens</dc:creator><author>where the amazing happens</author><pubDate>Mon, 22 May 2006 19:06:00 GMT</pubDate><guid>http://www.aygfsteel.com/zqc/archive/2006/05/23/47564.html</guid><wfw:comment>http://www.aygfsteel.com/zqc/comments/47564.html</wfw:comment><comments>http://www.aygfsteel.com/zqc/archive/2006/05/23/47564.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zqc/comments/commentRss/47564.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zqc/services/trackbacks/47564.html</trackback:ping><description><![CDATA[忙乎了一晚上,q从MYSQL换到了HSQL数据?最后发现是Hibernate3.0自己的问?q没具体搞清楚具体是怎么回事,不过救急是够用?<br /><br /><property   name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property><img src ="http://www.aygfsteel.com/zqc/aggbug/47564.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zqc/" target="_blank">where the amazing happens</a> 2006-05-23 03:06 <a href="http://www.aygfsteel.com/zqc/archive/2006/05/23/47564.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个WEB框架功能的分?用编码规定代曉K|文?/title><link>http://www.aygfsteel.com/zqc/archive/2006/05/17/waterfallframeworkintro.html</link><dc:creator>where the amazing happens</dc:creator><author>where the amazing happens</author><pubDate>Wed, 17 May 2006 05:12:00 GMT</pubDate><guid>http://www.aygfsteel.com/zqc/archive/2006/05/17/waterfallframeworkintro.html</guid><wfw:comment>http://www.aygfsteel.com/zqc/comments/46608.html</wfw:comment><comments>http://www.aygfsteel.com/zqc/archive/2006/05/17/waterfallframeworkintro.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zqc/comments/commentRss/46608.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zqc/services/trackbacks/46608.html</trackback:ping><description><![CDATA[ <p> <strong>R</strong>uby on Rails有个设计思想?<strong>用编码规定代替繁琐的配置文g</strong>。jvmq_已经有一些类似ror的实玎ͼ比如<br />grails:<a >http://docs.codehaus.org/display/GRAILS/2006/03/29/Groovy+on+Rails+(Grails)+0.1+Released</a><br /><br />虽然׃java自n的局限,它很隑ց出像ruby或者groovy那样动态语a那样随心所Ʋ的动作Q但是利用它的运行时反射、动态代理等Ҏ来可能体现“用~码规定代替J琐的配|文件”这一思想。下面就转入正题?/p> <p>ServletAPI对HTTP协议q行了封?通过配置Web.xml来把不同的请求{发给不同的servlet来处理。Web框架则用一个ActionServletQ根据自q对Action的定义来转发h?br />抛开那些J琐的配|文Ӟ设想一下这样一U方?</p> <p> <strong>1.Web动作的处理和响应</strong> </p> <p>假设q样一个POSTh:</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"> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">form </span> <span style="COLOR: #ff0000">action</span> <span style="COLOR: #0000ff">="logic/group/NewTopic"</span> <span style="COLOR: #ff0000"> method</span> <span style="COLOR: #0000ff">="post"</span> <span style="COLOR: #0000ff">></span> </div> <p>Web动作实现Bean:</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"> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #000000">org.qqsns.web.logic.group.NewTopic</span> </div> <p>注意后面?em>logic/group/NewTopic</em>?em>logic.group.NewTopic</em>, 动作cdWeb动作是通过h路径和包名相互关联?br />q样Q对Web动作的响应就依赖?strong>~译期的代码的组l结?/strong>而不?strong>执行期的配置文g</strong>。这L好处是避免了l护J琐的配|文?特别是在没有IDE支持的情况下?/p> <p>org.qqsns.web.logic.group.NewTopiccL一个实现net.wff.servlet.WebAction接口的POJOQ下面是NewTopic中execute的方法片D?   </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"> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">Only method must be implemented for interface net.wff.servlet.WebAction</span> <span style="COLOR: #008000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000"> String execute(HttpServletRequest request, HttpServletResponse response)<br /><img id="Codehighlighter1_192_291_Open_Image" onclick="this.style.display='none'; Codehighlighter1_192_291_Open_Text.style.display='none'; Codehighlighter1_192_291_Closed_Image.style.display='inline'; Codehighlighter1_192_291_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_192_291_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_192_291_Closed_Text.style.display='none'; Codehighlighter1_192_291_Open_Image.style.display='inline'; Codehighlighter1_192_291_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /> </span> <span style="COLOR: #0000ff">throws</span> <span style="COLOR: #000000"> ServletException, IOException</span> <span id="Codehighlighter1_192_291_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.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_192_291_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />  <img src="http://www.aygfsteel.com/images/dot.gif" /><br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">return "redirect /success.html";  </span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">h重定?/span> <span style="COLOR: #008000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="COLOR: #000000">  </span> <span style="COLOR: #0000ff">return</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">/success.jsp</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;              </span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">h转发</span> <span style="COLOR: #008000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /> </span> <span style="COLOR: #000000">}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <p> executeҎ的返回值手动指定了一个{发或重定向的路径?/p> <p> <strong>2.输入验证</strong> </p> <p>普通的Web框架都带数据输入验证功能,一般复杂程度和功能强大与否成正比?br />q里单地要求从setterҎ里抛Z个包含验证信息的异常Q以此来实现输入异常处理?br />       <br />普通setterҎ</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"> <img id="Codehighlighter1_32_55_Open_Image" onclick="this.style.display='none'; Codehighlighter1_32_55_Open_Text.style.display='none'; Codehighlighter1_32_55_Closed_Image.style.display='inline'; Codehighlighter1_32_55_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> <img id="Codehighlighter1_32_55_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_32_55_Closed_Text.style.display='none'; Codehighlighter1_32_55_Open_Image.style.display='inline'; Codehighlighter1_32_55_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">void</span> <span style="COLOR: #000000"> setName(String name)</span> <span id="Codehighlighter1_32_55_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.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_32_55_Open_Text"> <span style="COLOR: #000000">{ <br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span> <span style="COLOR: #0000ff">this</span> <span style="COLOR: #000000">.name </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> name;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <p>d输入验证后的setterҎ</p> <p> </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"> <img id="Codehighlighter1_54_179_Open_Image" onclick="this.style.display='none'; Codehighlighter1_54_179_Open_Text.style.display='none'; Codehighlighter1_54_179_Closed_Image.style.display='inline'; Codehighlighter1_54_179_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> <img id="Codehighlighter1_54_179_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_54_179_Closed_Text.style.display='none'; Codehighlighter1_54_179_Open_Image.style.display='inline'; Codehighlighter1_54_179_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">void</span> <span style="COLOR: #000000"> setName(String name) </span> <span style="COLOR: #0000ff">throws</span> <span style="COLOR: #000000"> InputException</span> <span id="Codehighlighter1_54_179_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.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_54_179_Open_Text"> <span style="COLOR: #000000">{    <br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="COLOR: #0000ff">if</span> <span style="COLOR: #000000">(name.length()</span> <span style="COLOR: #000000"><</span> <span style="COLOR: #000000">3</span> <span style="COLOR: #000000">)<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span> <span style="COLOR: #0000ff">throw</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">new</span> <span style="COLOR: #000000"> InputException(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">Topic name must has a length greater than 3</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">); <br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span> <span style="COLOR: #0000ff">this</span> <span style="COLOR: #000000">.name </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> name;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <p>WaterFallServlet是如何处理验证信息的:</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"> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #000000">WebAction wa </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> <br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />    (WebAction)Class.forName(classPath).newInstance();<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" />          </span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">procces forwarding</span> <span style="COLOR: #008000"> <br /> <img id="Codehighlighter1_116_165_Open_Image" onclick="this.style.display='none'; Codehighlighter1_116_165_Open_Text.style.display='none'; Codehighlighter1_116_165_Closed_Image.style.display='inline'; Codehighlighter1_116_165_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> <img id="Codehighlighter1_116_165_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_116_165_Closed_Text.style.display='none'; Codehighlighter1_116_165_Open_Image.style.display='inline'; Codehighlighter1_116_165_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /> </span> <span style="COLOR: #000000">          </span> <span style="COLOR: #0000ff">try</span> <span style="COLOR: #000000"> </span> <span id="Codehighlighter1_116_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.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_116_165_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    ActionHelper.setProperties(request,wa);<br /><img id="Codehighlighter1_192_505_Open_Image" onclick="this.style.display='none'; Codehighlighter1_192_505_Open_Text.style.display='none'; Codehighlighter1_192_505_Closed_Image.style.display='inline'; Codehighlighter1_192_505_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_192_505_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_192_505_Closed_Text.style.display='none'; Codehighlighter1_192_505_Open_Image.style.display='inline'; Codehighlighter1_192_505_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />   }</span> </span> <span style="COLOR: #000000"> </span> <span style="COLOR: #0000ff">catch</span> <span style="COLOR: #000000"> (InputException e) </span> <span id="Codehighlighter1_192_505_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.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_192_505_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">return to input view<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">header:referer</span> <span style="COLOR: #008000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="COLOR: #000000">    String rtn </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> request.getHeader(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">referer</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">clear old errors</span> <span style="COLOR: #008000"> <br /> <img id="Codehighlighter1_339_391_Open_Image" onclick="this.style.display='none'; Codehighlighter1_339_391_Open_Text.style.display='none'; Codehighlighter1_339_391_Closed_Image.style.display='inline'; Codehighlighter1_339_391_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /> <img id="Codehighlighter1_339_391_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_339_391_Closed_Text.style.display='none'; Codehighlighter1_339_391_Open_Image.style.display='inline'; Codehighlighter1_339_391_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" /> </span> <span style="COLOR: #000000">    </span> <span style="COLOR: #0000ff">if</span> <span style="COLOR: #000000">(rtn.indexOf(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">?</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">)</span> <span style="COLOR: #000000">!=</span> <span style="COLOR: #000000">1</span> <span style="COLOR: #000000">)</span> <span id="Codehighlighter1_339_391_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.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_339_391_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />     rtn </span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000"> rtn.substring(</span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">,rtn.indexOf(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">?</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">));<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    rtn</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">rtn</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">?error=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">URLEncoder.encode(e.getMessage(),</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">UTF-8</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    response.sendRedirect(rtn);<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span> <span style="COLOR: #0000ff">return</span> <span style="COLOR: #000000">;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />   }</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <p>q样验证信息通过h参数传回到输入页?</p> <p> <strong>3.数据l定</strong> </p> <p>假设有这Lhtml输入: </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"> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">input </span> <span style="COLOR: #ff0000">type</span> <span style="COLOR: #0000ff">="text"</span> <span style="COLOR: #ff0000"> name</span> <span style="COLOR: #0000ff">="name"</span> <span style="COLOR: #0000ff">/></span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">input </span> <span style="COLOR: #ff0000">type</span> <span style="COLOR: #0000ff">="text"</span> <span style="COLOR: #ff0000"> name</span> <span style="COLOR: #0000ff">="number"</span> <span style="COLOR: #0000ff">/></span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">input </span> <span style="COLOR: #ff0000">type</span> <span style="COLOR: #0000ff">="text"</span> <span style="COLOR: #ff0000"> name</span> <span style="COLOR: #0000ff">="price"</span> <span style="COLOR: #0000ff">/></span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <p> 下面是NewTopic中execute的方法全?   </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"> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000"> String execute(HttpServletRequest request, HttpServletResponse response)<br /><img id="Codehighlighter1_117_282_Open_Image" onclick="this.style.display='none'; Codehighlighter1_117_282_Open_Text.style.display='none'; Codehighlighter1_117_282_Closed_Image.style.display='inline'; Codehighlighter1_117_282_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_117_282_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_117_282_Closed_Text.style.display='none'; Codehighlighter1_117_282_Open_Image.style.display='inline'; Codehighlighter1_117_282_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /> </span> <span style="COLOR: #0000ff">throws</span> <span style="COLOR: #000000"> ServletException, IOException</span> <span id="Codehighlighter1_117_282_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.aygfsteel.com/images/dot.gif" /> </span> <span id="Codehighlighter1_117_282_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(getName());<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(getNumber());<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(getPrice());<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />  System.out.println(getLength());<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align="top" />  </span> <span style="COLOR: #0000ff">return</span> <span style="COLOR: #000000"> </span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">/success.html</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;<br /><img src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <p>自动从request注入parameter,q也许是很多人喜ƢStruts DynamicActionForm的原因之一?br />不过q里实现更类似多了类型{换的<jsp:setProperty name="bean" property="*"/><br />因ؓName的类型是String,Number的类型是Integer,Price的类型是float,length的类型是double.至于其他复杂的类?也许jsf的{换器是个更好的主意?br />q样初步解决了数据的输入绑定和验证。余下的是业务逻辑的问题。WaterfallWebFramework源代?<br /><a href="/Files/zqc/WaterfallWebFramework.rar">http://www.aygfsteel.com/Files/zqc/WaterfallWebFramework.rar</a> (<strong>只有一个配|文?其中只有1行配|信?</strong>)</p> <p>以上是框架的主要功能?strong>用编码规定代曉K|文?/strong>Q也许这会是一U更加高效率的开发方式?br /></p> <img src ="http://www.aygfsteel.com/zqc/aggbug/46608.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zqc/" target="_blank">where the amazing happens</a> 2006-05-17 13:12 <a href="http://www.aygfsteel.com/zqc/archive/2006/05/17/waterfallframeworkintro.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>今天ljails加了件外?用swt写的.感觉q不错^_^http://www.aygfsteel.com/zqc/archive/2006/05/06/44701.htmlwhere the amazing happenswhere the amazing happensFri, 05 May 2006 16:27:00 GMThttp://www.aygfsteel.com/zqc/archive/2006/05/06/44701.htmlhttp://www.aygfsteel.com/zqc/comments/44701.htmlhttp://www.aygfsteel.com/zqc/archive/2006/05/06/44701.html#Feedback1http://www.aygfsteel.com/zqc/comments/commentRss/44701.htmlhttp://www.aygfsteel.com/zqc/services/trackbacks/44701.html,用swt写的.感觉q不错^_^
下蝲(附带eclipse的工E文?  http://zqc53.512j.com/others/JailsReleaseWithEclipse.rar



]]>
վ֩ģ壺 | | ˳| | | | | | | С| | | ɽ| | | Զ| | | ƽ| | ʲ| | | | | | ˮ| | | ɽ| | ѽ| ɽ| ϲ| | | | Ӵ| | Ϫ| ɳƺ|