﻿<?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-hengheng123456789-随笔分类-JAVA-Web</title><link>http://www.blogjava.net/hengheng123456789/category/17310.html</link><description /><language>zh-cn</language><lastBuildDate>Mon, 03 Sep 2007 13:52:38 GMT</lastBuildDate><pubDate>Mon, 03 Sep 2007 13:52:38 GMT</pubDate><ttl>60</ttl><item><title>Easy Ajax with Struts 2</title><link>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142400.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Mon, 03 Sep 2007 09:41:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142400.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/142400.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142400.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/142400.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/142400.html</trackback:ping><description><![CDATA[<p>A while back , I wrote an article for O&#8217;Reilly&#8217;s sister site , Java.net about <a href="http://today.java.net/pub/a/today/2005/10/27/sprinkle-ajax-magic-into-struts-webapp.html"><strong>How to add Ajax to your Struts Application</strong></a>. While it was pretty straightfoward (as is Ajax underneath all the hype), it still involved a little to much JavaScript for my liking. Nothing against JavaScript, but if you write it , you have to support it. Far better to use a standard Ajax library , like DWR , Prototype or Dojo.</p>
<p>So , along comes Struts 2. <a href="http://www.firstpartners.net/blog/technology/java/2006/12/18/struts-2-is-the-new-mini/">Be careful - it&#8217;s good , but a different beast under the covers from Struts 1</a>. It does a lot of things better - for example , the way it has Actions as normal POJO&#8217;s makes it a lot of things easier to unit test. </p>
<p>Struts 2 also gives you Ajax &#8216;out of the box&#8217;. No writing of javascript, no debugging against various browsers; just configure and go. A full description of <a href="http://www.firstpartners.net/kb/index.php/Easy_Ajax_using_Struts_2"><strong>how to setup Struts 2 to use Ajax is in this wiki article</strong></a>. The quick version is:</p>
<p>1. Setup Struts 2<br />
2. Add the Struts-Ajax URL and Div Tag.</p>
<p>That&#8217;s it. Ajax without the fuss.</p>
<p>Even better that the Struts guys have implemented the Ajax functionality using the Prototype Ajax Library, so you get the benefit of all the improvements there. </p>
<p>What do you think? Will you move to Struts 2 just for the new Ajax capabilities?</p>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/142400.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2007-09-03 17:41 <a href="http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142400.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Using Drools in Your Enterprise Java Application</title><link>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142394.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Mon, 03 Sep 2007 09:28:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142394.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/142394.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142394.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/142394.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/142394.html</trackback:ping><description><![CDATA[<h2>Using Drools in Your Enterprise Java Application</h2>
by <a href="http://www.onjava.com/pub/au/2366">Paul Browne</a><br />
08/24/2005
<p>These days enterprise Java could almost put you to sleep. How many hundreds of J2EE-EJB web applications have been written that capture information from a web page and store it in a database? What really keeps developers awake at night is trying to write and maintain the complex business logic in their applications. This is a problem not only for new applications, but increasingly, for long-lived, business-critical apps whose internal logic needs to change frequently, often at very short notice.</p>
<p>In an earlier article, "<a href="http://www.onjava.com/pub/a/onjava/2005/08/03/drools.html">Give Your Business Logic a Framework with Drools</a>," I introduced the Drools framework and showed how it could be used to organize complicated business logic. Drools replaced many tangled <code>if ... then</code> statements with a simple set of things known to be true. If you are ever in a meeting with business customers, and your head hurts with the complexity of what they want you to implement, then maybe you should consider a rule engine such as Drools. This article will show you how you can do this in an enterprise Java application.</p>
<h3>Frameworks All the Way Down</h3>
<p>Most enterprise Java developers already have their favorite frameworks. In no particular order, these include presentation frameworks (Struts, JSF, Cocoon, and Spring), persistence frameworks (JDO, Hibernate, Cayenne, and Entity Beans) and structural frameworks (EJB, Spring again, Pico, and Excalibur), as well as many others. Each framework does one very useful thing (or more), and gives developers a lot of instant "out of the box" functionality. Deploying an application using frameworks means you avoid a lot of the boring bits and concentrate on what is really needed.</p>
<p>Until now, there was a gap in what the frameworks were able to do, in that business logic had no framework. Tools like EJB and Spring are good, but have little to say about how to organize your <code>if ... then</code> statements! Adding Drools to your developer toolbox means that it is now possible to build an application with "frameworks all the way down." Figure 1 shows a diagram of such an application.</p>
<p><img height="386" alt="Figure 1" src="http://www.onjava.com/onjava/2005/08/24/graphics/diagramB1.gif" width="442" /><br />
<em>Figure 1. Frameworks for Java applications</em></p>
<p>This article will build on what we already know of the Drools framework and allow us to build such an application.</p>
<h3>When Should I Use a Rule Engine?</h3>
<!-- sidebar begins --><br />
<p>It's almost a cliche in software engineering to say that "if you have a hammer, everything looks like a nail." While rule engines can solve a lot of problems for us, it is worth considering whether a rule engine is really appropriate for our enterprise Java application. Some questions to ask are:</p>
<ul>
    <li><strong>How complex is my application?</strong> For applications that shuffle data to and from a database, but not much more, it is probably best not to use a rule engine. However, where there is even a moderate amount of processing implemented in Java, it is worthwhile to consider the use of Drools. This is because most applications develop complexity over time, and Drools will let you cope easily with this.
    <li><strong>What is the lifetime of my application?</strong> The answer to this is often "surprisingly long"--remember the mainframe programmers who thought their applications wouldn't be around for the year 2000? Using a rule engine pays off, especially in the medium to long term. As this article demonstrates, even prototypes can benefit from the combination of Drools and agile methods to take the "prototype" into production.
    <li><strong>Will my application need to change?</strong> The only sure thing about your requirements is that they will change, either during or just after development. Drools helps you cope with this by specifying the business rule in one or more easy-to-configure XML files. </li>
</ul>
<h3>What About Performance?</h3>
<p>If you're writing an enterprise application, chances are that it will need to scale to hundreds, if not thousands, of users. You know that existing Java and J2EE applications can do this, but how will a application using Drools cope with this pressure? The answer is "surprisingly well." While most developers hate to "lose control" and rely on other people's code (i.e., a framework), consider the points below--not only should your application be as fast as "traditional" coding methods, but Drools may even make your application run faster:</p>
<ul>
    <li><strong>Avoids badly written code:</strong>&nbsp;Drools guides developers to do "the right thing." You may be sure the code you are writing is good, but would you say the same for the code of your co-developers? Using a framework makes it easier to write good, fast code.
    <li><strong>Optimized framework:</strong>&nbsp;How often have you seen business logic that repeatedly accesses a database for the same information, slowing down the entire application? Used correctly, Drools can remember not only the information, but also the results of previous tests using this information, giving the entire application a speed boost.
    <li><strong>Rete algorithm:</strong>&nbsp;Many times we apply "if" conditions that we didn't really need. The Rete algorithm, as implemented by Drools, replaces all of the <code>if ... then</code> statements with an optimized network. It is important to note that the Rete algorithm involves a tradeoff between using more memory to reduce delays at run time. While this isn't a factor in most modern servers, we wouldn't yet recommend deploying Drools on your mobile phone! </li>
</ul>
<br />
<br />
<h3>Where Were We?</h3>
In our <a href="http://www.onjava.com/pub/a/onjava/2005/08/03/drools.html">previous article</a>, we wrote a simple stock trading application based around the Drools engine. We implemented various business rules, showed how we could rapidly change the rules to meet changing business requirements, and wrote JUnit tests to give us a high degree of confidence that the system would act as it was supposed to. However, the application as we left it had little or no user interface, and used hard-coded data instead of a database. To evolve our application into something that is more enterprise level, we need to add two main things:
<ul>
    <li>Some sort of user interface, ideally based one of the standard web-presentation frameworks.
    <li>A Data Access Object (DAO) to let Drools work with a database (or other back end system). </li>
</ul>
<h4>Calling the Rule Engine from a Presentation Framework</h4>
<p>Most enterprise Java applications are accessed using a web interface, and one of the most widely adopted web-presentation frameworks is <a href="http://struts.apache.org/">Struts</a>, from Apache. Ideally, we'll write our application so that the presentation layer knows about the business layer underneath, but not the other way around. This has the advantage not only of allowing us to change the presentation framework at a later date (e.g., to an Ajax or <a href="http://en.wikipedia.org/wiki/Web_service">web service</a> interface), but also means the code examples give should be readily applicable to other web frameworks like Spring.</p>
<br />
<p>The following code snippet demonstrates how to call the business logic tier (using the rule engine) from the web presentation layer. The code uses the results to decide which page to display. In this sample, we use a Struts action, but the code is similar for any other web framework or even a servlet or a JSP page. This snippet works with a supporting <em>struts-config.xml</em>, JSP pages to post/display data, and a way of generating the WAR file for deployment. The snippet shows how to integrate the rule engine with the web framework.</p>
<pre><code>
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import BusinessLayer;
/**
* Sample Struts action with Pseudocode
*/
public class SampleStrutsAction extends Action{
/**
* Standard Struts doPerfom method
*/
public ActionForward doPerform(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws InvalidEntryPointException {
//Local Variables
StockOffer userOffer =null;
//Get any previous values from the session
userOffer=(StockOffer)request.getSession()
.getAttribute("PREVIOUS_STOCK_OFFER");
//create this object if it is null
if (null==userOffer){
userOffer = new StockOffer();
}
//Update with the incoming values
//These values match those on the form
userOffer.setStockName(request.
getParameterValue("STOCK_NAME"));
userOffer.setStockPrice(request
.getParameterValue("STOCK_PRICE"));
userOffer.setStockQuantity(request
.getParameterValue("STOCK_QTY"));
//Reset the output value
userOffer.setRecommendPurchase(null);
//Call the Business Layer
BusinessLayer
.evaluateStockPurchase(userOffer);
//Forward to the appropriate page
if ("YES".equals(
testOffer.getRecommendPurchase()){
return mapping.findForward("YES_WEB_PAGE");
}
//otherwise default to the no page
return mapping.findForward("NO_WEB_PAGE");
}
}</code>
</pre>
<p>There are a couple of things going on this sample. Often, we build up the data we need from the user over several web pages, so this sample shows how we can achieve this by retrieving the <code>StockOffer</code> object that we have previously stored in the web server session. Next, we update the <code>StockOffer</code> with any values that the user may have changed on the web page. We then reset the <code>recommendPurchase</code> flag to clear any previous results before we call the business logic layer. Finally, we take the response of the business logic and use it to decide which page to forward the user to.</p>
<p>In this example, note how we split the business logic (yes/no on whether or not to buy a stock) from the presentation logic (decide which page to go to). This allows us to reuse our business rules across several different applications In addition, take look at how the state information (i.e., things that the user has already told us) is stored in the <code>StockOffer</code> object/web server session, and not in the business layer. By keeping the business layer stateless in this way, we make the entire application much more scalable and performant.</p>
<br />
<h3>Integrating the Rule Engine with the Database Layer</h3>
<p>So far, our application has a web presentation layer and a rules engine for the business layer, but no means of getting data to and from a database. This section gives an example of how to do this. We base our example on the <a href="http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html">Data Access Object</a> (DAO) pattern, where we encapsulate all code that "talks" to the database (or back-end data source) in one pluggable, configurable class. As such, the example is applicable to other persistence frameworks, such as Hibernate and Cayenne.</p>
<br />
<p>Some important points about the way we want to organize the data layer are:</p>
<ul>
    <li>Only the business layer should talk to the data layer; if a class in the presentation layer (front end) wants some data, it should pass through the business layer first. This helps makes our code easier to organize and read.
    <li>As far as possible, we should keep our data layer stateless--we should hold client data elsewhere (e.g., in the server session at the web front end, as per the previous example). This is distinct from caching of data, which we can do at this level. The difference between the two is state information is often user-specific, while data we cache at the data access layer is mainly sharable across the application. Organizing our layer in this way increases performance.
    <li>We should allow the business logic to decide if data is needed or not--if not needed, the call to get the data should not be made. </li>
</ul>
<p>To implement our simple Data Access Object, we create three new objects: <code>StockNameDao</code>, <code>DaoImplementation</code>, and <code>DaoFactory</code>.</p>
<p><code>StockNameDao</code> is an interface that defines two methods: <code>getStockNames()</code> returns a list of the stock names that we deal with, and <code>isOnStockList()</code> checks that a given stock is on the list of stocks that we deal with. Our business layer will call these methods as and when it needs the information.</p>
<p><code>DaoImplementation</code> is an actual implementation of <code>StockNameDao</code>. In this case the values are hard-coded, but we could have queried a database or accessed an information system like Bloomberg via a web service.</p>
<p><code>DaoFactory</code> is what we use to create an appropriate instance of <code>StockNameDao</code>. The advantage this approach has over creating the class directly is that it allows us to configure what DAO implementation we use at runtime (frameworks like Spring are especially good at this). One factory can return many types of DAOs (e.g., <code>StockNameDao</code>, <code>StockPriceDao</code>, <code>StockHistoryDao</code>), which means we can pass in our <code>DaoFactory</code>, and let the individual rules decide on the data and DAOs that they require.</p>
<p>Here's what the <code>StockNameDao</code> interface looks like:</p>
<pre><code>
/**
* Defines a Data Access Object - a non data
* source specific way of obtaining data.
*/
public interface StockNameDao {
/**
* Get a list of stock names for the application
* @return String[] array of stock names
*/
public String [] getStockNames();
/**
* Check if our stock is on the list
* @param stockName
* @return
*/
public boolean isOnStockList(String stockName);
}</code>
</pre>
<p>And here's the <code>DaoImplementation</code>:</p>
<pre><code>
/**
* Concrete Definition of a Data Access Object
*/
public class DaoImplementation
implements StockNameDao {
/**
* Constructor with package level access only
* to encourage use of factory method
*
*/
DaoImplementation(){}
/**
* Get a list of stock names for the app.
* This is a hard coded sample
* normally we would get this from
* a database or other datasource.
* @return String[] array of stock names
*/
public String[] getStockNames() {
String[] stockNames=
{"XYZ","ABC","MEGACORP","SOMEOTHERCOMPANY"};
return stockNames;
}
/**
* Check if our stock is on the list
* @param stockName
* @return true / false as appropriate
*/
public boolean isOnStockList(String stockName){
//Get our list of stocks
String stockList[] = getStockNames();
//Loop and see if our stock is on it
// done this way for clarity . not speed!
for (int a=0; a&lt;stockList.length;a++){
if(stockList[a].equals(stockName)){
return true;
}
}
//Default return value
return false;
}
}</code>
</pre>
<p>The simple <code>DaoFactory</code> just returns a <code>DaoImplementation</code>:</p>
<pre><code>
package net.firstpartners.rp;
/**
* Factory Method to get the Data Access Object.
* Normally we could replace this with a
* framework like Spring or Hibernate
*/
public class DaoFactory {
/**
* Get the stock name Dao
* This sample is hardcoded - in reality
* we would make this configurable / cache
* instances of the Dao as appropriate
* @return an instance of StockNameDao
*/
public static StockNameDao getStockDao(){
return new DaoImplementation();
}
}
</code>
</pre>
<br />
<p>Now that we have our simple DAO implementation to serve as our database layer, how do we integrate it with the Drools business layer? The updated business rules file, <em>BusinessLayer.xml</em>, shows us how.</p>
<br />
<pre><code>
&lt;?xml version="1.0"?&gt;
&lt;rule-set name="BusinessRulesSample"
xmlns="http://drools.org/rules"
xmlns:java="http://drools.org/semantics/java"
xmlns:xs="
http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="
http://drools.org/rules rules.xsd
http://drools.org/semantics/java java.xsd"&gt;
&lt;!-- Import the Java Objects that
we refer to in our rules --&gt;
&lt;java:import&gt;
java.lang.Object
&lt;/java:import&gt;
&lt;java:import&gt;
java.lang.String
&lt;/java:import&gt;
&lt;java:import&gt;
net.firstpartners.rp.StockOffer
&lt;/java:import&gt;
&lt;java:import&gt;
net.firstpartners.rp.DaoFactory
&lt;/java:import&gt;
&lt;java:import&gt;
net.firstpartners.rp.StockNameDao
&lt;/java:import&gt;
&lt;!-- Application Data not associated --&gt;
&lt;!-- with any particular rule --&gt;
&lt;!-- In this case it's our factory --&gt;
&lt;!-- object which gives us back --&gt;
&lt;!-- a handle to whatever Dao (Data --&gt;
&lt;!-- access object) that we need --&gt;
&lt;application-data
identifier="daoFactory"&gt;DaoFactory
&lt;/application-data&gt;
&lt;!-- A Java (Utility) function --&gt;
&lt;! we reference in our rules --&gt;
&lt;java:functions&gt;
public void printStock(
net.firstpartners.rp.StockOffer stock)
{
System.out.println(
"Name:"+stock.getStockName()
+" Price: "+stock.getStockPrice()
+" BUY:"+stock.getRecommendPurchase());
}
&lt;/java:functions&gt;
&lt;!-- Check for XYZ Corp--&gt;
&lt;rule name="XYZCorp" salience="-1"&gt;
&lt;!-- Parameters we can pass into--&gt;
&lt;!-- the business rule --&gt;
&lt;parameter identifier="stockOffer"&gt;
&lt;class&gt;StockOffer&lt;/class&gt;
&lt;/parameter"&gt;
&lt;!-- Conditions that must be met for --&gt;
&lt;!-- business rule to fire --&gt;
&lt;java:condition&gt;
stockOffer.getStockName().equals("XYZ")
&lt;/java:condition&gt;
&lt;java:condition&gt;
stockOffer.getRecommendPurchase() == null
&lt;/java:condition&gt;
&lt;java:condition&gt;
stockOffer.getStockPrice() &gt; 10
&lt;/java:condition&gt;
&lt;!-- What happens when the business --&gt;
&lt;!-- rule is activated --&gt;
&lt;java:consequence&gt;
stockOffer.setRecommendPurchase(
StockOffer.NO);
printStock(stockOffer);
&lt;/java:consequence&gt;
&lt;/rule&gt;
&lt;!-- Ensure that negative prices --&gt;
&lt;!-- are not accepted --&gt;
&lt;rule name="Stock Price Not Negative"&gt;
&lt;!-- Parameters we can pass into the --&gt;
&lt;!-- business rule --&gt;
&lt;parameter identifier="stockOffer"&gt;
&lt;class&gt;StockOffer&lt;/class&gt;
&lt;/parameter&gt;
&lt;!-- Conditions for rule to fire --&gt;
&lt;java:condition&gt;
stockOffer.getStockPrice() &lt; 0
&lt;/java:condition&gt;
&lt;!--When rule is activated then ... --&gt;
&lt;java:consequence&gt;
stockOffer.setRecommendPurchase
(StockOffer.NO);
printStock(stockOffer);
&lt;/java:consequence&gt;
&lt;/rule&gt;
&lt;!-- Check for Negative Prices--&gt;
&lt;rule name="Stock Price Low Enough"&gt;
&lt;!-- Parameters for the rule --&gt;
&lt;parameter identifier="stockOffer"&gt;
&lt;class&gt;StockOffer&lt;/class&gt;
&lt;/parameter&gt;
&lt;!-- Now uses Dao to get stock list --&gt;
&lt;java:condition&gt;
daoFactory.getStockDao().isOnStockList(
stockOffer.getStockName())
&lt;/java:condition&gt;
&lt;java:condition&gt;
stockOffer.getRecommendPurchase() == null
&lt;/java:condition&gt;
&lt;java:condition&gt;
stockOffer.getStockPrice() &lt; 100
&lt;/java:condition&gt;
&lt;!-- When rule is activated do this --&gt;
&lt;java:consequence&gt;
stockOffer.setRecommendPurchase(
StockOffer.YES);
printStock(stockOffer);
&lt;/java:consequence&gt;
&lt;/rule&gt;
&lt;/rule-set&gt;
</code>
</pre>
<p>There are several changes to this file to integrate the data access layer with our business rules:</p>
<ul>
    <li>At the top of the file, we have several new <code>&lt;java:import&gt;</code> statements to reference the <code>StockNameDao</code>, <code>DaoImplementation</code>, and <code>DaoFactory</code> classes that we added to the system.
    <li>We have a new tag, <code>&lt;application-data&gt;</code>, which assigns an instance of the <code>DaoFactory</code> class to a variable. <code>&lt;application-data&gt;</code> tags are similar to parameters, except they apply to all business rules, and not just one.
    <li>The <code>Stock Price Low Enough</code> rule has a new condition, which uses the <code>DaoFactory</code> and <code>StockNameDao</code> to check if the stock is on the list of those that we deal with. </li>
</ul>
<p>We run our <code>BusinessRulesTest</code> (simulator) again. The simulator/unit tests run OK, since even though we have changed the structure of the program, we haven't (yet) changed what it does. From looking at the output logs, we can see that our business rules are using <code>StockNameDao</code> as part of their evaluations, and that <code>DaoImplementation.isOnStockList()</code> is being called.</p>
<p>While this example shows the reading of information from a data source, the principles are the same for writing information, if that is what a rule has decided should be done. The differences would be that our DAO would have a <code>setSomeInformation()</code> method, and that the method would be called in the <code>&lt;java:consequence&gt;</code> part of the business rule, once the specific conditions had been met.</p>
<!-- sidebar begins --><!-- don't move sidebars --><!-- sidebar ends -->
<h3>Summary</h3>
<p>In this article, we showed that most Java server applications have three tiers: presentation, business logic, and data persistence. While the use of frameworks is widely accepted in the presentation and persistence layers, until now no framework has been available to encapsulate low-level business logic. As we've seen in the examples, Drools and JSR-94 are ideal candidates for reducing the complexity and speeding the development of Java applications. I hope that these examples inspire you to take a closer look at rule engines, and that they save many hours of development and maintenance time in your applications.</p>
<h3>Resources</h3>
<ul>
    <li><a href="http://sourceforge.net/project/showfiles.php?group_id=99476&amp;package_id=158438">Sample code for this article</a>
    <li><a href="http://www.drools.org/">Drools Project home page</a>
    <li><a href="http://www.jroller.com/page/eu/20040810">Information on Drools rules</a>
    <li>"<a href="http://www.theserverside.com/articles/article.tss?l=Drools">Introduction to Drools and Rule Engines</a>," by the Drools project lead.
    <li><a href="http://www.geocities.com/CapitolHill/5910/drltk/instructions.htm">Drools rules schema files</a>
    <li><a href="http://javaboutique.internet.com/tutorials/rules_engine/">JSR-94: Java Rule Engines, Overview</a>
    <li><a href="http://struts.apache.org/">Struts framework website</a>
    <li><a href="http://www.springframework.org/">Spring framework website</a>
    <li><a href="http://www.hibernate.org/">Hibernate website</a>
    <li><a href="http://www.junit.org/">JUnit test framework</a>
    <li><a href="http://herzberg.ca.sandia.gov/jess/index.shtml">Jess Java rule engine</a>
    <li><a href="http://jena.sourceforge.net/">Jena semantic and rule engine</a>
    <li><a href="http://jcp.org/aboutJava/communityprocess/review/jsr094/">JSR-94 home page</a>
    <li><a href="http://www.manning.com/friedman-hill">Jess in Action home page</a>
    <li>"<a href="http://herzberg.ca.sandia.gov/jess/zen.shtml">Business Rule Thinking</a>" (Jess-based)
    <li><a href="http://www.aaai.org/AITopics/html/expert.html">General introduction to rule systems</a>
    <li>"<a href="http://herzberg.ca.sandia.gov/jess/docs/61/rete.html">Jess implementation of the Rete algorithm</a>" </li>
</ul>
<p><em><a href="http://www.onjava.com/pub/au/2366">Paul Browne</a> , based in Dublin, Ireland, has been consulting in enterprise Java with <a href="http://www.firstpartners.net/rp">FirstPartners.net</a> for almost seven years. </em></p>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/142394.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2007-09-03 17:28 <a href="http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142394.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MINA Beginning</title><link>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142325.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Mon, 03 Sep 2007 07:38:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142325.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/142325.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142325.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/142325.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/142325.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;MINA Beginninghttp://mina.apache.org/http://mina.apache.org/documentation.html1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 传统Socket：阻塞式通信在java传统socket技术中，每建立一个Socket连接时，须同时创建一个新线...&nbsp;&nbsp;<a href='http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142325.html'>阅读全文</a><img src ="http://www.blogjava.net/hengheng123456789/aggbug/142325.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2007-09-03 15:38 <a href="http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142325.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Apache MINA 快速入门</title><link>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142326.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Mon, 03 Sep 2007 07:38:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142326.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/142326.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142326.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/142326.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/142326.html</trackback:ping><description><![CDATA[&nbsp;
<p style="text-align: center" align="center"><strong>Apache MINA </strong><strong><span style="font-family: 宋体">快速入门</span></strong></p>
<p><strong>&nbsp;</strong></p>
<p><a href="http://hi.baidu.com/ofbase/blog/item/9acf45d05989f88ea1ec9c11.html">http://hi.baidu.com/ofbase/blog/item/9acf45d05989f88ea1ec9c11.html</a></p>
<p>Added by Mark Webb, last edited by Trustin Lee on Apr 16, 2007&nbsp;&nbsp;&nbsp; (view change) </p>
<p><strong>1&nbsp;&nbsp;&nbsp; </strong><strong><span style="font-family: 宋体">简介</span></strong></p>
<p><span style="font-family: 宋体">建立一个基于</span>MINA<span style="font-family: 宋体">的时间服务器，下面的内容需要先准备好。</span></p>
<p>MINA 1.1 Core <br />
JDK 1.5 or greater <br />
SLF4J&nbsp;&nbsp;&nbsp; 1.3.0 or greater <br />
&gt;&gt;Log4J 1.2 users: slf4j-api.jar, slf4j-log4j12.jar, and Log4J&nbsp;&nbsp;&nbsp; 1.2.x <br />
&gt;&gt;Log4J 1.3 users: slf4j-api.jar, slf4j-log4j13.jar, and Log4J&nbsp;&nbsp;&nbsp; 1.3.x <br />
&gt;&gt;java.util.logging users: slf4j-api.jar and slf4j-jdk14.jar </p>
<p><span style="font-family: 宋体">这个程序只测试了</span>Windows2000pro<span style="font-family: 宋体">和</span>Linux<span style="font-family: 宋体">系统，并且在做的时候没有依赖于一些开发平台的环境。</span></p>
<p><strong>2&nbsp;&nbsp;&nbsp; </strong><strong><span style="font-family: 宋体">编写</span>MINA</strong><strong><span style="font-family: 宋体">时间服务</span></strong></p>
<p><span style="font-family: 宋体">下面先建立一个文件</span>MinaTimeServer.java<span style="font-family: 宋体">，代码如下：</span></p>
<p>public class MinaTimeServer {<br />
&nbsp;&nbsp;&nbsp; public static void main(String[] args) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // code will go here next<br />
&nbsp;&nbsp;&nbsp; }<br />
}</p>
<p><span style="font-family: 宋体">下面会慢慢将这个类写完，这里先定义一个</span>main<span style="font-family: 宋体">用于启动程序。这一步结束后，还需要一个监听连接的对象，因为这个程序是基于</span>TCP/IP<span style="font-family: 宋体">的，这里将增加一个</span>SocketAcceptor<span style="font-family: 宋体">。</span></p>
<p>import org.apache.mina.common.IoAcceptor;<br />
import org.apache.mina.transport.socket.nio.SocketAcceptor;</p>
<p>public class MinaTimeServer {<br />
&nbsp;&nbsp;&nbsp; public static void main(String[] args) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // The following two lines change the default buffer type to 'heap',<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // which yields better performance.<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ByteBuffer.setUseDirectBuffers(false);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ByteBuffer.setAllocator(new SimpleByteBufferAllocator());<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IoAcceptor acceptor = new SocketAcceptor();<br />
&nbsp;&nbsp;&nbsp; }<br />
}</p>
<p><span style="font-family: 宋体">通过这里的</span>SocketAcceptor<span style="font-family: 宋体">类，下面将把它绑定到一个端口上，如果你想增加一个线程模型到该类的话，参考</span>"<span style="font-family: 宋体">配置线程模型</span>"<span style="font-family: 宋体">部分。</span></p>
<p>import java.io.IOException;<br />
import java.net.InetSocketAddress;<br />
import org.apache.mina.common.IoAcceptor;<br />
import org.apache.mina.transport.socket.nio.SocketAcceptor;</p>
<p>public class MinaTimeServer {<br />
&nbsp;&nbsp;&nbsp; private static final int PORT = 9123;</p>
<p>&nbsp;&nbsp;&nbsp; public static void main(String[] args) throws IOException {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ByteBuffer.setUseDirectBuffers(false);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ByteBuffer.setAllocator(new SimpleByteBufferAllocator());</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IoAcceptor acceptor = new SocketAcceptor();</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SocketAcceptorConfig cfg = new SocketAcceptorConfig();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cfg.getSessionConfig().setReuseAddress( true );<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cfg.getFilterChain().addLast( "logger", new LoggingFilter() );<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cfg.getFilterChain().addLast( "codec", new ProtocolCodecFilter( <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new TextLineCodecFactory( Charset.forName( "UTF-8" ))));</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; acceptor.bind( new InetSocketAddress(PORT), new TimeServerHandler(), cfg);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("MINA Time server started.");<br />
&nbsp;&nbsp;&nbsp; }<br />
}</p>
<p><span style="font-family: 宋体">这里定义了一个整型的端口变量，呼叫</span>SocketAcceptor.bind(SocketAddress,IoHandler,cfg)<span style="font-family: 宋体">，第一个参数是要监听的网址，是本地的</span>9123<span style="font-family: 宋体">端口。</span></p>
<p><span style="font-family: 宋体">第二个参数传的是实现</span>IoHandler<span style="font-family: 宋体">接口的类，是服务于所有的客户端请求的。在这里，将会扩展</span>IoHandlerAdapter<span style="font-family: 宋体">类，这类遵循</span>"<span style="font-family: 宋体">适配器设计模式</span>"<span style="font-family: 宋体">的。</span></p>
<p><span style="font-family: 宋体">第三个参数是配置对象，用于配置日志和编码过滤器。每一个信息都会通过在</span>IoAcceptor<span style="font-family: 宋体">中定义的过滤器链的所有过滤器。在这风景点，将会将信息通过日志和编码过滤器。日志过滤器用</span>SL4J<span style="font-family: 宋体">库记录信息，而编码过滤器则反编码所有收到的信息，并且将所有</span>TextLineCodecFactory<span style="font-family: 宋体">发送的信息进行编码。</span></p>
<p><span style="font-family: 宋体">下面就是</span>TimeServerHandler<span style="font-family: 宋体">类的代码：</span></p>
<p>import java.util.Date;<br />
import org.apache.mina.common.IoHandlerAdapter;<br />
import org.apache.mina.common.IoSession;</p>
<p>public class TimeServerHandler extends IoHandlerAdapter {</p>
<p>&nbsp;&nbsp;&nbsp; public void exceptionCaught(IoSession session, Throwable t) throws Exception {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.printStackTrace();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session.close();<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; public void messageReceived(IoSession session, Object msg) throws Exception {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String str = msg.toString();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( str.trim().equalsIgnoreCase("quit") ) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session.close();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Date date = new Date();<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session.write( date.toString() );<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Message written...");<br />
&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp; public void sessionCreated(IoSession session) throws Exception {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Session created...");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( session.getTransportType() == TransportType.SOCKET )<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((SocketSessionConfig) session.getConfig() ).setReceiveBufferSize( 2048 );<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session.setIdleTime( IdleStatus.BOTH_IDLE, 10 );<br />
&nbsp;&nbsp;&nbsp; }<br />
}</p>
<p><span style="font-family: 宋体">这里用于管理信息，覆盖了</span>exceptionCaught<span style="font-family: 宋体">，</span>messageReceived<span style="font-family: 宋体">和</span>sessionCreated<span style="font-family: 宋体">方法，如前所示，该类扩展了</span>IoHandlerAdapter<span style="font-family: 宋体">。</span></p>
<p>exceptionCaught<span style="font-family: 宋体">方法将会打印错误并且关闭对话，对于大多数的情况来讲，这是标准的处理方法，除非能从异常中恢复过来。</span></p>
<p>messageReceived<span style="font-family: 宋体">方法将收到从客户端发来的数据，并且写回当前时间。如果收到了</span>"quit"<span style="font-family: 宋体">，对话将被关闭。该方法将当前时间发往客户端，依赖于你使用的协议编码，发送至方法的对象（第二个参数）会有不同，发送到</span>session.write(Object)<span style="font-family: 宋体">方法的对象类同。如果你没有指定协议编码，则一般会收到</span>ByteBuffer<span style="font-family: 宋体">对象，而发送的也要是</span>ByteBuffer<span style="font-family: 宋体">对象。</span></p>
<p>sessionCreated<span style="font-family: 宋体">方法用于对话初始化，在这里，先打印一条信息，然后判断对话的类型，再设置缓冲大小，这里设置的是</span>2048<span style="font-family: 宋体">个字节。空闲时间设置为</span>10<span style="font-family: 宋体">秒，如果覆盖了</span>sessionIdle<span style="font-family: 宋体">方法，则该方法每</span>10<span style="font-family: 宋体">秒被呼叫一次。</span></p>
<p><strong>3&nbsp;&nbsp;&nbsp; </strong><strong><span style="font-family: 宋体">测试</span></strong></p>
<p><span style="font-family: 宋体">到这里，编译程序。如果成功，那么运行，然后</span>telnet<span style="font-family: 宋体">这个程序，如下所示：</span></p>
<p><span style="font-family: 宋体">客户端内容：</span><br />
<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#117;&#115;&#101;&#114;&#64;&#109;&#121;&#104;&#111;&#115;&#116;">user@myhost</a>:~&gt; telnet 127.0.0.1 9123 <br />
Trying 127.0.0.1... <br />
Connected to 127.0.0.1. <br />
Escape character is '^]'. <br />
hello <br />
Mon Apr 09 23:42:55 EDT 2007 <br />
quit <br />
Connection closed by foreign host. <br />
<a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#117;&#115;&#101;&#114;&#64;&#109;&#121;&#104;&#111;&#115;&#116;">user@myhost</a>:~&gt;</p>
<p><span style="font-family: 宋体">服务端内容：</span><br />
MINA Time server started. <br />
Session created... <br />
Message written... </p>
<p><strong>4 </strong><strong><span style="font-family: 宋体">参考文档</span></strong></p>
<p><strong>&nbsp;&nbsp;&nbsp; Apache MINA Quick Start Guide</strong> <a href="http://mina.apache.org/documentation.html">http://mina.apache.org/documentation.html</a></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Added by Mark Webb, last edited by Trustin Lee on Apr 16, 2007&nbsp;&nbsp;&nbsp; (view change) </p>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/142326.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2007-09-03 15:38 <a href="http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142326.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Wicket Beginning</title><link>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142320.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Mon, 03 Sep 2007 07:32:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142320.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/142320.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142320.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/142320.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/142320.html</trackback:ping><description><![CDATA[&nbsp;
<p style="text-align: center" align="center">Wicket Beginning</p>
<p><a href="http://mywicket.group.javaeye.com/group/blog_post/259300">http://mywicket.group.javaeye.com/group/blog_post/259300</a></p>
<p><span style="font-family: 宋体">一、概貌</span></p>
<p>Wicket<span style="font-family: 宋体">是基于</span>web<span style="font-family: 宋体">应用框架的高级组件，其主要特点：</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">在</span>HTML<span style="font-family: 宋体">和</span>java<span style="font-family: 宋体">之间的明确分隔</span></p>
<p>&nbsp;&nbsp;&nbsp; * OO<span style="font-family: 宋体">组件模式</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">自动状态管理</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">高度生产化</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">低学习投入</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">屏蔽</span>Servlet API<span style="font-family: 宋体">、</span>HTTP<span style="font-family: 宋体">协议细节</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">无需</span>XML<span style="font-family: 宋体">配置文件</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">易于构造可重用组件</span></p>
<p>Struts<span style="font-family: 宋体">是以</span>Model2 MVC <span style="font-family: 宋体">为蓝本构建的</span>web<span style="font-family: 宋体">应用框架。其工作围绕着处理</span>HTTP<span style="font-family: 宋体">请求的</span>action<span style="font-family: 宋体">类来完成。配置方式采用</span>XML<span style="font-family: 宋体">文件。</span></p>
<p><span style="font-family: 宋体">下文将对</span>Wicket<span style="font-family: 宋体">和</span>Struts<span style="font-family: 宋体">在体系、</span>HTTP<span style="font-family: 宋体">请求处理、</span>Servlet API<span style="font-family: 宋体">和</span>HTTP<span style="font-family: 宋体">协议抽取、状态管理、配置这六方面进行比较。</span></p>
<p><span style="font-family: 宋体">二、比较第一方面：体系</span></p>
<p>Struts<span style="font-family: 宋体">体系基于解释每个</span>HTTP<span style="font-family: 宋体">请求并将其定向到某个处理该类型请求的指定</span>Action<span style="font-family: 宋体">类。每个</span>Action<span style="font-family: 宋体">类将处理后的结果返回，并决定下一步走向——通过转发或者重定向到另一个</span>Action<span style="font-family: 宋体">或者将控制权交给输出</span>HTML<span style="font-family: 宋体">的</span>JSP<span style="font-family: 宋体">页面。从技术较大来讲，虽然每个部分之间做到了很好的解耦，但是基于</span>HTTP<span style="font-family: 宋体">请求的处理模式可谓与时代不符（与</span>wicket<span style="font-family: 宋体">相比就是过时了）。两大原因如下：</span></p>
<p>&nbsp;&nbsp;&nbsp; * Struts<span style="font-family: 宋体">并不是真正意义上的纯粹面向对象，每个</span>Action<span style="font-family: 宋体">类定义了一个</span>abstraction<span style="font-family: 宋体">（抽取），但是</span>abstraction<span style="font-family: 宋体">是由</span>HTTP<span style="font-family: 宋体">协议的请求机制决定的，而并非面向对象的分析。</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">除非我们在</span>java<span style="font-family: 宋体">代码中直接输出</span>HTML<span style="font-family: 宋体">（当然除非我们疯了），那么为了输出</span>HTML<span style="font-family: 宋体">我们就要学习另外的主流技术，比如</span>JSP<span style="font-family: 宋体">和自定义</span>tag<span style="font-family: 宋体">。使用在</span>JSP<span style="font-family: 宋体">中使用</span>tag<span style="font-family: 宋体">并非易事，尤其是当我们把这项工作交给美工小组时，这会直接导致两个结果：</span>JSP<span style="font-family: 宋体">代码被他人作的一沓糊涂，或者是我们自己完成这项任务。</span></p>
<p><span style="font-family: 宋体">而</span>Wicket<span style="font-family: 宋体">的处理方式则不同，从整体来讲应该说是更加优雅些。它采用面向对象的组件技术实现</span>web<span style="font-family: 宋体">与用户的交互（这点有些如</span>Swing<span style="font-family: 宋体">）。在</span>Wicket<span style="font-family: 宋体">中的每一页是由若干的使用组合设计模板生成的组件构成。页面和组件各自渲染自己，并直接或者间接的与</span>markup<span style="font-family: 宋体">文件（标识文件，形式就像</span>JSP<span style="font-family: 宋体">）关联。当</span>HTTP<span style="font-family: 宋体">请求到来时，这些请求被转换、传递到组件上的相应事件中来，这一点与微软的</span>VS<span style="font-family: 宋体">很相象。所以</span>Wicket<span style="font-family: 宋体">能够解决</span>struts<span style="font-family: 宋体">体系中存在的问题：</span></p>
<p>&nbsp;&nbsp;&nbsp; * Wicket<span style="font-family: 宋体">是完全面向对象的。我们可以利用组件的继承性设计自己的应用。这里不需要为处理</span>HTTP<span style="font-family: 宋体">协议的请求</span>/<span style="font-family: 宋体">响应而作任何工作。</span></p>
<p>&nbsp;&nbsp;&nbsp; * Wicket<span style="font-family: 宋体">所使用的</span>markup<span style="font-family: 宋体">文件与纯粹的</span>HTML<span style="font-family: 宋体">很接近，所以容易上手使用。</span>Wicket<span style="font-family: 宋体">在</span>markup<span style="font-family: 宋体">文件中所引入的内容非常整洁，并符合</span>XHTML<span style="font-family: 宋体">标准。任何了解</span>HTML<span style="font-family: 宋体">的开发者都可以如编辑</span>HTML<span style="font-family: 宋体">文件那样编辑</span>Wicket<span style="font-family: 宋体">的</span>markup<span style="font-family: 宋体">文件，就好似他并不知道这是</span>Wicket<span style="font-family: 宋体">的</span>markup<span style="font-family: 宋体">文件一样。</span></p>
<p><span style="font-family: 宋体">三、</span>HTTP<span style="font-family: 宋体">请求处理</span></p>
<p><span style="font-family: 宋体">在</span>Struts<span style="font-family: 宋体">中，一个</span>HTTP<span style="font-family: 宋体">请求被接收后，</span>Struts<span style="font-family: 宋体">将在配置文件中查找</span>request path<span style="font-family: 宋体">和相应的</span>Action<span style="font-family: 宋体">类。如果这些已经被配置好了，它将将提取请求参数放入到</span>ActionForm bean<span style="font-family: 宋体">中，并执行一些验证。然后</span>HTTP<span style="font-family: 宋体">请求、回应和</span>ActionForm<span style="font-family: 宋体">对象都将作为参数传入到</span>Action<span style="font-family: 宋体">类中。从这点可以看出</span>Action<span style="font-family: 宋体">的开发者掌握着应用的方方面面：他们必须处理</span>HTTP session<span style="font-family: 宋体">，维护</span>HTTP<span style="font-family: 宋体">请求和</span>session<span style="font-family: 宋体">的属性，并在</span>action<span style="font-family: 宋体">执行完时建立需要返回的信息，最后还要返回相应的</span>ActionForward<span style="font-family: 宋体">以使</span>struts<span style="font-family: 宋体">知道下一步在哪里。假如此时</span>ActionForward<span style="font-family: 宋体">将控制权交给了</span>JSP<span style="font-family: 宋体">页面，开发者就要使用</span>struts<span style="font-family: 宋体">自定义的</span>tag<span style="font-family: 宋体">库编写</span>JSP<span style="font-family: 宋体">代码。如此繁复的工作环节很容易出现错误，而且</span>struts<span style="font-family: 宋体">还需要三个位置保持一致：</span>struts XML<span style="font-family: 宋体">配置文件、</span>java Action<span style="font-family: 宋体">类、</span>JSP<span style="font-family: 宋体">自定义</span>tag<span style="font-family: 宋体">。</span></p>
<p><span style="font-family: 宋体">而在</span>Wicket<span style="font-family: 宋体">中，一个</span>HTTP<span style="font-family: 宋体">请求被接收后，</span>Wicket<span style="font-family: 宋体">将确认</span>HTTP<span style="font-family: 宋体">所请求的那个页面和在这个页面关联的组件。如果请求的目的是</span>form<span style="font-family: 宋体">，</span>Wicket<span style="font-family: 宋体">将自动提取请求参数、验证参数、进行一些预先规定好的类型转换、设置</span>form<span style="font-family: 宋体">组件中的</span>model<span style="font-family: 宋体">（模式，这里用法与</span>MVC<span style="font-family: 宋体">中类似，但有不同）值；接着转化请求为相应类型的事件、调用目标组件上的相应事件侦听器，这样就会导致事件处理代码运行来执行业务逻辑；然后，事件处理器还将指定下一步页面的位置，被指定的页面将初始化（如果页面从未被初始化的话）并自动渲染；渲染处理将按照顺序访问每个页面组件，要求它们进行自我渲染。在</span>markup<span style="font-family: 宋体">文件中能够组件仅通过名字与</span>HTML<span style="font-family: 宋体">元素进行映射。</span></p>
<p>Wicket<span style="font-family: 宋体">出色的原因：</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">每个组件知道如何处理自己事件。因此我们只需要将组件放到页面上，编写事件处理器就行了。如果一个页面中存在</span>20<span style="font-family: 宋体">个能引发事件的不同的组件，我们除了进行将它们添加到页面上的工作外没有别的工作。但如果在</span>struts<span style="font-family: 宋体">中，我们可能需要建立</span>20<span style="font-family: 宋体">个不同的</span>Action<span style="font-family: 宋体">类或者一个具有</span>20<span style="font-family: 宋体">个分支语句的</span>Action<span style="font-family: 宋体">类，并要在</span>XML<span style="font-family: 宋体">配置中逐一添加。</span></p>
<p>&nbsp;&nbsp;&nbsp; * Wicket<span style="font-family: 宋体">带给了我们考虑组件</span>/<span style="font-family: 宋体">事件重用的机会。而不用将注意力放到如何处理</span>HTTP<span style="font-family: 宋体">请求和回应上。</span></p>
<p>&nbsp;&nbsp;&nbsp; * <span style="font-family: 宋体">与</span>struts<span style="font-family: 宋体">相比使用</span>Wicket<span style="font-family: 宋体">会降低我们的代码量，这正是重用组件带来的益处。</span>Wicket<span style="font-family: 宋体">本身不使用任何的</span>XML<span style="font-family: 宋体">配置文件。只需要修改</span>web<span style="font-family: 宋体">容器的</span>web.xml<span style="font-family: 宋体">文件中的</span>servlet<span style="font-family: 宋体">声明部分。</span></p>
<p><span style="font-family: 宋体">假如我们曾经编写过</span>Windows API<span style="font-family: 宋体">、并用过</span>Visual Basic<span style="font-family: 宋体">或者</span>Borland Delphi<span style="font-family: 宋体">的话，下面的比较会更加让人印象深刻。使用</span>struts<span style="font-family: 宋体">开发就像使用</span>Windows API<span style="font-family: 宋体">一样：接收原始消息，解码原始消息，然后再处理这些消息。由于</span>Windows API<span style="font-family: 宋体">是基于消息循环工作的，所以系统除了消息回应外不期望任何的返回值。</span></p>
<p><span style="font-family: 宋体">从另一方面看，</span>Dephi<span style="font-family: 宋体">在</span>TApplication<span style="font-family: 宋体">类中隐藏了</span>Windows<span style="font-family: 宋体">消息循环，使开发人员围绕着</span>TApplication<span style="font-family: 宋体">类建立其他的类。原始的系统消息就这样被</span>Dephi<span style="font-family: 宋体">内建类接收，被内建类解析并被确定其接纳者。消息被转换为一个事件，并被传送到某个特定的对象。</span></p>
<p><span style="font-family: 宋体">如</span>Windows<span style="font-family: 宋体">应用程序一样，</span>Wicket<span style="font-family: 宋体">应用也具有服务于文本和</span>HTML<span style="font-family: 宋体">模板的资源文件。从这点看，</span>Wicket<span style="font-family: 宋体">象用</span>Delphi<span style="font-family: 宋体">做桌面开发一样被用来做</span>web<span style="font-family: 宋体">开发。</span></p>
<p><span style="font-family: 宋体">四、</span>Servlet API<span style="font-family: 宋体">和</span>HTTP<span style="font-family: 宋体">协议的抽取</span></p>
<p>Struts<span style="font-family: 宋体">没有隐藏</span>Servlet API<span style="font-family: 宋体">和</span>HTTP<span style="font-family: 宋体">协议的细节。为了使用</span>Struts<span style="font-family: 宋体">，我们必须乐于和</span>HTTPServletRequest<span style="font-family: 宋体">、</span>HttpServletResponse <span style="font-family: 宋体">和</span>HttpSession<span style="font-family: 宋体">类打交道。并围绕着请求和回应建立应用。这便是所有</span>Model2 MVC wen<span style="font-family: 宋体">框架与生俱来的弱点。</span></p>
<p><span style="font-family: 宋体">正如上面说的，</span>Wicket<span style="font-family: 宋体">隐藏了</span>Servlet API<span style="font-family: 宋体">和</span>HTTP<span style="font-family: 宋体">协议的细节。对于一些应用，我们甚至触及不到这些细节。甚至对于非常复杂的应用，我们也仅使用适当的</span>Wicket<span style="font-family: 宋体">协议抽取类。而经常用到的是</span>java<span style="font-family: 宋体">组件类、</span>POJO<span style="font-family: 宋体">业务模型、纯</span>HTML<span style="font-family: 宋体">标记文件。</span></p>
<p><span style="font-family: 宋体">五、状态管理</span></p>
<p><span style="font-family: 宋体">使用</span>Struts<span style="font-family: 宋体">开发，我们将获得全部的状态管理权。这对于建立大规模的、高升级空间的、集群应用来讲是很好的，因为我们将获得对</span>HttpSession<span style="font-family: 宋体">上每件事物的控制权。但是对于中小型应用，我们将没有缘由编写一些额外的代码。这样将导致应用变得复杂和编写费时。</span></p>
<p><span style="font-family: 宋体">在状态管理上，</span>Wicket<span style="font-family: 宋体">可以作为一个不错的选择。</span>Wicket<span style="font-family: 宋体">框架默认代管所有的组件状态。这对于中小型应用，在状态管理上的代码量几乎为</span>0<span style="font-family: 宋体">。但是</span>Wicket<span style="font-family: 宋体">也提供了一些</span>API<span style="font-family: 宋体">使我们进行标准状态管理和实现自己的状态管理。这样，即使是大型应用，我们也能够全权掌握状态管理。事实上，即使在使用</span>Wicket<span style="font-family: 宋体">编写大型应用时，通常也是先让</span>Wicket<span style="font-family: 宋体">代管所有的状态，然后再慢慢的实现自己定义的状态管理以提高应用性能。</span></p>
<p><span style="font-family: 宋体">六、配置</span></p>
<p><span style="font-family: 宋体">不言自明，</span>Struts<span style="font-family: 宋体">需要一个</span>XML<span style="font-family: 宋体">文件：定义对</span>HTTP<span style="font-family: 宋体">请求和响应的映射和所有的</span>ActionForm<span style="font-family: 宋体">对象等。这个文件可能非常大而且复杂。而新版本的</span>Struts<span style="font-family: 宋体">提供了将这个文件分解为多个模块的方法，虽然这样可以将模块分类，但是这样同样要维护许多的小文件。</span></p>
<p>Wicket<span style="font-family: 宋体">不需要配置文件。</span>Wicket<span style="font-family: 宋体">通过一个简单的应用配置类或者通过编写</span>web<span style="font-family: 宋体">容器的</span>web.xml<span style="font-family: 宋体">文件中</span>Servlet init<span style="font-family: 宋体">参数来完成程序的初始化。而</span>HTTP<span style="font-family: 宋体">请求到组件事件的映射、组件如何输出</span>HTML<span style="font-family: 宋体">等被包含在了</span>Wicket<span style="font-family: 宋体">的应用逻辑里，从而极大地简化了配置。</span></p>
<p><span style="font-family: 宋体">七、参考资料</span><br />
<a href="http://wicket.sourceforge.net/" target="_new">http://wicket.sourceforge.net/</a><br />
<a href="http://www.wicket-wiki.org.uk/wiki/index.php/Newuserguide" target="_new">http://www.wicket-wiki.org.uk/wiki/index.php/Newuserguide</a></p>
<p><a href="http://www.blogjava.net/tommyjian/archive/2007/06/10/123202.html">http://www.blogjava.net/tommyjian/archive/2007/06/10/123202.html</a></p>
<p><span style="font-family: 宋体">感谢</span><span style="font-size: 14pt; color: #663300; font-family: Verdana"><a href="http://www.blogjava.net/tommyjian/"><span style="font-family: 'Trebuchet MS'">Tommy Jian </span></a></span></p>
<p><strong><span style="font-family: 宋体">为什么是</span>Wicket</strong><strong><span style="font-family: 宋体">？</span></strong></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">如果您正在寻求使用</span>Java<span style="font-family: 宋体">开发</span>Web<span style="font-family: 宋体">应用程序，目前，您有很多的选择。实际上，存在如此众多的</span>Web<span style="font-family: 宋体">应用程序框架显得有点搞笑。来自于互联网一个博客站点的问题：您能说出多少</span>Java Web<span style="font-family: 宋体">应用框架的名字？他们展现的结果如下：</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">框架，到处都是框架，参看后面附带的表格。</span></p>
<p><strong><span style="font-family: 宋体">为什么要</span>&#8220;</strong><strong><span style="font-family: 宋体">重新发明轮子</span>&#8221;</strong><strong><span style="font-family: 宋体">？</span></strong></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">从这个角度看，您对于</span>&#8220;<span style="font-family: 宋体">另一个</span>Web<span style="font-family: 宋体">应用程序框架有多好</span>&#8221;<span style="font-family: 宋体">这个问题总是耿耿于怀？确实，为什们要</span>&#8220;<span style="font-family: 宋体">重新发明轮子</span>&#8221;<span style="font-family: 宋体">呢？对这个古老的谚语的答复是：因为这一次可以使轮子更圆！</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">但是对于高质量的期待并不是构建</span>Wicket<span style="font-family: 宋体">框架的唯一动因。甚至有很多的观点，认为没有其他的</span>Web<span style="font-family: 宋体">工具集填补这一空白，而</span>Wicket<span style="font-family: 宋体">做到了。实际上，</span>Wicket<span style="font-family: 宋体">与上面提及的众多框架不太一样。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">与</span>Wicket<span style="font-family: 宋体">最相近的或许是</span>Tapestry<span style="font-family: 宋体">和</span>Echo<span style="font-family: 宋体">，但是这种相似性也很有限。和</span>Tapestry<span style="font-family: 宋体">一样，</span>Wicket<span style="font-family: 宋体">使用特定的</span>HTML<span style="font-family: 宋体">属性来标识组件（</span>Components<span style="font-family: 宋体">）声明，这可以方便使用一般的</span>HTML<span style="font-family: 宋体">编辑器进行文件编辑。和</span>Echo<span style="font-family: 宋体">一样，</span>Wicket<span style="font-family: 宋体">拥有一流的组件模型。但是基于</span>Wicket<span style="font-family: 宋体">的应用程序和那些基于</span>Tapestry<span style="font-family: 宋体">和</span>Echo<span style="font-family: 宋体">的应用程序不一样，这是因为从</span>Wicket<span style="font-family: 宋体">框架中两方面都可以受益。您获得了一流的组件模型和对</span>HTML<span style="font-family: 宋体">没有干扰所带来的益处。在很多情况下，这种复合的好处可以带来非常重要的开发优势。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">理解了构建</span>Wicket<span style="font-family: 宋体">的动机有助于您理解为什么</span>Wicket<span style="font-family: 宋体">会表现的不一样。</span></p>
<div align="center">
<table style="width: 240pt" cellspacing="0" cellpadding="0" width="320" border="1">
    <tbody>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>&nbsp;Echo</p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Cocoon </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Millstone </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>OXF </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>&nbsp;Struts</p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>SOFIA</p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Tapestry</p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>WebWork </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>RIFE </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Spring MVC </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Canyamo&nbsp;</p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>&nbsp;Maverick</p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>JPublish </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>JATO </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Folium </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Jucas </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Verge </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Niggle </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Bishop </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Barracuda </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Action Framework </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Shocks </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>TeaServlet</p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>&nbsp;wingS</p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Expresso </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Bento </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>jStatemachine </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>jZonic </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>OpenEmcee </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Turbine </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Scope </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Warfare </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>JMAA </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Jaffa</p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Jacquard </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Macaw </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Smile </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>MyFaces </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Chiba</p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>JBanana </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Jeenius </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>JWarp </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Genie </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Melati </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Dovetail </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Cameleon </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>JFormular </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Xoplon </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Japple </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Helma </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Dinamica </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>WebOnSwing </p>
            </td>
        </tr>
        <tr style="height: 6pt">
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Nacho </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Cassandra </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt">
            <p>Baritus </p>
            </td>
            <td style="padding-right: 0cm; padding-left: 0cm; padding-bottom: 0cm; padding-top: 0cm; height: 6pt"></td>
        </tr>
    </tbody>
</table>
</div>
<p><strong><span style="font-family: 宋体">动机</span></strong></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">目前存在的大多数</span>Web<span style="font-family: 宋体">框架对于服务端的状态管理都仅仅提供了较弱的支持。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">这就意味着在</span>Web<span style="font-family: 宋体">应用程序中存在着很多特殊的代码来处理和维护繁复的状态管理机制。虽然</span>Wicket<span style="font-family: 宋体">并不允许对服务端的状态完全不考虑，但是它在状态管理的简便性和透明化方面做了很多的工作。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">在</span>Wicket<span style="font-family: 宋体">中，所有服务端的状态都被纳入了自动的管理。您始终不需要直接使用</span>HttpSession<span style="font-family: 宋体">对象或者类似的封装对象去存储状态信息。相反，状态信息已经都与组件关联起来，而在组件后端的数据模型都是传统的</span>Java<span style="font-family: 宋体">对象（</span>POJO<span style="font-family: 宋体">）。</span>Wicket<span style="font-family: 宋体">在每个用户会话期内维护着页面的映射表（</span>Map<span style="font-family: 宋体">）。这个页面映射表（以及每个一面内的组件层次）的目的在于使得框架隐藏了组件以及数据模型访问的细节。您只需要处理简单而熟悉的</span>Java<span style="font-family: 宋体">对象，而</span>Wicket<span style="font-family: 宋体">则处理诸如</span>URL<span style="font-family: 宋体">、会话期标识以及</span>GET/POST<span style="font-family: 宋体">请求的任务。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">您接着也会发现这种结构良好的服务端状态使得解决令人恐惧的</span>&#8220;<span style="font-family: 宋体">后退按钮问题</span>&#8221;<span style="font-family: 宋体">变得十分的容易。实际上，针对页面内组件数据模型的结构性变化带来的数据过期，</span>Wicket<span style="font-family: 宋体">提供了通用而且健壮的解决方案，这个方案可以有效地对浏览器缓存页面进行甄别和过期检测。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">最后，</span>Wicket<span style="font-family: 宋体">在设计的时候就考虑与诸如</span>JDO<span style="font-family: 宋体">和</span>Hibernate<span style="font-family: 宋体">的普通</span>Java<span style="font-family: 宋体">对象（</span>POJO<span style="font-family: 宋体">）序列化框架协同工作。这一点使得构建数据驱动的</span>Web<span style="font-family: 宋体">应用程序显得非常简单。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">对于很多应用程序来说，必须在额外服务端状态导致服务器负载增加和其带来的好处之间进行权衡，服务端状态管理可以降低开发成本、减少维护成本、加快对市场的响应时间以及生产高质量的软件。这里提出的基本观点是：软件是十分昂贵、复杂的，而来自于</span>E-machines<span style="font-family: 宋体">和</span>Dell<span style="font-family: 宋体">的服务器则相对便宜。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">在效率和生产性方面，</span>Wicket<span style="font-family: 宋体">对</span>JSP<span style="font-family: 宋体">的优越性则犹如</span>Java<span style="font-family: 宋体">语言对</span>C<span style="font-family: 宋体">语言一样。您使用</span>Wicket<span style="font-family: 宋体">可以实现的功能使用</span>JSP<span style="font-family: 宋体">也都可以实现。甚至于在内存和</span>CPU<span style="font-family: 宋体">消耗方面效率也非常的高。但是使用</span>JSP<span style="font-family: 宋体">开发应用程序则需要耗费您更多的时间。最后，因为在</span>JSP<span style="font-family: 宋体">中进行状态管理时使用了特别的方式，您可能发现不少的安全问题，也能看到到处蹦出来的错误。上面提及的大部分框架在这方面仅仅提供了有限的辅助。</span></p>
<p><strong><span style="font-family: 宋体">大部分现存的框架需要特定的</span>HTML</strong><strong><span style="font-family: 宋体">代码</span></strong></p>
<p>&nbsp;&nbsp;&nbsp; JSP<span style="font-family: 宋体">具有最深的侵入性，它允许将</span>Java<span style="font-family: 宋体">代码直接嵌入</span>Web<span style="font-family: 宋体">页面中。但是，上面列示的框架（除了</span>Tapestry<span style="font-family: 宋体">）都不同程度地针对</span>HTML<span style="font-family: 宋体">代码引入了特殊的语法。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">因为特殊语法改变了单纯而简单的</span>HTML<span style="font-family: 宋体">标记的实质，而</span>Web<span style="font-family: 宋体">设计者对于这一点是十分的熟悉，所以特殊语法并不是十分得人心。而且预览、编辑和理解这种包含特殊语法的</span>HTML<span style="font-family: 宋体">也是十分困难的事情。</span></p>
<p>&nbsp;&nbsp;&nbsp; Wicket<span style="font-family: 宋体">并没引入任何新的</span>HTML<span style="font-family: 宋体">语法。相反，它通过</span>Wicket<span style="font-family: 宋体">命名空间（</span>namespace<span style="font-family: 宋体">）的标准兼容方式扩展了</span>HTML<span style="font-family: 宋体">，这完全兼容</span>XHTML<span style="font-family: 宋体">标准。这意味这您可以使用</span>Macromedia Dreamweaver<span style="font-family: 宋体">、</span>Microsoft Frontpage<span style="font-family: 宋体">、</span>Word<span style="font-family: 宋体">、</span>Adobe Go Live<span style="font-family: 宋体">以及其他现有的</span>HTML<span style="font-family: 宋体">编辑器来编辑您的</span>Web<span style="font-family: 宋体">页面，并且可以和</span>Wicket<span style="font-family: 宋体">的组件协同工作。为了实现这个目标，</span>Wicket<span style="font-family: 宋体">始终在</span>Wicket<span style="font-family: 宋体">命名空间内使用单个</span>id<span style="font-family: 宋体">属性（</span>&#8220;wicket:id&#8221;<span style="font-family: 宋体">）来标识那些需要框架进行特殊处理的标签。如果您并不喜欢将有</span>Wicket<span style="font-family: 宋体">命名空间修饰的标签和属性展示给您的最终用户，通过简单的设置就可以完全消除它们，从而得到普通的与标准兼容的</span>HTML<span style="font-family: 宋体">代码。</span></p>
<p>&nbsp;&nbsp;&nbsp; HTML<span style="font-family: 宋体">中没有特殊的语法意味着设计者可以直接模拟页面，而您可以在开发的过程中直接使用这些页面。向</span>HTML<span style="font-family: 宋体">页面中添加</span>Java<span style="font-family: 宋体">组件就和设置组件的名称属性一样简单。然后，您可以直接将这些页面交给</span>Web<span style="font-family: 宋体">设计人员，他们可以充满信心地对其进行修改。</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">与其他的应用框架相比，</span>Wicket<span style="font-family: 宋体">在各方面的分离上提供更多的支持。</span>Web<span style="font-family: 宋体">设计者在对应用程序代码不甚了解的情况下就可以编辑</span>HTML<span style="font-family: 宋体">（当然，他们不能移除组件名称标签，而且不能任意改变组件嵌套的层次，其他的事情都是可以的）。另一方面，编程者只需要关注与</span>HTML<span style="font-family: 宋体">混在一起的</span>Java<span style="font-family: 宋体">组件，而不需要了解页面的最终陈现是什么样子。通过这种职能清楚的工作方式，每个人都可以工作得更为顺畅。</span></p>
<p><strong><span style="font-family: 宋体">现存的框架易用性不好</span></strong></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">目前存在的大部分框架工具在对象模型方面做得不够。在一些框架中，对象模型是通过特定的</span>XML<span style="font-family: 宋体">来定义的。这些语法令人生厌，而且还需要特定的工具来编辑这些配置信息。由于这些框架并不是单一的</span>Java<span style="font-family: 宋体">类库，您就不能使用包含编辑器、调试器和编译器的</span>IDE<span style="font-family: 宋体">工具来编辑它们。</span></p>
<p>&nbsp;&nbsp;&nbsp; Wicket<span style="font-family: 宋体">是化繁为简的代表。在学习</span>Wicket<span style="font-family: 宋体">的过程中不需要了解任何配置文件。</span>Wicket<span style="font-family: 宋体">就是组件结构良好的普通的类库。在</span>Wicket<span style="font-family: 宋体">中，您的</span>Web<span style="font-family: 宋体">应用程序与普通的</span>Swing<span style="font-family: 宋体">应用程序类似，而不是</span>JSP<span style="font-family: 宋体">应用程序。如果您熟悉</span>Java<span style="font-family: 宋体">（特别是如果您熟悉</span>Swing<span style="font-family: 宋体">），那么您就已经对</span>Wicket<span style="font-family: 宋体">有不少的了解了。</span></p>
<p><strong><span style="font-family: 宋体">现存的框架可复用性不好</span></strong></p>
<p>&nbsp;&nbsp;&nbsp; Tapestry<span style="font-family: 宋体">和</span>JSF<span style="font-family: 宋体">虽然有可以重用的组件模型，但是您将发现与</span>Wicket<span style="font-family: 宋体">相比这并不是特别容易做到的事情。</span>Wicket<span style="font-family: 宋体">从设计之初就十分地注重组件的复用。在</span>Wicket<span style="font-family: 宋体">中，从现有的组件扩展编制诸如</span>SignInPanel<span style="font-family: 宋体">或者</span>AddressForm<span style="font-family: 宋体">的复合组件是十分简单的事情。相对来说，针对浏览器的新特性编制新的组件也是十分容易的事情。</span>Wicket<span style="font-family: 宋体">的组件可以使用</span>JAR<span style="font-family: 宋体">格式进行打包，直接通过库引用的方式就可以实现重用</span>——<span style="font-family: 宋体">不需要任何配置文件！</span></p>
<p>&nbsp;&nbsp;&nbsp; Web<span style="font-family: 宋体">编程应该更关注编程乐趣！</span></p>
<p>&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">这就是我编写</span>Wicket<span style="font-family: 宋体">的个人方面的目标。现存的框架在实现开发的直接性、快捷性和简易性方面真正地吸引我。我希望</span>Wicket<span style="font-family: 宋体">在</span>Web<span style="font-family: 宋体">应用程序开发的建议性和乐趣方面能够迈出重要的一步。</span></p>
<p><strong><span style="font-family: 宋体">目标</span></strong></p>
<p><span style="font-family: 宋体">基于上面的这些动机，下面是</span>Wicket<span style="font-family: 宋体">的目标：</span></p>
<ol style="margin-top: 0cm" type="1">
    <li style="tab-stops: list 36.0pt"><span style="font-family: 宋体">简单（易用性、一致性、易懂性）</span></li>
    <ul style="margin-top: 0cm" type="circle">
        <li style="tab-stops: list 72.0pt">&nbsp;<span style="font-family: 宋体">以</span>POJO<span style="font-family: 宋体">为核心</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">所有代码均使用</span>Java<span style="font-family: 宋体">编写</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">最小的概念域</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">避免过度地使用</span>XML<span style="font-family: 宋体">配置文件</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">全面解决</span>&#8220;<span style="font-family: 宋体">向后按钮</span>&#8221;<span style="font-family: 宋体">问题</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">最大限度地类型安全以及编译检查</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">最大限度地分析运行时错误</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">对特定工具集的最小依赖</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">组件、容器和惯例始终保持一致性</span></li>
    </ul>
    <li style="tab-stops: list 36.0pt"><span style="font-family: 宋体">复用</span></li>
    <ul style="margin-top: 0cm" type="circle">
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">使用</span>Wicket<span style="font-family: 宋体">编制的组件具备高度的复用性</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">可复用的组件可以使用</span>JAR<span style="font-family: 宋体">文件发布</span></li>
    </ul>
    <li style="tab-stops: list 36.0pt"><span style="font-family: 宋体">无侵入</span></li>
    <ul style="margin-top: 0cm" type="circle">
        <li style="tab-stops: list 72.0pt">HTML<span style="font-family: 宋体">以及其他标记性文件不会编程语法所干涉</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">在标记方面只有一个简单的标签</span></li>
        <li style="tab-stops: list 72.0pt">&nbsp;<span style="font-family: 宋体">与任何普通的</span>HTML<span style="font-family: 宋体">编辑器兼容</span></li>
        <li style="tab-stops: list 72.0pt">&nbsp;<span style="font-family: 宋体">图形开发人员很容易识别并避免修改框架标签</span></li>
        <li style="tab-stops: list 72.0pt">&nbsp;<span style="font-family: 宋体">如果设计者不小心删除了标签，则很容易恢复它</span></li>
    </ul>
    <li style="tab-stops: list 36.0pt"><span style="font-family: 宋体">安全</span></li>
    <ul style="margin-top: 0cm" type="circle">
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">默认情况下代码都是安全的</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">在页面和</span>URL<span style="font-family: 宋体">中，只有显式的声明的链接才能公布数据状态</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">具备最大限度类型安全逻辑</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">很容易集成到</span>Java<span style="font-family: 宋体">安全框架</span></li>
    </ul>
    <li style="tab-stops: list 36.0pt"><span style="font-family: 宋体">富有效率，可伸缩性</span></li>
    <ul style="margin-top: 0cm" type="circle">
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">在不牺牲其他目标的前提下保证效率和轻量级</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">可依附的优选会话期支持集群</span></li>
        <li style="tab-stops: list 72.0pt"><span style="font-family: 宋体">通过与可分离模型的协作，会话复制形成的集群很容易实现和调整</span></li>
    </ul>
    <li style="tab-stops: list 36.0pt"><span style="font-family: 宋体">完整</span></li>
    <ul style="margin-top: 0cm" type="circle">
        <li style="tab-stops: list 72.0pt">Wicket<span style="font-family: 宋体">团队乐于为开发</span>Java Web<span style="font-family: 宋体">应用贡献可用的且特性齐全的框架。核心框架是由本篇文档的作者</span>Jonathan Locke<span style="font-family: 宋体">编写和贡献的。目前的团队包括了很多经验丰富的程序员，他们中的一些人还是上面提及的其他框架的开发者，他们也都拥有构建大型</span>Java Web<span style="font-family: 宋体">应用的经验。我们对自己的处境十分的了解，因此也更能从框架使用者的角度来开发</span>Wicket<span style="font-family: 宋体">。</span></li>
    </ul>
</ol>
<p><strong><span style="font-family: 宋体">开发</span>Wicket</strong><strong><span style="font-family: 宋体">的一些网站和资料</span></strong></p>
<p><strong>1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wicket</strong></p>
<p>Wicket<span style="font-family: 宋体">框架的大本营，在这里你可以通过</span>Wiki<span style="font-family: 宋体">了解更多关于</span>Wicket<span style="font-family: 宋体">开发的概念和技巧，还可以下载相关的资源，如</span>Wicket<span style="font-family: 宋体">核心包，</span>Wicket<span style="font-family: 宋体">的扩展包，还有</span>Wicket<span style="font-family: 宋体">自带的例子。</span></p>
<p><a href="http://gocom.primeton.com/modules/newbb/viewforum41.htm">http://gocom.primeton.com/modules/newbb/viewforum41.htm</a>(<span style="font-family: 宋体">本文作者主持的中文论坛</span>)</p>
<p><a href="http://wicket.sourceforge,net/">http://wicket.sourceforge,net</a><span style="font-family: 宋体">（这是</span>Wicket<span style="font-family: 宋体">在</span>sourceforge<span style="font-family: 宋体">的根据地）</span></p>
<p><a href="http://www.wicketframework.org/">http://www.wicketframework.org</a><span style="font-family: 宋体">（这是</span>Wicket<span style="font-family: 宋体">的独立域名）</span></p>
<p><strong>2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wicket-Stuff</strong></p>
<p><span style="font-family: 宋体">因为</span>Wicket<span style="font-family: 宋体">作为一个</span>Web<span style="font-family: 宋体">框架，只可能提供最核心的功能，但是在实际的开发中，需要更多的控件以及辅助的功能，如与</span>Hibernate<span style="font-family: 宋体">的整合，数据分布列表控件等，</span>Wicket-Stuff<span style="font-family: 宋体">就是一个致力于开发</span>Wicket<span style="font-family: 宋体">扩展功能的站点，目前已经提供了以下的扩展功能</span>:</p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">整合</span>Dojo</p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">整合</span>Hibernate<span style="font-family: 宋体">的控件</span>Hibernate (2.1 and 3) components </p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">支持客户端数据验证的控件</span></p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">支持</span>Groovy<span style="font-family: 宋体">脚本编程</span></p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Velocity<span style="font-family: 宋体">控件面板</span></p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">整合</span>Freemarker</p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">整合</span>JasperReports</p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">整合</span>TinyMCE<span style="font-family: 宋体">这个</span>Html<span style="font-family: 宋体">编辑器</span></p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family: 宋体">整合</span>Yahoo Ajax UI<span style="font-family: 宋体">控件</span></p>
<p><a href="http://wicket-stuff.sourceforge.net/">http://wicket-stuff.sourceforge.net/</a></p>
<p><strong>3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wicket-Quickstart</strong></p>
<p>Wicket<span style="font-family: 宋体">虽然入门门框不高，但是许多热心的开发人员还是提供了许多详细的教程，帮助开发人员学习如何在各种</span>IDE<span style="font-family: 宋体">环境下开发</span>Wicket<span style="font-family: 宋体">应用程序。</span></p>
<p><a href="http://wicketframework.org/wicket-quickstart/index.html">http://wicketframework.org/wicket-quickstart/index.html</a>Html</p>
<p><strong>4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wicket-Library</strong></p>
<p>Wicket-Library<span style="font-family: 宋体">也是一个类似于</span>Wicket-Stuff<span style="font-family: 宋体">的站点，它的目的也是为了提供更多的</span>Wicket<span style="font-family: 宋体">控件，为开发人员服务，但是目前并没有提供什么有用的控件。</span></p>
<p><span style="font-family: 宋体">它的网站上提供了</span>Wicket<span style="font-family: 宋体">例子的在线演示，如果你不想在本机上安装</span>Tomcat<span style="font-family: 宋体">，</span>JDK<span style="font-family: 宋体">等软件，就可以在这个网站上看</span>Wicket<span style="font-family: 宋体">提供的例子。</span></p>
<p><a href="http://www.wicket-library.com/">http://www.wicket-library.com/</a></p>
<p><strong>5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DataBinder</strong></p>
<p>DataBinder<span style="font-family: 宋体">是一个将</span>Hibernate<span style="font-family: 宋体">整合到</span>Wicket<span style="font-family: 宋体">中的一个扩展功能，对于那些以数据驱动为开发目的的</span>Web<span style="font-family: 宋体">程序，它是不二之选。</span></p>
<p><a href="http://databinder.net/">http://databinder.net/</a></p>
<p><strong>6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hibernate</strong></p>
<p>Hibernate<span style="font-family: 宋体">本身与</span>Wicket<span style="font-family: 宋体">并没有关系，但是</span>Wicket-Stuff<span style="font-family: 宋体">和</span>DataBinder<span style="font-family: 宋体">都已经提供了</span>Hibernate<span style="font-family: 宋体">的扩展功能，所以把</span>Hibernate<span style="font-family: 宋体">也放入这个列表，方便大家使用</span>Hibernate<span style="font-family: 宋体">。</span></p>
<p><a href="http://www.hibernate.org/">http://www.hibernate.org/</a></p>
<p><strong>7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; QWicket</strong></p>
<p>QWicket<span style="font-family: 宋体">是一些热心的</span>Wicket<span style="font-family: 宋体">开发人员，为了让更多的开发人员了解</span>Wicket<span style="font-family: 宋体">，所以提供了一个很完整的应用程序，它是</span>Wicket<span style="font-family: 宋体">世界中的</span>Appfuse<span style="font-family: 宋体">。</span></p>
<p><a href="http://www.antwerkz.com/qwicket/">http://www.antwerkz.com/qwicket/</a></p>
<p><strong>8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wicket Bench</strong></p>
<p>Wicket Bench<span style="font-family: 宋体">是一个用来辅助</span>Wicket<span style="font-family: 宋体">进行开发的</span>Eclipse<span style="font-family: 宋体">插件工具。前面已经对它进行了详细的介绍。</span></p>
<p><a href="http://www.laughingpanda.org/mediawiki/index.php/wicket_bench">http://www.laughingpanda.org/mediawiki/index.php/Wicket_Bench</a></p>
<p><strong>9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mail-Archive</strong></p>
<p>Mail-Archive<span style="font-family: 宋体">本身不是一个与技术有关的网站，它是一个邮件组归档的站点，常用的邮件组在上面都有归档，如</span>Jakarta<span style="font-family: 宋体">小组的开源软件，</span>Wicket<span style="font-family: 宋体">也在上面，还有许多，在上面可以查看许多</span>Wicket<span style="font-family: 宋体">的讨论，非常的精彩。</span></p>
<p><span style="font-family: 宋体">你可以通过下面的网址直接访问</span>Mail-Archive<span style="font-family: 宋体">网站上</span>Wicket<span style="font-family: 宋体">邮件组的归档</span>:</p>
<p><a href="http://www.mail-archive.com/wicket-user%40lists.sourceforge.net/">http://www.mail-archive.com/wicket-user%40lists.sourceforge.net/</a></p>
<p><strong>10 </strong><strong><span style="font-family: 宋体">一些</span>Blog</strong></p>
<p>Wicket<span style="font-family: 宋体">的开发人员和</span>Wicket<span style="font-family: 宋体">一些资深用户将自己关于</span>Wicket<span style="font-family: 宋体">的开发经验放在自己的</span>Blog<span style="font-family: 宋体">上，与大家共享</span>:</p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.jroller.com/page/dashorst">A Wicket Diary - Martijn Dashorst </a></p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://chillenious.wordpress.com/">Chillenious! - Eelco Hillenius </a></p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.jroller.com/page/jonathanlocke">Jonathan - Jonathan Locke</a> </p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://technically.us/n8/">N8than - Nathan Hamblen </a></p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.antwerkz.com/wp/">Antwerkz - Justin Lee</a> </p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.systemmobile.com/">System Mobile - Nick Heudecker</a> </p>
<p>v&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://blogs.sun.com/geertjan">Geertjan - Geertjan Wielenga </a></p>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/142320.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2007-09-03 15:32 <a href="http://www.blogjava.net/hengheng123456789/archive/2007/09/03/142320.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>FLEX是什么及与FLASH的关系的介绍</title><link>http://www.blogjava.net/hengheng123456789/archive/2007/03/15/104066.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Thu, 15 Mar 2007 10:03:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2007/03/15/104066.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/104066.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2007/03/15/104066.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/104066.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/104066.html</trackback:ping><description><![CDATA[
		<p>
				<span style="FONT-SIZE: 12px">摘自久久学院<br /><br />Flex 是 Macromedia发布的presentation server（展现服务），它是java web container或者.net server的一个应用，根据.mxml文件（纯粹的xml描述文件和actions cript）产生相应得.swf文件，传送到客户端，由客户端的flash player或者shockwave player解释执行，给用户以丰富的客户体验。<br /><br /><br /><br />大名鼎鼎的Macromedia Flash是强大的矢量动画编辑工具，在作动画起家之后，Flash一直在谋求rich internet application(ria富客户端)的霸主地位，最有影响的是，已经推出了面向对象的编成脚本actions cript2.0，并且建立起类似于java swing的类库和相应component(组件)。Flex是通过java或者.net等非Flash途径，解释.mxml文件组织components，并生成相应得.swf文件。Flex的component和flash的component很相似，但是有所改进增强。<br /><br /><br /><br />运用Flash是完全可以做到flex的效果的，为什么还需要flex呢？我理解这里面有两个原因：<br /><br />1，为了迎合更多的developers（开发者）。Flash天生是为了designer（设计者）设计的，界面还有flash的动画概念和写程序的开发人员格格不入，为了吸引更多的jsp/asp/php等程序员，Macromedia推出了Flex用非常简单的.mxml来描述界面和jsp/asp/php程序人员使用.(x/d)html非常相似，而且mxml更加规范化、标准化。<br /><br />2，为了一个标准。大家一定听说过微软下一代系统longhorn，在longhorn推出的同时微软也会推出新的语言xaml，一种界面描述语言，与之相应的就是smart client和flex非常相似的东西。Mxml和Xaml的也很相似… …由此带来的一些列好处就不用我说了。<br /><br /><br /><br />Flex和j2ee/.net其实没什么关系，Macromedia用java做出来个应用把flash的技术融合到j2ee里面，再用.net的技术做出来个.net应用把flash技术融合到.net里面去；应该说flex解决了j2ee里面和.net最繁琐的问题那就是web 客户端的问题。微软比较卑鄙在ie里面built-in（事先安装好了）很多空间，可以被.net调用比如datagrid，java就没有办法啦，只能用最原始的html一个tag一个tag地print，真是头疼，还有客户端的javas cript是最难调试的，不论java还是.net都束手无策。</span>
		</p>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/104066.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2007-03-15 18:03 <a href="http://www.blogjava.net/hengheng123456789/archive/2007/03/15/104066.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Liferay Portal 之 jbpm 配置</title><link>http://www.blogjava.net/hengheng123456789/archive/2007/03/02/101471.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Fri, 02 Mar 2007 06:24:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2007/03/02/101471.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/101471.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2007/03/02/101471.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/101471.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/101471.html</trackback:ping><description><![CDATA[
		<p>这几天经过多方查找，在Liferay的论坛上找到了答案，希望对如何在Liferay中部署使用jpbm工作流感兴趣的朋友有所帮助。</p>
		<p>1、首先下载 Liferay Portal Professional 4.2.1 (Bundled with Tomcat for JDK 5.0) </p>
		<p>2、使用其默认的 HSQL 数据库，即不去更改其数据库配置。</p>
		<p>3、下载 liferay-portal-servicemix-4.2.1.war 和 iferay-portal-jbpm-4.2.1.war <br /><a href="http://www.liferay.com/web/guest/downloads">http://www.liferay.com/web/guest/downloads</a></p>
		<p>4、把下载的这两个包分别更名为jbpm-web.war 和 servicemix-web.war</p>
		<p>5、把 jbpm-web.war 和 servicemix-web.war 拷贝到 Tomcat 的 webapps 目录中<br /><br />6、把 webapps\jbpm-web\WEB-INF\sql  目录中的 hsqldb.create.jbpm.3.1.sql 文件更名为 jbpm.script  ，并把它放入 tomcat 的 bin 目录。<br /><br />7、运行 Tomcat 的 startup.bat<br /><br />8、打开 <a href="http://localhost:8080/">http://localhost:8080/</a> ，并使用 test@liferay.com 用户登录 （密码为 test）<br /><br />9、增加  workflow portlet 项，选择其中的 definitions 标签，选择 add 按钮。<br /><br />10、在  text area 中输入工作流定义，如：<br /><br />1<br /><span class="message-board-code-lines"> 2</span>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br /><span class="message-board-code-lines"> 3</span><br /><span class="message-board-code-lines"> 4</span>&lt;process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="Example Process"&gt;<br /><span class="message-board-code-lines"> 5</span>    &lt;start-state name="start"&gt;<br /><span class="message-board-code-lines"> 6</span>        &lt;task&gt;<br /><span class="message-board-code-lines"> 7</span>            &lt;assignment class="com.liferay.jbpm.handler.IdentityAssignmentHandler" &gt;<br /><span class="message-board-code-lines"> 8</span>                &lt;companyId&gt;liferay.com&lt;/companyId&gt;<br /><span class="message-board-code-lines"> 9</span>                &lt;type&gt;user&lt;/type&gt;<br /><span class="message-board-code-lines">10</span>                &lt;name&gt;test@liferay.com&lt;/name&gt;<br /><span class="message-board-code-lines">11</span>            &lt;/assignment&gt;<br /><span class="message-board-code-lines">12</span>            &lt;controller&gt;<br /><span class="message-board-code-lines">13</span>                &lt;variable name="text:color" /&gt;<br /><span class="message-board-code-lines">14</span>                &lt;variable name="text:size" /&gt;<br /><span class="message-board-code-lines">15</span>            &lt;/controller&gt;<br /><span class="message-board-code-lines">16</span>        &lt;/task&gt;<br /><span class="message-board-code-lines">17</span>        &lt;transition name="to_t" to="t"/&gt;<br /><span class="message-board-code-lines">18</span><br /><span class="message-board-code-lines">19</span>    &lt;/start-state&gt;<br /><span class="message-board-code-lines">20</span><br /><span class="message-board-code-lines">21</span>    &lt;task-node name="t"&gt;<br /><span class="message-board-code-lines">22</span>        &lt;task name="t" &gt;<br /><span class="message-board-code-lines">23</span>            &lt;controller &gt;<br /><span class="message-board-code-lines">24</span>                &lt;variable name="text:color" access="read" /&gt;<br /><span class="message-board-code-lines">25</span>                &lt;variable name="text:size"  access="read"/&gt;<br /><span class="message-board-code-lines">26</span>            &lt;/controller&gt;<br /><span class="message-board-code-lines">27</span>            &lt;assignment class="com.liferay.jbpm.handler.IdentityAssignmentHandler" &gt;<br /><span class="message-board-code-lines">28</span>                &lt;companyId&gt;liferay.com&lt;/companyId&gt;<br /><span class="message-board-code-lines">29</span>                &lt;type&gt;user&lt;/type&gt;<br /><span class="message-board-code-lines">30</span>                &lt;name&gt;test@liferay.com&lt;/name&gt;<br /><span class="message-board-code-lines">31</span>            &lt;/assignment&gt;<br /><span class="message-board-code-lines">32</span>        &lt;/task&gt;<br /><span class="message-board-code-lines">33</span>        &lt;transition name="to_end" to='end' /&gt;<br /><span class="message-board-code-lines">34</span>    &lt;/task-node&gt;<br /><span class="message-board-code-lines">35</span>    &lt;end-state name="end"&gt;&lt;/end-state&gt;<br /><span class="message-board-code-lines">36</span>&lt;/process-definition&gt;<br /><br />11、提交此示例，则生成一个工作流程。<br /><br />12、在  tasks view ，选择 "manage" 来执行此 tasks 。<br /></p>
<img src ="http://www.blogjava.net/hengheng123456789/aggbug/101471.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hengheng123456789/" target="_blank">哼哼</a> 2007-03-02 14:24 <a href="http://www.blogjava.net/hengheng123456789/archive/2007/03/02/101471.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java Web services 开发之建立Web services（使用 Web Tools Project）</title><link>http://www.blogjava.net/hengheng123456789/archive/2007/02/28/101167.html</link><dc:creator>哼哼</dc:creator><author>哼哼</author><pubDate>Wed, 28 Feb 2007 08:40:00 GMT</pubDate><guid>http://www.blogjava.net/hengheng123456789/archive/2007/02/28/101167.html</guid><wfw:comment>http://www.blogjava.net/hengheng123456789/comments/101167.html</wfw:comment><comments>http://www.blogjava.net/hengheng123456789/archive/2007/02/28/101167.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hengheng123456789/comments/commentRss/101167.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hengheng123456789/services/trackbacks/101167.html</trackback:ping><description><![CDATA[
		<br />You can create of Web services using a top-down approach (which starts with a WSDL file) or a bottom-up approach (which starts with a Java bean or EJB).<br /><br />建立Web services有两种方式：<br /><br />top-down ：是从WSDL 开始，Top-down Web services development involves creating a Web service from a WSDL file.<br /><br />bottom-up ：是从Java bean or EJB开始，Bottom-up Web services development involves creating a Web service from a Java™ bean or enterprise bean.<br /><br />通用的开发步骤有以下几步：<br /><br /><ol><li><span>Create a Web project.</span></li><li><span>Create or import an artifact to be turned into a Web service.</span></li><li><span>Create a Web service.</span></li><li><span>Publish a business entity.</span></li><li><span>Publish a Web service.</span></li></ol><p>首先介绍一下top-down方式：<br /><br /></p><ol><li class="stepexpand"><span>Switch to the J2EE perspective (<span class="uicontrol">Window &gt; Open Perspective &gt; J2EE</span>).</span></li><li class="stepexpand"><span>In the Project Explorer view, select the WSDL file that you created or imported into the Web Content folder of your Web project.</span></li><li class="stepexpand"><span>Click <span class="uicontrol">File &gt; New &gt; Other</span>. Select <span class="uicontrol">Web Services</span> in order to display the various Web service wizards. Select the <span class="uicontrol">Web Service</span> wizard. Click <span class="uicontrol">Next</span>.</span></li><li class="stepexpand"><span>Web Services page: select <span class="uicontrol">Top down Java bean Web service</span> as your Web service type. You can optionally choose to do the following: </span><ul><li>Start the Web service in a Web project - if you do not select this option you will have to manually start the Web service. You must select this option to enable the other options on this page. 
</li><li>Launch the Web Services Explorer to publish your Web service to a UDDI registry. 
</li><li>Generate a Java?bean client proxy to the Web service. The Java bean client proxy that is generated provides a remote procedure call interface to the Web service. 
</li><li>Test the Web service - this allows you to test the Web service in the Web Service Explorer before a proxy is generated. 
</li><li>Send the Web service traffic through the TCP/IP Monitor, which allows you to watch the SOAP traffic generated by the Web service and to test this traffic for WS-I compliance. Note that this is only supported for Tomcat v4.0 and v4.1. If you are using Tomcat v5.0 and want to monitor the Web service traffic, you need to manually set up a TCP/IP monitor  </li></ul></li><li class="stepexpand"><span>Web Service Selection page: Enter the URI to the WSDL, WSIL, or HTML file that will be used to generate the Java bean. If you have selected the WSDL file before starting the wizard, this information should be prefilled. You can optionally generate a WSIL file from this file as well.</span> Ensure that there are no spaces at the beginning of the URI or you may generate a null pointer exception. 
</li><li class="stepexpand"><span>Service Deployment Configuration page: specify the server and client deployment settings.</span><ol type="a"><li class="substepexpand"><span>Click <span class="uicontrol">Edit</span> and select the Apache Axis run-time environment and select the server on which you want to run your Web service and Web service client.</span></li><li class="substepexpand"><span>Select the Web project in which you want your Web service created. </span>The wizard will create this for you if they do not already exist. 
</li><li class="substepexpand"><span>Select the type and name of project in which you want the Web service client created. If you enter the name of an existing project, the project type field must match that of the existing project. If you enter a name of a project that does not already exist, the wizard will create the project for you. Note that the only project type supported for Axis and SOAP run-time clients is a Web project. If you want the client to be created in a Java, EJB, or Application Client project, you must select the WebSphere<sup>   </sup>run-time environment for your client.</span></li></ol></li><li class="stepexpand"><span>Web Services Skeleton Java Bean Configuration page: Select the folder where the generated Java will be stored. If you want to review or edit the mappings between packages and namespaces, select the <span class="uicontrol">Define custom mapping for namespace to package</span> check box. Click <span class="uicontrol">Next</span>.</span></li><li class="stepexpand"><span>Web Service Namespace to Package Mappings page: if you selected <span class="uicontrol">Define custom mapping for package to namespace</span> on the previous panel, you can enter your custom mapping pairs on this panel by clicking <span class="uicontrol">Add.</span> Click <span class="uicontrol">Next</span>.</span></li><li class="stepexpand"><span>Web Service Test page: If you selected to test the Web service, select the test facility for the generated Web service. This will open the Web service in the Web Services Explorer. Select the operation you want to test, enter the required information, and click <span class="uicontrol">Go</span>. The result will display in the Status pane. Click <span class="uicontrol">Next</span>.</span></li><li class="stepexpand"><span>Web Service Proxy page: If you have selected to generate a proxy, this page shows the options for the proxy. It lists the folder where the proxy will be generated, and you can optionally create custom mappings between namespaces and packages. Click <span class="uicontrol">Next</span>.</span></li><li class="stepexpand"><span>Web Service Client Test page: Use this page to select the following options: </span><ol type="a"><li><span>Select your test facility. You can test the generated proxy in the Universal Test Client or the Web Service Explorer, or you can generate a sample Web service JSP.</span></li><li><span>If you selected to test the proxy through a JSP, you can select the folder where the JSP will be located, and you can select the methods that will be included in the JSP.</span></li><li><span>Select <span class="uicontrol">Run test on server</span> to start the server for you automatically.</span></li></ol></li><li class="stepexpand"><span>Web Service Publication page: If you have selected to publish your Web service to a UDDI registry, use this page to launch the Web Services Explorer and select the UDDI registry to which the Web service will be published. Click <span class="uicontrol">Finish</span>.</span></li></ol><p class="stepexpand">bottom-up方式：<br /><br /></p><ol><li class="stepexpand"><span>Switch to the J2EE perspective ( <span class="uicontrol">Window &gt; Open Perspective &gt; J2EE</span>).</span></li><li class="stepexpand"><span>In the Project Explorer view, select the bean that you created or imported into the source folder of your Web project.</span></li><li class="stepexpand"><span>Click <span class="uicontrol">File &gt; New &gt; Other</span>.</span> Select<span class="uicontrol">Web Services</span> in order to display the various Web service wizards. Select the <span class="uicontrol">Web Service</span> wizard. Click <span class="uicontrol">Next</span>. 
</li><li class="stepexpand"><span>Web Services page: select <span class="uicontrol">Bottom up Java bean Web service</span> as your Web service type. You can optionally choose to do the following: </span><ul><li>Start the Web service in a Web project - if you do not select this option you will have to manually start the Web service. You must select this option to enable the other options on this page. 
</li><li>Launch the Web Services Explorer to publish your Web service to a UDDI registry. 
</li><li>Generate a Java bean client proxy to the Web service. The Java bean client proxy that is generated provides a remote procedure call interface to the Web service. 
</li><li>Test the Web service - this allows you to test the Web service in the Web Service Explorer before a proxy is generated. 
</li><li>Send the Web service traffic through the TCP/IP Monitor, which allows you to watch the SOAP traffic generated by the Web service and to test this traffic for WS-I compliance. Note that this is only supported for Tomcat v4.0 and v4.1. If you are using Tomcat v5.0 and want to monitor the Web service traffic, you need to manually set up a TCP/IP monitor  </li></ul></li><li class="stepexpand"><span>Object selection page: select the Java bean from which the Web service will be created.</span></li><li class="stepexpand"><span>Service Deployment Configuration page: specify the server and client deployment settings.</span><ol type="a"><li class="substepexpand"><span>Click <span class="uicontrol">Edit</span> and select the Apache Axis run-time environment and select the server on which you want to run your Web service and Web service client.</span></li><li class="substepexpand"><span>Select the Web project in which you want your Web service created, and the EAR with which it will be associated. </span>The wizard will create these for you if they do not already exist. 
</li><li class="substepexpand"><span>Select the type and name of project in which you want the Web service client created. If you enter the name of an existing project, the project type field must match that of the existing project. If you enter a name of a project that does not already exist, the wizard will create the project for you. Note that the only project type supported for Axis and SOAP run-time clients is a Web project. If you want the client to be created in a Java, EJB, or Application Client project, you must select the WebSphere<sup>  </sup>run-time environment for your client.</span></li><li class="substepexpand"><span>Select an existing EAR or enter a unique name to associate the Web service client with a different EAR than the Web service EAR. <strong>Note:</strong> Selecting different EARs for the Web service and Web service client can reduce the chance of encountering run time errors, but will use more system resources.</span></li></ol></li><li class="stepexpand"><span>A message will display stating that you have made a WS-I non-compliant selection.</span> The Apache Axis run-time environment is not WS-I compliant. Select <span class="uicontrol">Ignore</span>. 
</li><li class="stepexpand"><span>Web Service Java Bean Identity page: the Web service URI and WSDL name will be listed.</span> You?have the following options: 
<ul><li>Select the methods to expose. 
</li><li>Select the encoding style. RPC/Encoded is the recommended encoding style for the Axis run-time environment. This encoding method is not WS-I compliant. 
</li><li>Select if you want to customize the package to namespace mappings. </li></ul>Click <span class="uicontrol">Next</span></li><li class="stepexpand"><span>Web Service Package to Namespace Mappings page: if you selected <span class="uicontrol">Define custom mapping for package to namespace</span> on the previous panel, you can enter your custom mapping pairs on this panel by clicking <span class="uicontrol">Add</span>.</span></li><li class="stepexpand"><span>Web Service Test page: If you selected to test the Web service, select the test facility for the generated Web service.</span> This will open the Web service in the Web Services Explorer. Select the operation you want to test, enter the required information, and click<span class="uicontrol">Go</span>. The result will display in the Status pane. Click <span class="uicontrol">Next</span>. 
</li><li class="stepexpand"><span>Web Service Proxy page: if you have selected to generate a proxy, select if you want to customize the package to namespace mappings.</span></li><li class="stepexpand"><span>Web Service Client Test page: Use this page to select the following options: </span><ol type="a"><li><span>Select your test facility. You can test the generated proxy in the Universal Test Client or the Web Service Explorer, or you can generate a sample Web service JSP.</span></li><li><span>If you selected to test the proxy through a JSP, you can select the folder where the JSP will be located, and you can select the methods that will be included in the JSP.</span></li><li><span>Select <span class="uicontrol">Run test on server</span> to start the server for you automatically.</span></li></ol></li><li class="stepexpand"><span>Web Service Publication page: Select whether or not you want to publish this Web service to a UDDI registry. Click <span class="uicontrol">Finish</span> . Note: you may see a warning stating <samp class="codeph">Error in generating WSDL from Java. ClassNotFound: &lt;bean name&gt;</samp>. This error can be safely ignored. </span></li></ol><p class="stepexpand">最后我们可建立<span>Web Service Client来验证<span>Web Service 的使用。<br /><br />首先需要发现Web services，步骤如下：<br /><br />从UDDI 查找：<br /><br /></span></span></p><ol><li><span>Launch the Web Services Explorer</span></li><li><span>Click <span class="uicontrol">UDDI Main</span>.</span></li><li><span>In the Actions pane select a registry from the drop-down list and click <span class="uicontrol">Go</span>.</span></li><li><span>In the Actions pane toolbar click the <strong>Find</strong> icon <img alt="A picture of the Find icon." src="http://127.0.0.1:56914/help/topic/org.eclipse.jst.ws.consumption.ui.doc.user/images/find.gif" />.</span></li><li><span>In the Actions pane, enter the name of the query, what you are searching for, the type of search that you want to perform, and any query information: </span><ol type="a"><li class="substepexpand"><span><strong>Search for</strong>  This list allows you to search for businesses, services, or service interfaces. </span><ul><li><strong>Businesses</strong> Once you locate a business in the registry, use the icons in the Action pane toolbar to do the following: 
<ul><li>View and edit business details 
</li><li>Get the services associated with that business 
</li><li>Publish a service 
</li><li>Manage referenced services 
</li><li>Manage publisher assertions 
</li><li>Add the business to Favorites 
</li><li>Unpublish the business </li></ul></li><li><strong>Services</strong> Once you locate a service in the registry, use the icons in the Action pane toolbar to do the following: 
<ul><li>View and edit service details 
</li><li>Get the business associated with that service 
</li><li>Get the service interfaces associated with that service 
</li><li>Import the service WSDL file to the Eclipse workbench 
</li><li>Import the service WSDL file to the file system 
</li><li>Launch the Web Service wizards 
</li><li>Add the service to Favorites 
</li><li>Unpublish the service </li></ul></li><li><strong>Service interfaces</strong> Once you locate a service interface in the registry, use the icons in the Action pane toolbar to do the following: 
<ul><li>View and edit interface details 
</li><li>Get the services associated with that service interface 
</li><li>Get the businesses associated with that service interface 
</li><li>Import the service interface WSDL file to the Eclipse workbench 
</li><li>Import the service interface WSDL file to the file system 
</li><li>Launch the Web Service wizards 
</li><li>Add the service interface to Favorites 
</li><li>Unpublish the service interface </li></ul></li></ul></li><li class="substepexpand"><span><strong>Type of search</strong>  These radio buttons allow you to specify a simple or advanced search, or a search by a Universal Unique Identifier (UUID). </span><dl><dt class="dlterm">Simple 
</dt><dd>Type the name of the businesses, services, or service interfaces for which you are searching. <strong>Note:</strong> The search set size is set to 100 and the maximum number of returned results is set to 10 by default.  If you would like to override the defaults, use the Advanced search. 
</dd><dt class="dlterm">Advanced 
</dt><dd>Allows you to enter more search options to focus the scope of your search. Select this option if you would like to search for multiple businesses or services. 
</dd><dt class="dlterm">UUID 
</dt><dd>Allow you to enter the UUID key.  The UUID key is the identifier that is associated with the published object. </dd></dl></li></ol></li><li><span>Once you have searched and discovered the business service description you desired, select the service or the service interface and click the <strong>Import</strong> icon to: </span><ul><li>import the WSDL document into your Web project 
</li><li>import the WSDL document into the WSDL Explorer for testing 
</li><li>launch the Web Service Skeleton Creation wizard or Web Service Client wizard directly from the Web Services Explorer. </li></ul></li></ol><p class="stepexpand">从WSIL 查找：<br /><br /></p><ol><li class="stepexpand"><span>From the Web Services Explorer toolbar, click the <strong>WSIL Page</strong> icon <img alt="Picture of the WSIL Page icon." src="http://127.0.0.1:56914/help/topic/org.eclipse.jst.ws.consumption.ui.doc.user/images/wsilview.gif" />.</span></li><li class="stepexpand"><span>In the Navigator pane, click <strong>WSIL Main</strong>.</span></li><li class="stepexpand"><span>In the <strong>URL to document</strong> field of the Actions pane enter the URL to the WSIL document or HTTP document that contains links to a WSIL document. Details on how an HTTP file can contain links to WSIL can be found here: http://www.ibm.com/developerworks/webservices/library/ws-wsilspec.html</span></li><li class="stepexpand"><span>Once you have located the WSIL document, use the icons in the Action pane toolbar to do the following:</span><ul><li>View WSIL document details 
</li><li>List all of the WSDL services associated with that WSIL document 
</li><li>List all of the UDDI services associated with that WSIL document 
</li><li>List all of the UDDI businesses associated with that WSIL document 
</li><li>List all of the WSIL links associated with that WSIL document 
</li><li>Import the WSIL document to the file system 
</li><li>Add the WSIL document to Favorites </li></ul><strong>Important:</strong> If the IBM Web Services Explorer does not display the project that you would like to import your WSDL file to, ensure that you have created the project and/or click the <strong>Refresh</strong> icon. </li></ol><p class="stepexpand">建立<span>Web Service Client：<br /><br /></span></p><ol><li><span>Switch to the J2EE perspective (<span class="uicontrol">Window &gt; Open Perspective &gt; J2EE</span>).</span></li><li><span>In the Navigator view, select the Web project in which you want to generate a sample application.</span></li><li><span>Click <span class="uicontrol">File &gt; New &gt; Other</span>. Select <span class="uicontrol">Web Services</span> in order to display the various Web service wizards. Select the <span class="uicontrol">Web Service Client</span> wizard. Click <span class="uicontrol">Next</span>.</span></li><li