第一次接触Wicket,如此多的内容是文字,的原贴,希望大家指正



Meet Apache Wicket

By JonathanLocke, original author of Wicket

乔纳森·洛克,Wicket的原作者

Why Wicket?

If you arelooking to do web application programming in Java, you have a very large numberof choices these days. In fact, there are so many web application
frameworksnow that it has become somewhat of a joke. One blog site on the Internet posesthe question: How many Java web frameworks can you name? The answer they showlooks like this:

假设你打算做 Web应用程序的编程用java,现在你有许多的选择。其实。有这么多的Web应用程序框架现在它已经变得多少有点可笑了。

一个网上的博客里提出了一个问题:有多少的JavaWeb框架你能够说出来?他们的答案是这种:

Frameworks, Frameworks Everywhere

Echo

Cocoon

Millstone

OXF

Struts

SOFIA

Tapestry

WebWork

RIFE

Spring MVC

Canyamo

Maverick

JPublish

JATO

Folium

Jucas

Verge

Niggle

Bishop

Barracuda

Action Framework

Shocks

TeaServlet

wingS

Expresso

Bento

jStatemachine

jZonic

OpenEmcee

Turbine

Scope

Warfare

JWAA

Jaffa

Jacquard

Macaw

Smile

MyFaces

Chiba

JBanana

Jeenius

JWarp

Genie

Melati

Dovetail

Cameleon

JFormular

Xoplon

Japple

Helma

Dinamica

WebOnSwing

Nacho

Cassandra

Baritus

Stripes

Click

GWT



Why
“Reinvent the Wheel”?

为什么要“推倒重来”

In light ofthis, you may be wondering
“What good isanother web application framework?” Indeed. Why
“re-invent the wheel?

” One snappy comeback to that old saw is: because this time we couldmake it rounder!

But it was notsimply a desire for higher quality that drove the creation of Wicket. Even withso many options, there really is no web toolkit which fills exactly
the nichethat Wicket fills. In fact, Wicket is quite unlike each of the frameworksabove.

Wicket’s closest cousins are probably Tapestry andEcho, but even there the likeness is very
shallow. Like Tapestry, Wicket uses aspecial HTML attribute to denote components, enabling easy editing withordinary HTML editors. Like Echo, Wicket has a first-class component model. ButWicket applications are not like applications written in either Tapestry
orEcho, because in Wicket you get the best of both worlds. You get the benefitsof a first-class component model and a non-intrusive approach to HTML. In manysituations, this combination may prove to be a significant developmentadvantage.

To understandwhy Wicket is so different, it may help to understand the motivations thatcreated it.

鉴于这一点,你可能会想“还有一种Web应用框架有什么优点呢?”的确如此。为什么要“推到重来呢?”这让我想起来一个老话:由于我们能够做的更完美!

但它为更高质量的实现并非创造wicket的唯一动机。即使有这么多的选择。可是并没有一个web工具能全然符合wicket文件。

其实,Wicket的是全然不同于上述各框架。

Wicket的最亲热的表兄弟可能是Tapestry和Echo,但即使有想象的地方也是非常少的。

像Tapestry ,Wicket使用一种特殊的HTML属性来表示的元件。能够方便编辑与普通的HTML编辑器。

像Echo。Wicket拥有一流的组件模型。

但Wicket的应用程序并不像写在任的Tapestry或Echo的应用。由于在Wicket里你能够两全其美。你能够同一时候在第一级的部件模型和非侵入式方法的HTML中的优点。在很多情况下,这样的组合可能被证明有显著发展优势。

要理解为什么Wicket的是如此的不同,它可能有助于了解创建它的动机。

Motivations

 Most existingweb frameworks provide weak to non-existent support in managing server-sidestate

大多数存在的web框架提供差点儿不存在的管理服务端状态的支持

This normallymeans lots of ad-hoc code in web applications dealing with the gory mechanicsof state management. While Wicket will not allow you to stop thinking
aboutserver state, it goes a long ways towards making it easy and often transparentto manage that state.

In Wicket, allserver side state is automatically managed. You will never directly use anHttpSession object or similar wrapper to store state. Instead, state
isassociated with components. Each server-side page component holds a nestedhierarchy of stateful components, where each component’s model is, in the end, a POJO (Plain OldJava Object).
Wicket maintains a map of these pages in each user’s session. One purpose of this page map(and the component hierarchy on each page) is to allow the framework to hideall details of how your
components and models are accessed. You deal withsimple, familiar Java objects and Wicket deals with things like URLs, sessionids and GET/POST requests.

通常,这意味着大量的专门的代码在Web应用程序处理状态管理。而Wicket不会让你停止关于server状态的思考,他在朝着使用更easy更透明化管理的方向上经过了一个漫长的道路。

在Wicket中,全部的server端的状态会自己主动进行管理。你将永远不会直接使用HttpSession对象或类似的包装器来存储状态。相反。状态与组件相关联。每一个server端页面组件保存有一个嵌套层次的有状态组件。每一个组件的模型的最后是一个POJO(普通的Java对象)。Wicket包括这些页面的地图中每一个用户的会话。

这个页的映射(每一个页面上的组件层次结构)的目的之中的一个是让框架隐藏了怎样将组件和模型訪问的全部细节。你仅仅须要处理简单、熟悉的Java对象,Wicket处理的事情。比方URLs,session
ID和GET/POST请求。

You will alsofind that this well-structured server state makes it very easy to deal with thedreaded
“back buttonproblem”. In fact,Wicket has a generic and robust solution which can identify and expirebrowser-cached pages
that have become stale due to structural changes to themodel of a component on the page.

Finally, Wickethas been designed to work with POJO persistence frameworks such as JDO orHibernate. This can make database driven web applications quite easy
to write.

For manyapplications, it will be worth trading off the increased server load of extraserver-side state for decreased development costs, lower maintenance
costs,quicker time-to-market and generally higher quality software. The basicobservation here is that software is expensive and complex while servers fromcompanies like E-machines and Dell are relatively dirt cheap.

In terms ofefficiency versus productivity, perhaps Wicket is to JSP as Java is to C. Youcan accomplish anything in Wicket in JSP. You may even do it more
efficientlyin terms of memory or processor consumption. But it may take you weeks ormonths longer to develop your application. And in the end, since state managementin JSP is ad-hoc, you are likely find security problems and bugs popping upeverywhere. Most
of the other frameworks above will do only a little more tohelp you.

你还会发现,这个结构良好的server状态使得它非常easy对付可怕的“后退button的问题”。其实,Wicket有一个通用的和强大的解决方式。它能够识别和过期的浏览器缓存页面已经陈旧因为对页面上的一个组件模型的结构变化。

最后,Wicket已被设计为与POJO持久性框架如Hibernate或者JDO。这能够使数据库驱动的Web应用程序更easy实现。

对于很多应用程序。这将是一笔值得的交易,去添加额外的server端状态,减少开发成本,减少维修成本。缩短上市时间,实现更高质量的软件。

这里的基本看法是,软件是昂贵和复杂的,像e-machines和戴尔公司的server是相对廉价的。

在效率与生产力方面,也许Wicket对于JSP的关系就想Java对于C一样。

您能够在Wicket中在JSP中完毕不论什么事情。你甚至能够更有效地做到这一点的内存或处理器​​消耗方面。

但它可能须要你几个星期甚至几个月更长的时间来开发应用程序。而在最后,由于状态管理在JSP是暂时的,你非常可能发现的安全问题和错误遍地开花。

最上面的其它框架对你的帮助仅仅能是微乎其微。

Most existingframeworks require special HTML code

大多数现有的框架须要特殊的HTML代码

JSP is by farthe worst offender, allowing the embedding of Java code directly in web pages,but to some degree almost all of the frameworks from the list (except
Tapestry)above introduce some kind of special syntax to your HTML code.

JSP是迄今为止最严重的错误,就是同意直接在网页中的Java代码嵌入。但在一定程度上差点儿全部的框架(除Tapestry)在列表上面介绍某种特殊的语法来你的HTML代码。

Special syntaxis highly undesirable because it changes the nature of HTML from the kind ofpure-and-simple HTML markup that web designers are familiar with,
to some kindof special HTML. This special HTML can be more difficult to preview, edit andunderstand.

特殊的语法是极不可取,由于它把HTML自然纯净而简单的那种网络设计是特别熟悉的HTML标记,转换成对一些特殊的HTML。这样的特殊的HTML是更难预览,编辑和理解的。

Wicket does notintroduce any special syntax to HTML. Instead, it extends HTML in astandards-compliant way via a Wicket namespace that is fully compliant with
theXHTML standard. This means that you can use Macromedia Dreamweaver, MicrosoftFront Page, Word, Adobe Go Live, or any other existing HTML editor to work onyour web pages and Wicket components. To accomplish this, Wicket consistentlyuses a single id attribute
in the Wicket namespace (“wicket:id”) to mark HTMLtags that should receive special treatment by the toolkit. If you
prefer not torender Wicket namespaced tags and attributes to your end-users, Wicket has asimple setting to strip them all out, resulting in ordinary,standards-compliant HTML.

Wicket不引入不论什么特殊的语法为HTML。相反。它通过是全然符合XHTML标准一个Wicket命名空间扩展的HTML标准兼容的方式。

这意味着你能够使用Macromedia的Dreamweaver,Microsoft FrontPage, Word, Adobe Go Live。或不论什么其它现有的HTML编辑器工作在您的网页和Wicket组件。要做到这一点,Wicket一贯使用的Wicket命名空间中的单个id属性(“Wicket:ID”)来标记应接受特殊处理的工具包的HTML标签。假设你不喜欢渲染Wicket命名空间的标签和属性到您的终端,Wicket有一个简单的设置使我们都脱离他们。实现一个普通的,符合标准的HTML。

No
“special sauce” in your HTMLmeans designers can mock up pages that you can use directly in development.Adding Java components
to the HTML is as simple as setting the component nameattribute. And you can then give the HTML back to your web designers knowingthat they can change it with confidence.

没有“调料”在你的HTML意味着设计师模拟的页面,能够直接在程序中使用。

加入Java组件到HTML想设置组件的名字属性一样简单。然后把HTML返回到网页设计师那里而且让他们知道改变网页是一件非常easy的事情。

Wicket, more thanany other framework gives you a separation of concerns. Web designers can workon the HTML with very little knowledge of the application code
(they cannotremove the component name tags and they cannot arbitrarily change the nestingof components, but anything else goes). Likewise, coders can work on the Javacomponents that attach to the HTML without concerning themselves with what agiven page looks
like. By not stepping on each other’s toes, everyone can get more work done.

Wicket,比其它不论什么框架更easy实现分层。站点设计者用非常少的应用代码的知识仅仅是去操作HTML(他们无法删除的组件名称标签,他们不能任意更改组件,其它的都能够)。相同。编码器能够工作在Java组件连接到HTML不关心什么一个给定的页面。仅仅要不踩其它人的脚趾头。每一个人都能够做很多其它的工作。

Existingframeworks are not easy

现有的框架都不是简单的

Most of theexisting toolkits have poorly defined or non-existent object models. In somecases, the model is defined using special XML syntaxes. The syntaxes
may be socumbersome that special tools are required to manipulate all the configurationinformation. Since these toolkits are not simple Java libraries you may or maynot be able to use your favorite IDE tools such as editors, debuggers andcompilers.

Wicket is allabout simplicity. There are no configuration files to learn in Wicket. Wicketis a simple class library with a consistent approach to component
structure. InWicket, your web applications will more closely resemble a Swing applicationthan a JSP application. If you know Java (and especially if you know Swing),you already know a lot about Wicket.

大多数现有的工具包都定义不清或不存在的对象模型。在某些情况下,该模型是使用特殊的XML语法来定义。该语法可能是这样繁琐的特殊工具来操作全部的配置信息。因为这些工具包是不是简单的Java库,你可能会或可能无法使用您喜欢的IDE工具。如编辑器。调试器和编译器。

Wicket是简单而且有没有配置文件。

Wicket的是一个简单的类库,用一致的方法来组成结构。在Wicket中,你的Web应用程序会更接近于比JSP应用程序Swing应用程序。假设你知道的Java(特别是假设你知道Swing)。你已经知道了非常多关于Wicket。

Existingframeworks inhibit reusability

现有的框架复用性不好

Tapestry and JSFat least have component models that allow reuse, but you are likely to findthat it is not particularly trivial to do, at least when compared
with Wicket.Wicket has been explicitly designed to make it very, very easy to createreusable components. It’s surprisinglysimple to extend existing components and to make compound components
such as aSignInPanel or AddressForm. It is also relatively easy to create componentsthat exploit new features of browsers. Components in Wicket can be packaged upin JAR files and reused by simply dropping them in your lib folder - noconfiguration necessary!

Tapestry和JSF至少有组件模型,同意重用。但你很可能会发现,这是不是特别easy做到,至少在Wicket相比。Wicket已经被明白设计,使其很、很easy地创建可重用的组件。这是令人吃惊的简单扩展现有的组件和使复合组件。如SignInPanel或为AddressForm。

它也是相对easy地创建利用浏览器的新功能部件。在Wicket组件能够被打包成JAR文件。并通过简单的拖放在你的lib目录反复使用 - 无需进行必要的配置!

Web programmingshould be fun!

Web编程应该是乐趣无穷。

This is my mostpersonal goal for writing Wicket . None of the existing frameworks areappealing to me in terms of intuitiveness, quickness, ease of development,
etc.It is my hope that Wicket represents a significant step in the direction ofmaking web applications easy and fun to write.

Web它变得更有趣——这是我写的Wicket最个人的目标。

没有一个现有框架的吸引了我眼球,我希望能有一个直观的,高速,易于开发框架。Wicket作Web应用程序的更多easy有感兴趣的实现!

Meet Apache Wicket的更多相关文章

  1. apache wicket 7.X之HelloWorld

    Wicket是什么 Wicket一个开发Java Web应用程序框架. 它使得开发web应用程序变得easy而轻松. Wicket利用一个POJO data beans组件使得它能够与不论什么持久层技 ...

  2. apache开源项目 -- Wicket

    [infoq] Apache Wicket是一个功能强大.基于组件的轻量级Web应用框架,能将展现和业务逻辑很好地分离开来.你能用它创建易于测试.调试和支持的高质量Web 2.0应用.假设其他团队交付 ...

  3. Apache Nutch v2.3 发布,Java实现的网络爬虫

    http://www.oschina.net/news/59287/apache-nutch-2-3 Apache Nutch v2.3已经发布了,建议所有使用2.X系列的用户和开发人员升级到这个版本 ...

  4. 使用maven在netbeans下构建wicket项目

    在netbeans下构建wicket项目,网上流传较多的方法是直接使用netbeans的wicket插件,这种方法虽然简单,但是依赖的wicket版本较老,更新较慢,并且很容易与其他第三方库不兼容.使 ...

  5. How to setup Wicket Examples in Eclipse

    Wicket examples is a good place to learn Apache Wicket by examples, and a must reference site for ne ...

  6. Wicket Hello World Example

    A simple hello world example in Wicket, show the basic structure of Wicket web application. Tools an ...

  7. Apache 项目列表功能分类便于技术选型

    big-data (49):  Apache Accumulo  Apache Airavata  Apache Ambari  Apache Apex  Apache Avro  Apache Be ...

  8. 15个具有高度影响力的Apache开源项目

    自1999年创立以来,Apache软件基金会如今已成了众多重要的开源软件项目之家.其中成功的项目有Geronimo,有Tomcat,有Hadoop,有如今成了大数据王国关键车毂的分布式计算系统. 虽然 ...

  9. 什么是Apache Isis

    这个页面展示了一个现代的 Apache Isis 应用程序的外观. 下边是Isis 插件里的 todoapp 示例 (非 ASF)截图,你可以随意使用. 界面里对应的领域类可以在这里找到. 这个 to ...

随机推荐

  1. Swift - 可选类型说明

    可选类型是Swift的一个特色.它表示一个变量有可能有值,也可能没有值(nil). 声明的方式是“数据类型+问号”. 而当要使用一个可选类型的变量是,要在后面加感叹号“!”. 1 2 3 4 5 6 ...

  2. JVM学习笔记(一)------的基本结构

    从Java视台的逻辑结构.我们能够从图中学习JVM: 您可以从图表清楚地看到Java该平台包括各种逻辑模块.还可以学习JDK与JRE差异 于JVM它们的物理结构,我们可以看一下从图计划: 为JVM学习 ...

  3. alv 列标题

    gs_fieldcat-reptext_ddic才是显示列标题的

  4. Linux I/O 重定向详解及应用实例

    Linux I/O 重定向详解及应用实例 简解 > 输出 < 输入 >> 追加 & [> | < | >>]之前:输入输出; ls /dev & ...

  5. HADOOP之MAPREDUCE程序应用二

    摘要:MapReduce程序进行单词计数. 关键词:MapReduce程序  单词计数 数据源:人工构造英文文档file1.txt,file2.txt. file1.txt 内容 Hello   Ha ...

  6. 条款38 通过复合塑膜出has-a或&quot;依据某物实现&quot;

    结论: 复合的意义和public继承全然不同. (public继承參考:条款32 确定你的public继承塑模出is-a关系) 在应用域,复合意味着has-a(有一个).在实现域,复合意味着is-im ...

  7. svn强制用户提交时写日志

    #!/bin/sh REPOS="$1" TXN="$2" SVNLOOK=/usr/bin/svnlook #根据你的SVN目录而定 LOGMSG=`$SVN ...

  8. Window平台搭建Redis分布式缓存集群 (一)server搭建及性能測试

    百度定义:Redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对很多其它.包含string(字符串).list(链表).set(集合).zset(sort ...

  9. openwrt 3g模块上网

    硬件环境:     开发板为RT5053F        3G模块为中兴 MC2176 电信版 以下是操作步骤 加入VID .PID VID . PID 的获取方法是 将设备插入电脑在linux下执行 ...

  10. HDU1176:免费馅饼(DP)

    Problem Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼.说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁 ...