﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-舞影凌乱</title><link>http://www.blogjava.net/lovefeel2004/</link><description>&lt;a href="http://www.blogjava.net/lovefeel2004"&gt;
&lt;h2&gt;
好好学习,努力工作,做个快乐的猪!!!
&lt;/h2&gt;
&lt;/a&gt;</description><language>zh-cn</language><lastBuildDate>Thu, 30 Apr 2026 10:42:56 GMT</lastBuildDate><pubDate>Thu, 30 Apr 2026 10:42:56 GMT</pubDate><ttl>60</ttl><item><title>Linux命令学习笔记（一）</title><link>http://www.blogjava.net/lovefeel2004/archive/2009/08/28/292929.html</link><dc:creator>幽梦新影</dc:creator><author>幽梦新影</author><pubDate>Fri, 28 Aug 2009 01:51:00 GMT</pubDate><guid>http://www.blogjava.net/lovefeel2004/archive/2009/08/28/292929.html</guid><wfw:comment>http://www.blogjava.net/lovefeel2004/comments/292929.html</wfw:comment><comments>http://www.blogjava.net/lovefeel2004/archive/2009/08/28/292929.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lovefeel2004/comments/commentRss/292929.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lovefeel2004/services/trackbacks/292929.html</trackback:ping><description><![CDATA[本文参考文档资料：《Linux命令全集》

今天开始学习Linux下的命令，大家都知道Linux现在也有图形介面了，但是有些功能还是得用命令来完成的，今天就开始学习这些命令，第一个是Cat

使用方式：cat [-AbeEnstTuv] [--help] [--version] fileName 
说明：把档案串连接后传到基本输出（萤幕或加 > fileName 到另一个档案） 
参数： 
-n 或 --number 由 1 开始对所有输出的行数编号 
-b 或 --number-nonblank 和 -n 相似，只不过对于空白行不编号 
-s 或 --squeeze-blank 当遇到有连续两行以上的空白行，就代换为一行的空白行 
-v 或 --show-nonprinting 
范例： 
cat -n textfile1 > textfile2 把 textfile1 的档案内容加上行号后输入 textfile2 这个档案里 
cat -b textfile1 textfile2 >> textfile3 把 textfile1 和 textfile2 的档案内容加上行号（空白行不加）之后将内容附加到 textfile3 里。 
cat /dev/null > /etc/test.txt 此为清空/etc/test.txt档案内容 
cat 也可以用来制作 image file。例如要制作软碟的 image file，将软碟放好后打 
cat /dev/fd0 > OUTFILE 
相反的，如果想把 image file 写到软碟，请打 
cat IMG_FILE > /dev/fd0 
注： 
1. OUTFILE 指输出的 image 档名。 
2. IMG_FILE 指 image file。 
3. 若从 image file 写回 device 时，device 容量需与相当。 
4. 通常用在制作开机磁片。cat主要有三大功能：

1.一次显示整个文件。$ cat filename

2.从键盘创建一个文件。$ cat > filename 只能创建新文件,不能编辑已有文件
3.将几个文件合并为一个文件。 $cat file1 file2 > file
<img src ="http://www.blogjava.net/lovefeel2004/aggbug/292929.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lovefeel2004/" target="_blank">幽梦新影</a> 2009-08-28 09:51 <a href="http://www.blogjava.net/lovefeel2004/archive/2009/08/28/292929.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Hibernate API(转载)</title><link>http://www.blogjava.net/lovefeel2004/archive/2009/01/08/250466.html</link><dc:creator>幽梦新影</dc:creator><author>幽梦新影</author><pubDate>Thu, 08 Jan 2009 04:04:00 GMT</pubDate><guid>http://www.blogjava.net/lovefeel2004/archive/2009/01/08/250466.html</guid><wfw:comment>http://www.blogjava.net/lovefeel2004/comments/250466.html</wfw:comment><comments>http://www.blogjava.net/lovefeel2004/archive/2009/01/08/250466.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lovefeel2004/comments/commentRss/250466.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lovefeel2004/services/trackbacks/250466.html</trackback:ping><description><![CDATA[
		<p>提供访问数据库操作的接口：Session接口，Transation接口，Query接口</p>
		<p>用于配置Hibernate的接口：Configuration接口</p>
		<p>Hibernate核心接口</p>
		<p>Configuration接口：配置Hibernate,Hibernate应用通过Configuration实例来指定对象-关系映射文件的位置或动态配置Hibernate的属性，然后创建SessionFactory对象实例。</p>
		<p>SessionFactory接口：初始化Hibernate,充当数据存储源的代理、创建Session对象。</p>
		<p>一个SessionFactory实例对应一个数据存储源，Hibernate应用从SessionFactory中获得Session对象实例。</p>
		<p>特定：它是线程安全的，意味着同一个实例可以被应用的多个线程共享，它是重量级的，意味着不能随意创建或销毁实例，一个数据库访问只需创建一个实例。</p>
		<p>Session接口：负责保存、更新、删除、加载、查询对象</p>
		<p>Session接口被称做持久化管理器，每个Session实例都有自已的缓存，用来存放被当前工作单元加载的对象且只能被当前工作单元访问。</p>
		<p>特性，它不是线程安全的，应该避免多个线程共享同一个Session实例，它是轻量级的，意味着创建或销毁实例不需要消耗太多的资源，可以为每个请求分配单独的Session实例，或者为每个工作单元分配单独的Session实例。</p>
		<p>Transation接口：Hibernate的数据库事务接口，对底层的事务接口做了封装。</p>
		<p>封装的底层事务接口：</p>
		<p>JDBC API、JTA（Java Transation）API、CORBA（Common Object Request Broker Architecture）API</p>
		<p>通过一致的Transation接口来声明事务边界，有利于应用在不同环境或容器中移植。</p>
		<p>Query接口和Criteria接口：执行数据库查询，控制执行查询的过程。</p>
		<p>Query接口封装了一个面向对象的查询语句（Hibernate Query Language, HQL）</p>
		<p>Criteria接口封装了基于字符串形式的查询语句，擅长于执行动态查询。</p>
		<p>回调接口：Interceptor接口、Lifecycle接口、Validatable接口</p>
		<p>当一个对象发生了特定的事件（如加载、保存、更新、删除），Hibernate应用可以通过回调来响应事件。</p>
		<p>回调接口按实现方式可分为：</p>
		<p>Lifecycle接口和Validatable接口：由持久化类来实现接口。</p>
		<p>Lifecycle接口，使持久化类的实例能响应被加载、保存、删除的事件。</p>
		<p>Validatable接口，使持久化类的实例在被保存前进行数据验证。</p>
		<p>Interceptor接口：不必由持久化类来实现接口。Interceptor实现类负责响应持久化类的实例被加载、保存、更新、删除的事件。</p>
		<p>映射类型接口：Type接口、UserType接口、CompositeUserType接口</p>
		<p>Type接口，表示Hibernate映射类型，用于把域对象映射为数据库的关系数据。</p>
		<p>Type接口的实现类：PrimitiveType类，映射Java基本类型。DateType类，映射Java日期类型。</p>
		<p>扩展接口：</p>
		<p>定制主键的生成策略：IndentifierGenerator接口</p>
		<p>定制本地SQL方言：Dialect抽象类</p>
		<p>定制缓存机制：Cache接口、CacheProvider接口</p>
		<p>定制JDBC连接管理：ConnectionProvider接口</p>
		<p>定制事务管理：TransationFactory接口、Transation接口、TransationManagerLookup接口</p>
		<p>定制ORM策略：ClassPersister接口及其子接口</p>
		<p>定制属性访问策略：PropertyAccesser接口</p>
		<p>创建代理：ProxyFactory接口</p>
		<p>定制客户化映射类型：UserType接口、CompositeUserType接口。</p>
		<p>在Hibernate中处理批量更新和批量删除</p>
		<p>批量更新是指在一个事务中更新大批量数据，批量删除是指在一个事务中删除大批量数据，以下程序直接通过Hibernate API批量更新</p>
		<p>tx = session.beginTransaction();<br />Iterator customers=session.find("from Customer c where c.age&gt;0").iterator();<br />while(customers.hasNext()){<br />Customer customer=(Customer)customers.next();<br />customer.setAge(customer.getAge()+1);<br />}<br />tx.commit();<br />session.close();<br />如果CUSTOMERS表中有1万条年龄大于零的记录，那么Session的find()方法会一下子加载1万个Customer对象到内存。当执行tx.commit()方法时，会清理缓存，Hibernate执行1万条更新CUSTOMERS表的update语句：</p>
		<p>update CUSTOMERS set AGE=? …. where ID=i;<br />update CUSTOMERS set AGE=? …. where ID=j;<br />……<br />update CUSTOMERS set AGE=? …. where ID=k;<br />以上批量更新方式有两个缺点：</p>
		<p>(1) 占用大量内存，必须把1万个Customer对象先加载到内存，然后一一更新它们。</p>
		<p>(2) 执行的update语句的数目太多，每个update语句只能更新一个Customer对象，必须通过1万条update语句才能更新一万个Customer对象，频繁的访问数据库，会大大降低应用的性能。</p>
		<p>为了迅速释放1万个Customer对象占用的内存，可以在更新每个Customer对象后，就调用Session的evict()方法立即释放它的内存：</p>
		<p>tx = session.beginTransaction();<br />Iterator customers=session.find("from Customer c where c.age&gt;0").iterator();<br />while(customers.hasNext()){<br />Customer customer=(Customer)customers.next();<br />customer.setAge(customer.getAge()+1);<br />session.flush();<br />session.evict(customer);<br />} <br />tx.commit();<br />session.close();</p>
		<p>在以上程序中，修改了一个Customer对象的age属性后，就立即调用Session的flush()方法和evict()方法，flush()方法使Hibernate立刻根据这个Customer对象的状态变化同步更新数据库，从而立即执行相关的update语句；evict()方法用于把这个Customer对象从缓存中清除出去，从而及时释放它占用的内存。</p>
		<p>但evict()方法只能稍微提高批量操作的性能，因为不管有没有使用evict()方法，Hibernate都必须执行1万条update语句，才能更新1万个Customer对象，这是影响批量操作性能的重要因素。假如Hibernate能直接执行如下SQL语句：</p>
		<p>update CUSTOMERS set AGE=AGE+1 where AGE&gt;0;</p>
		<p>那么以上一条update语句就能更新CUSTOMERS表中的1万条记录。但是Hibernate并没有直接提供执行这种update语句的接口。应用程序必须绕过Hibernate API，直接通过JDBC API来执行该SQL语句：</p>
		<p>tx = session.beginTransaction();<br />Connection con=session.connection();<br />PreparedStatement stmt=con.prepareStatement("update CUSTOMERS set AGE=AGE+1 "<br />+"where AGE&gt;0 ");<br />stmt.executeUpdate();<br />tx.commit();<br />以上程序演示了绕过Hibernate API，直接通过JDBC API访问数据库的过程。应用程序通过Session的connection()方法获得该Session使用的数据库连接，然后通过它创建PreparedStatement对象并执行SQL语句。值得注意的是，应用程序仍然通过Hibernate的Transaction接口来声明事务边界。</p>
		<p>如果底层数据库（如Oracle）支持存储过程，也可以通过存储过程来执行批量更新。存储过程直接在数据库中运行，速度更加快。在Oracle数据库中可以定义一个名为batchUpdateCustomer()的存储过程，代码如下：</p>
		<p>create or replace procedure batchUpdateCustomer(p_age in number) as<br />begin<br />update CUSTOMERS set AGE=AGE+1 where AGE&gt;p_age;<br />end;<br />以上存储过程有一个参数p_age，代表客户的年龄，应用程序可按照以下方式调用存储过程：</p>
		<p>tx = session.beginTransaction();<br />Connection con=session.connection();<br />String procedure = "{call batchUpdateCustomer(?) }";<br />CallableStatement cstmt = con.prepareCall(procedure);<br />cstmt.setInt(1,0); //把年龄参数设为0<br />cstmt.executeUpdate();<br />tx.commit();<br />从上面程序看出，应用程序也必须绕过Hibernate API，直接通过JDBC API来调用存储过程。</p>
		<p>Session的各种重载形式的update()方法都一次只能更新一个对象，而delete()方法的有些重载形式允许以HQL语句作为参数，例如：</p>
		<p>session.delete("from Customer c where c.age&gt;0"); <br />如果CUSTOMERS表中有1万条年龄大于零的记录，那么以上代码能删除一万条记录。但是Session的delete()方法并没有执行以下delete语句：</p>
		<p>delete from CUSTOMERS where AGE&gt;0;</p>
		<p>Session的delete()方法先通过以下select语句把1万个Customer对象加载到内存中：</p>
		<p>select * from CUSTOMERS where AGE&gt;0; <br />接下来执行一万条delete语句，逐个删除Customer对象：</p>
		<p>delete from CUSTOMERS where ID=i;<br />delete from CUSTOMERS where ID=j;<br />……<br />delete from CUSTOMERS where ID=k;<br />由此可见，直接通过Hibernate API进行批量更新和批量删除都不值得推荐。而直接通过JDBC API执行相关的SQL语句或调用相关的存储过程，是批量更新和批量删除的最佳方式，这两种方式都有以下优点：</p>
		<p>(1) 无需把数据库中的大批量数据先加载到内存中，然后逐个更新或修改它们，因此不会消耗大量内存。</p>
		<p>(2) 能在一条SQL语句中更新或删除大批量的数据。</p>
		<p>在hibernate中，最核心的概念就是对PO的状态管理，一个PO有三种状态：</p>
		<p>未被持久化的VO</p>
		<p>此时就是一个内存对象VO，由JVM管理生命周期</p>
		<p>已被持久化的PO，并且在Session使命周期内</p>
		<p>此时映射数据库数据，由数据库管理生命周期</p>
		<p>曾被持久化过，但现在和Session已经detached了，以VO的身份在运行。</p>
		<p>这种和Session已经detached的PO还能够进入别一个Session，继续进行PO状态状管，此时它就成为PO的第二种状态了。</p>
		<p>
				<span style="COLOR: red">这种PO实际上是跨了Session进行了状态维护的。</span>
				<br />
				<br />在传统的JDO1.x中，PO只有前面两种状态，一个PO一旦脱离PM，就丧失了状态了，不再和数据库数据关联，成为一个纯粹的内存VO，它即使进入一个新的PM，也不能恢复它的状态了。 <br /><br />Hibernate强的地方就在于，一个PO脱离Session之后，还能保持状态，再进入一个新的Session之后，就恢复状态管理的能力，但此时状态管理需要使用session.update或者session.saveOrUpdate，这就是Hibernate Reference中提到的“requires a slightly different programming model ”</p>
<img src ="http://www.blogjava.net/lovefeel2004/aggbug/250466.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lovefeel2004/" target="_blank">幽梦新影</a> 2009-01-08 12:04 <a href="http://www.blogjava.net/lovefeel2004/archive/2009/01/08/250466.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我的第一个Struts2.0程序</title><link>http://www.blogjava.net/lovefeel2004/archive/2008/12/30/249191.html</link><dc:creator>幽梦新影</dc:creator><author>幽梦新影</author><pubDate>Tue, 30 Dec 2008 08:13:00 GMT</pubDate><guid>http://www.blogjava.net/lovefeel2004/archive/2008/12/30/249191.html</guid><wfw:comment>http://www.blogjava.net/lovefeel2004/comments/249191.html</wfw:comment><comments>http://www.blogjava.net/lovefeel2004/archive/2008/12/30/249191.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/lovefeel2004/comments/commentRss/249191.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lovefeel2004/services/trackbacks/249191.html</trackback:ping><description><![CDATA[
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">项目已经基本上完成了</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">有刚好有时间</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">就来看下</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">Struts2.0,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">这东西听说比</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">Struts1.X</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">要好用很多了</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">也不知道</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">, Struts2</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">出来也有好两年了</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">应该大家都比较熟悉了</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">而我是第一次接触</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">先写一个</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">HelloWorld</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">来玩一下先</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /?><o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">一准备工作</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">(1)</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">开发环境</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">:Tomcat6.0+JDK<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /?><st1:chsdate w:st="on" isrocdate="False" islunardate="False" day="30" month="12" year="1899">1.6.03</st1:chsdate>+EditPlus3.0+Struts2.03<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">(2)</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">准备</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">Struts2</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-font-kerning: 0pt; mso-ascii-font-family: Verdana; mso-hansi-font-family: Verdana; mso-bidi-font-family: 宋体">的核心包</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体">:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /?>
						<v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600">
								<v:stroke joinstyle="miter">
								</v:stroke>
								<v:formulas>
										<v:f eqn="if lineDrawn pixelLineWidth 0">
										</v:f>
										<v:f eqn="sum @0 1 0">
										</v:f>
										<v:f eqn="sum 0 0 @1">
										</v:f>
										<v:f eqn="prod @2 1 2">
										</v:f>
										<v:f eqn="prod @3 21600 pixelWidth">
										</v:f>
										<v:f eqn="prod @3 21600 pixelHeight">
										</v:f>
										<v:f eqn="sum @0 0 1">
										</v:f>
										<v:f eqn="prod @6 1 2">
										</v:f>
										<v:f eqn="prod @7 21600 pixelWidth">
										</v:f>
										<v:f eqn="sum @8 21600 0">
										</v:f>
										<v:f eqn="prod @7 21600 pixelHeight">
										</v:f>
										<v:f eqn="sum @10 21600 0">
										</v:f>
								</v:formulas>
								<v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f">
								</v:path>
								<o:lock aspectratio="t" v:ext="edit">
								</o:lock>
						</v:shapetype>
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
						<br />
						<img src="http://www.blogjava.net/images/blogjava_net/lovefeel2004/1.jpg" />
						<br />二配置文件</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">(1)</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">先在</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">web.xml</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">&lt; web-app&gt;</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">和</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">&lt; /web-app&gt;</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中添加</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">Struts2</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">Filter</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如下</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<span lang="EN-US" style="FONT-SIZE: 9pt">
				<p>
				</p>
				<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
						<span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000">         </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">struts2</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">         </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">org.apache.struts2.dispatcher.FilterDispatcher</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-class</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">  </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000"> <br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">  </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">         </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">struts2</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-name</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">         </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">/*</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">url-pattern</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">  </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">filter-mapping</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000"></span></div>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<br />(2)</p>
		</span>
		<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</span>
		<span lang="EN-US" style="FONT-SIZE: 9pt">classes</span>
		<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件夹中建一个</span>
		<span lang="EN-US" style="FONT-SIZE: 9pt">xml</span>
		<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">文件</span>
		<span lang="EN-US" style="FONT-SIZE: 9pt">,</span>
		<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">命名为</span>
		<span lang="EN-US" style="FONT-SIZE: 9pt">struts.xml,</span>
		<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">内容为</span>
		<span lang="EN-US" style="FONT-SIZE: 9pt">:<o:p></o:p></span>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
				</span>
		</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml version="1.0" encoding="UTF-8" </span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE struts PUBLIC<br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #ff00ff">        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"<br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #ff00ff">        "http://struts.apache.org/dtds/struts-2.0.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">package </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="cn.struts2"</span><span style="COLOR: #ff0000"> extends</span><span style="COLOR: #0000ff">="struts-default"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">action </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="HelloWorld"</span><span style="COLOR: #ff0000"> class</span><span style="COLOR: #0000ff">=" cn.struts2.HelloWorld"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">HelloWorld.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">result</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">action</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">package</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">struts</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000"></span></div>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<br />三编写程序<span lang="EN-US" style="FONT-SIZE: 9pt"><o:p></o:p></span></p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一共三个文件</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">:HelloWorld.java;HelloWorld.jsp;SayHello.jsp<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其内容如下</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<span lang="EN-US" style="FONT-SIZE: 9pt">
				<o:p>HelloWorld.java<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">package</span><span style="COLOR: #000000"> cn.struts2;<br /></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">import</span><span style="COLOR: #000000"> com.opensymphony.xwork2.ActionSupport;<br /></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img id="Codehighlighter1_114_375_Open_Image" onclick="this.style.display='none'; Codehighlighter1_114_375_Open_Text.style.display='none'; Codehighlighter1_114_375_Closed_Image.style.display='inline'; Codehighlighter1_114_375_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_114_375_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_114_375_Closed_Text.style.display='none'; Codehighlighter1_114_375_Open_Image.style.display='inline'; Codehighlighter1_114_375_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> HelloWorld </span><span style="COLOR: #0000ff">extends</span><span style="COLOR: #000000"> ActionSupport </span><span id="Codehighlighter1_114_375_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_114_375_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> String name;<br /></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />    <br /></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img id="Codehighlighter1_174_201_Open_Image" onclick="this.style.display='none'; Codehighlighter1_174_201_Open_Text.style.display='none'; Codehighlighter1_174_201_Closed_Image.style.display='inline'; Codehighlighter1_174_201_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_174_201_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_174_201_Closed_Text.style.display='none'; Codehighlighter1_174_201_Open_Image.style.display='inline'; Codehighlighter1_174_201_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> String getName() </span><span id="Codehighlighter1_174_201_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_174_201_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> name;<br /></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img id="Codehighlighter1_241_273_Open_Image" onclick="this.style.display='none'; Codehighlighter1_241_273_Open_Text.style.display='none'; Codehighlighter1_241_273_Closed_Image.style.display='inline'; Codehighlighter1_241_273_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_241_273_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_241_273_Closed_Text.style.display='none'; Codehighlighter1_241_273_Open_Image.style.display='inline'; Codehighlighter1_241_273_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> setName(String name) </span><span id="Codehighlighter1_241_273_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_241_273_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">this</span><span style="COLOR: #000000">.name </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> name;<br /></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br /></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img id="Codehighlighter1_305_373_Open_Image" onclick="this.style.display='none'; Codehighlighter1_305_373_Open_Text.style.display='none'; Codehighlighter1_305_373_Closed_Image.style.display='inline'; Codehighlighter1_305_373_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_305_373_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_305_373_Closed_Text.style.display='none'; Codehighlighter1_305_373_Open_Image.style.display='inline'; Codehighlighter1_305_373_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />     </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> String execute() </span><span id="Codehighlighter1_305_373_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_305_373_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        name </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> name </span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">”,Hello World</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">”</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> SUCCESS;<br /></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div><p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> </p></o:p>
		</span>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">HelloWorld.jsp<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<span lang="EN-US" style="FONT-SIZE: 9pt">
				<o:p>
						<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
								<span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ page contentType</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">text/html; charset=UTF-8</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000"></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ taglib prefix</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">s</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> uri</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">/struts-tags</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Hello</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">h3</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">s:property </span><span style="COLOR: #ff0000">value</span><span style="COLOR: #0000ff">="name"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">h3</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">20</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">21</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">22</span> <span style="COLOR: #000000"></span></div>
						<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt"> </p>
				</o:p>
		</span>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">SayHello.jsp<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">
				<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
						<span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ page contentType</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">text/html; charset=UTF-8</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000"></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ taglib prefix</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">s</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> uri</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">/struts-tags</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Say Hello</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">h3</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Say "Hello World" to: </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">h3</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:form </span><span style="COLOR: #ff0000">action</span><span style="COLOR: #0000ff">="HelloWorld"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">20</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">21</span> <span style="COLOR: #000000">            Name: </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:textfield </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="name"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">22</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">23</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">s:submit </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">24</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">25</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">s:form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">26</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">27</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">28</span> <span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">29</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">30</span> <span style="COLOR: #000000"></span></div>
				<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
						<br />这里用到了</p>
		</span>
		<span lang="EN-US" style="FONT-SIZE: 9pt">Struts2</span>
		<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的标签库</span>
		<span lang="EN-US" style="FONT-SIZE: 9pt">,</span>
		<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下面对他进行一下解释</span>
		<span lang="EN-US" style="FONT-SIZE: 9pt">
				<o:p>
				</o:p>
		</span>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt; FONT-FAMILY: Verdana; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体"> </span>
		</p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">s:form </span>
				<span style="COLOR: #ff0000">action</span>
				<span style="COLOR: #0000ff">=""</span>
				<span style="COLOR: #0000ff">&gt;&lt;/</span>
				<span style="COLOR: #800000">s:form</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">-----获取相应form的值<br /></span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">s:textfield</span>
				<span style="COLOR: #0000ff">&gt;&lt;/</span>
				<span style="COLOR: #800000">s:textfield</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">-----文本输入框<br /></span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">s:submit</span>
				<span style="COLOR: #0000ff">&gt;&lt;/</span>
				<span style="COLOR: #800000">s:submit</span>
				<span style="COLOR: #0000ff">&gt;</span>
				<span style="COLOR: #000000">-----提交按钮<br /></span>
				<span style="COLOR: #0000ff">&lt;</span>
				<span style="COLOR: #800000">s:property </span>
				<span style="COLOR: #ff0000">value</span>
				<span style="COLOR: #0000ff">=””</span>
				<span style="COLOR: #0000ff">/&gt;</span>
				<span style="COLOR: #000000">-----得到'value'的属性<br /></span>
		</div>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span> </p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">四结果</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">启动</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">Tomcat,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在浏览器中输入</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<a href="http://localhost:8080/struts2/SayHello.jsp">
								<span style="COLOR: windowtext">http://localhost:8080/struts2/SayHello.jsp</span>
						</a>,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">即可进入到</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">:<o:p></o:p></span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p> <img src="http://www.blogjava.net/images/blogjava_net/lovefeel2004/2.jpg" /></o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后在文本框中输入</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">Tomcat,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">点</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">Submit,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">可得</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
						</o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span lang="EN-US" style="FONT-SIZE: 9pt">
						<o:p>
								<img src="http://www.blogjava.net/images/blogjava_net/lovefeel2004/3.jpg" /> </o:p>
				</span>
		</p>
		<p class="MsoNormal" style="MARGIN: 0cm 0cm 0pt">
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果顺利执行</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">,</span>
				<span style="FONT-SIZE: 9pt; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">则大功告成</span>
				<span lang="EN-US" style="FONT-SIZE: 9pt">!<o:p></o:p></span>
		</p>
<img src ="http://www.blogjava.net/lovefeel2004/aggbug/249191.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lovefeel2004/" target="_blank">幽梦新影</a> 2008-12-30 16:13 <a href="http://www.blogjava.net/lovefeel2004/archive/2008/12/30/249191.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一些JAVA学习笔记 </title><link>http://www.blogjava.net/lovefeel2004/archive/2008/12/08/245058.html</link><dc:creator>幽梦新影</dc:creator><author>幽梦新影</author><pubDate>Mon, 08 Dec 2008 08:41:00 GMT</pubDate><guid>http://www.blogjava.net/lovefeel2004/archive/2008/12/08/245058.html</guid><wfw:comment>http://www.blogjava.net/lovefeel2004/comments/245058.html</wfw:comment><comments>http://www.blogjava.net/lovefeel2004/archive/2008/12/08/245058.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/lovefeel2004/comments/commentRss/245058.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lovefeel2004/services/trackbacks/245058.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 准备工作1、JDK：java develop kit ，java开发工具包；2、JRE：java runtime environment, java 运行时环境；3、JDK 的三个版本：J2SE：java标准版，桌面程序和小应用程序的开发J2EE：java企业版，企业级的开发（WEB开发）J2ME：主要是手持移动设备程序的开发；4、JAVA的特性：a 简单的java屏弃了c++中一些复杂的操作，如...&nbsp;&nbsp;<a href='http://www.blogjava.net/lovefeel2004/archive/2008/12/08/245058.html'>阅读全文</a><img src ="http://www.blogjava.net/lovefeel2004/aggbug/245058.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lovefeel2004/" target="_blank">幽梦新影</a> 2008-12-08 16:41 <a href="http://www.blogjava.net/lovefeel2004/archive/2008/12/08/245058.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>纠正一些关于Servlet的误解</title><link>http://www.blogjava.net/lovefeel2004/archive/2008/11/21/241838.html</link><dc:creator>幽梦新影</dc:creator><author>幽梦新影</author><pubDate>Fri, 21 Nov 2008 04:55:00 GMT</pubDate><guid>http://www.blogjava.net/lovefeel2004/archive/2008/11/21/241838.html</guid><wfw:comment>http://www.blogjava.net/lovefeel2004/comments/241838.html</wfw:comment><comments>http://www.blogjava.net/lovefeel2004/archive/2008/11/21/241838.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/lovefeel2004/comments/commentRss/241838.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lovefeel2004/services/trackbacks/241838.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;刚才看了几篇对Servlet总结的文章,发现他们都有异曲同工之处,上来就是这样写的:<br />
&nbsp;
<table style="color: green" cellspacing="2" cellpadding="2" width="500" border="0">
    <tbody>
        <tr>
            <td>
            <p>Servlet三个要素: <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.必须继承自HttpServlet <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.必须实现doGet()或者doPost() <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.必须在web.xml中配置Servlet <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;servlet&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;servlet-name&gt; &lt;/servlet-name&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;servlet-class&gt; &lt;/servlet-class&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/servlet&gt;<br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;servlet-mapping&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;servlet-name&gt; &lt;/servlet-name&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;url-pattern&gt; &lt;/url-pattern&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/servelt-mapping&gt;</p>
            </td>
        </tr>
    </tbody>
</table>
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;有谁说了编写一个Servlet必须继承自HttpServlet类,必须实现doGet()或者doPost() ,难道实现Servlet接口就不行了吗?&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;其实编写一个Servlet主要有三种方法,一是实现Servlet接口,二是继承抽象类GenericServlet,三是继承HttpServlet类.下面分别用这三种方法去实现Servlet:<br />
&nbsp;&nbsp;&nbsp;&nbsp;(一)要从实现Servlet接口来编写一个Servlet是比较麻烦的,因为必须实现Servlet接口中的所有方法,Servlet接口主要定义了五个方法,它们分别为:<br />
(1)void init(ServletConfig config) throws ServletException<br />
(2)ServletConfig getServletConfig()<br />
(3)void service(ServletRequest req,ervletResponse res) throws ServletException,IOException<br />
(4)String getServletInfo()<br />
(5)void destroy()<br />
下面用实现Servlet接口的方法编写一个Servlet:<br />
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;javax.servlet.</span><span style="color: #000000">*</span><span style="color: #000000">;<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.io.</span><span style="color: #000000">*</span><span style="color: #000000">;<br />
<img id="Codehighlighter1_85_566_Open_Image" onclick="this.style.display='none'; Codehighlighter1_85_566_Open_Text.style.display='none'; Codehighlighter1_85_566_Closed_Image.style.display='inline'; Codehighlighter1_85_566_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_85_566_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_85_566_Closed_Text.style.display='none'; Codehighlighter1_85_566_Open_Image.style.display='inline'; Codehighlighter1_85_566_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">class</span><span style="color: #000000">&nbsp;TestServlet&nbsp;</span><span style="color: #0000ff">implements</span><span style="color: #000000">&nbsp;Servlet</span><span id="Codehighlighter1_85_566_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_85_566_Open_Text"><span style="color: #000000">{<br />
<img id="Codehighlighter1_150_184_Open_Image" onclick="this.style.display='none'; Codehighlighter1_150_184_Open_Text.style.display='none'; Codehighlighter1_150_184_Closed_Image.style.display='inline'; Codehighlighter1_150_184_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_150_184_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_150_184_Closed_Text.style.display='none'; Codehighlighter1_150_184_Open_Image.style.display='inline'; Codehighlighter1_150_184_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;init(ServletConfig&nbsp;config)&nbsp;</span><span style="color: #0000ff">throws</span><span style="color: #000000">&nbsp;ServletException</span><span id="Codehighlighter1_150_184_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_150_184_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">init</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
<img id="Codehighlighter1_226_245_Open_Image" onclick="this.style.display='none'; Codehighlighter1_226_245_Open_Text.style.display='none'; Codehighlighter1_226_245_Closed_Image.style.display='inline'; Codehighlighter1_226_245_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_226_245_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_226_245_Closed_Text.style.display='none'; Codehighlighter1_226_245_Open_Image.style.display='inline'; Codehighlighter1_226_245_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;ServletConfig&nbsp;getServletConfig()</span><span id="Codehighlighter1_226_245_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_226_245_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reture&nbsp;</span><span style="color: #0000ff">null</span><span style="color: #000000">;<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;service(ServletRequest&nbsp;req,ServletResponse&nbsp;res)&nbsp;<br />
<img id="Codehighlighter1_346_450_Open_Image" onclick="this.style.display='none'; Codehighlighter1_346_450_Open_Text.style.display='none'; Codehighlighter1_346_450_Closed_Image.style.display='inline'; Codehighlighter1_346_450_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_346_450_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_346_450_Closed_Text.style.display='none'; Codehighlighter1_346_450_Open_Image.style.display='inline'; Codehighlighter1_346_450_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">throws</span><span style="color: #000000">&nbsp;ServletException,IOException</span><span id="Codehighlighter1_346_450_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_346_450_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008000">//</span><span style="color: #008000">这里可以实现请求后要做的内容</span><span style="color: #008000"><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintWriter&nbsp;out&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;response.getWriter();<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">Hello&nbsp;World!</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
<img id="Codehighlighter1_483_502_Open_Image" onclick="this.style.display='none'; Codehighlighter1_483_502_Open_Text.style.display='none'; Codehighlighter1_483_502_Closed_Image.style.display='inline'; Codehighlighter1_483_502_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_483_502_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_483_502_Closed_Text.style.display='none'; Codehighlighter1_483_502_Open_Image.style.display='inline'; Codehighlighter1_483_502_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;String&nbsp;getServletInfo()</span><span id="Codehighlighter1_483_502_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_483_502_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">return</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">null</span><span style="color: #000000">;<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
<img id="Codehighlighter1_526_563_Open_Image" onclick="this.style.display='none'; Codehighlighter1_526_563_Open_Text.style.display='none'; Codehighlighter1_526_563_Closed_Image.style.display='inline'; Codehighlighter1_526_563_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_526_563_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_526_563_Closed_Text.style.display='none'; Codehighlighter1_526_563_Open_Image.style.display='inline'; Codehighlighter1_526_563_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;destroy()</span><span id="Codehighlighter1_526_563_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_526_563_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">destory</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000">&nbsp;</span></div>
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;(二)继承抽象类GenericServlet编写一个Serlvet,这个相对比实现Servlet接口要容易一点,GenericServlet类中只有一个抽象方法,即service(ServletRequest req, ServletResponse res),只要实现这个方法就行了,下面看例子:<br />
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;javax.servlet.</span><span style="color: #000000">*</span><span style="color: #000000">;<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.io.IOException;<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br />
<img id="Codehighlighter1_101_336_Open_Image" onclick="this.style.display='none'; Codehighlighter1_101_336_Open_Text.style.display='none'; Codehighlighter1_101_336_Closed_Image.style.display='inline'; Codehighlighter1_101_336_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_101_336_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_101_336_Closed_Text.style.display='none'; Codehighlighter1_101_336_Open_Image.style.display='inline'; Codehighlighter1_101_336_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;TestGenericServlet&nbsp;</span><span style="color: #0000ff">extends</span><span style="color: #000000">&nbsp;GenericServlet</span><span id="Codehighlighter1_101_336_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_101_336_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">abstract</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;service(ServletRequest&nbsp;req,ServletResponse&nbsp;res)<br />
<img id="Codehighlighter1_230_334_Open_Image" onclick="this.style.display='none'; Codehighlighter1_230_334_Open_Text.style.display='none'; Codehighlighter1_230_334_Closed_Image.style.display='inline'; Codehighlighter1_230_334_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_230_334_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_230_334_Closed_Text.style.display='none'; Codehighlighter1_230_334_Open_Image.style.display='inline'; Codehighlighter1_230_334_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">throws</span><span style="color: #000000">&nbsp;ServletException,IOException</span><span id="Codehighlighter1_230_334_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_230_334_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PrintWriter&nbsp;out&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;response.getWriter();<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">Hello&nbsp;World!</span><span style="color: #000000">"</span><span style="color: #000000">);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span></span><span style="color: #000000"><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span><span style="color: #000000"><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span></div>
<br />
(3)继承HttpServlet类编写Servlet应该是最容易的,而且是最常见的,我们一般要编写Servlet直接继承这个类就行了,重写doGet()或者doPost()方法即可,下面看例子: <br />
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;javax.servlet.http.</span><span style="color: #000000">*</span><span style="color: #000000">;<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;javax.servlet.</span><span style="color: #000000">*</span><span style="color: #000000">;<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="color: #0000ff">import</span><span style="color: #000000">&nbsp;java.io.</span><span style="color: #000000">*</span><span style="color: #000000">;<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br />
<img id="Codehighlighter1_114_738_Open_Image" onclick="this.style.display='none'; Codehighlighter1_114_738_Open_Text.style.display='none'; Codehighlighter1_114_738_Closed_Image.style.display='inline'; Codehighlighter1_114_738_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_114_738_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_114_738_Closed_Text.style.display='none'; Codehighlighter1_114_738_Open_Image.style.display='inline'; Codehighlighter1_114_738_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;TestHttpServlet&nbsp;</span><span style="color: #0000ff">extends</span><span style="color: #000000">&nbsp;HttpServlet</span><span id="Codehighlighter1_114_738_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_114_738_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;doGet(HttpServletRequest&nbsp;request,&nbsp;HttpServletResponse&nbsp;response)<br />
<img id="Codehighlighter1_232_583_Open_Image" onclick="this.style.display='none'; Codehighlighter1_232_583_Open_Text.style.display='none'; Codehighlighter1_232_583_Closed_Image.style.display='inline'; Codehighlighter1_232_583_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_232_583_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_232_583_Closed_Text.style.display='none'; Codehighlighter1_232_583_Open_Image.style.display='inline'; Codehighlighter1_232_583_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">throws</span><span style="color: #000000">&nbsp;IOException,&nbsp;ServletException&nbsp;</span><span id="Codehighlighter1_232_583_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_232_583_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;response.setContentType(</span><span style="color: #000000">"</span><span style="color: #000000">text/html;charset=gb2312</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;PrintWriter&nbsp;out&nbsp;</span><span style="color: #000000">=</span><span style="color: #000000">&nbsp;response.getWriter();<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">&lt;html&gt;</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">&lt;head&gt;</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">&lt;title&gt;HelloWorld&lt;/title&gt;</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">&lt;/head&gt;</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">&lt;body&nbsp;bgcolor=\</span><span style="color: #000000">"</span><span style="color: #000000">white\</span><span style="color: #000000">"</span><span style="color: #000000">&gt;</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">&lt;hr&gt;</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">HelloWorld</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;out.println(</span><span style="color: #000000">"</span><span style="color: #000000">&lt;/body&gt;&lt;/html&gt;</span><span style="color: #000000">"</span><span style="color: #000000">);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;}</span></span><span style="color: #000000"><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;</span><span style="color: #0000ff">public</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">void</span><span style="color: #000000">&nbsp;doPost(HttpServletRequest&nbsp;request,&nbsp;HttpServletResponse&nbsp;response)<br />
<img id="Codehighlighter1_704_735_Open_Image" onclick="this.style.display='none'; Codehighlighter1_704_735_Open_Text.style.display='none'; Codehighlighter1_704_735_Closed_Image.style.display='inline'; Codehighlighter1_704_735_Closed_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_704_735_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_704_735_Closed_Text.style.display='none'; Codehighlighter1_704_735_Open_Image.style.display='inline'; Codehighlighter1_704_735_Open_Text.style.display='inline';" alt="" src="http://www.blogjava.net/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">throws</span><span style="color: #000000">&nbsp;IOException,&nbsp;ServletException&nbsp;</span><span id="Codehighlighter1_704_735_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img alt="" src="http://www.blogjava.net/Images/dot.gif" /></span><span id="Codehighlighter1_704_735_Open_Text"><span style="color: #000000">{<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />&nbsp;&nbsp;doGet(request,&nbsp;response);<br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />&nbsp;}</span></span><span style="color: #000000"><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /><br />
<img alt="" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span></span></div>
   <img src ="http://www.blogjava.net/lovefeel2004/aggbug/241838.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lovefeel2004/" target="_blank">幽梦新影</a> 2008-11-21 12:55 <a href="http://www.blogjava.net/lovefeel2004/archive/2008/11/21/241838.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>做个快乐的猪</title><link>http://www.blogjava.net/lovefeel2004/articles/241362.html</link><dc:creator>幽梦新影</dc:creator><author>幽梦新影</author><pubDate>Wed, 19 Nov 2008 06:34:00 GMT</pubDate><guid>http://www.blogjava.net/lovefeel2004/articles/241362.html</guid><wfw:comment>http://www.blogjava.net/lovefeel2004/comments/241362.html</wfw:comment><comments>http://www.blogjava.net/lovefeel2004/articles/241362.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lovefeel2004/comments/commentRss/241362.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lovefeel2004/services/trackbacks/241362.html</trackback:ping><description><![CDATA[<span style="font-size: 18pt; color: #ff0000; font-family: 楷体_GB2312">好好学习,努力工作,做个快乐的猪!</span>
 <img src ="http://www.blogjava.net/lovefeel2004/aggbug/241362.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lovefeel2004/" target="_blank">幽梦新影</a> 2008-11-19 14:34 <a href="http://www.blogjava.net/lovefeel2004/articles/241362.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>