﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-彪悍的人生不需要解释-文章分类-java积累</title><link>http://www.blogjava.net/baixch/category/9553.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 04:11:49 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 04:11:49 GMT</pubDate><ttl>60</ttl><item><title>我对Java的异常处理机制的理解</title><link>http://www.blogjava.net/baixch/articles/69171.html</link><dc:creator>英雄</dc:creator><author>英雄</author><pubDate>Tue, 12 Sep 2006 07:36:00 GMT</pubDate><guid>http://www.blogjava.net/baixch/articles/69171.html</guid><wfw:comment>http://www.blogjava.net/baixch/comments/69171.html</wfw:comment><comments>http://www.blogjava.net/baixch/articles/69171.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/baixch/comments/commentRss/69171.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/baixch/services/trackbacks/69171.html</trackback:ping><description><![CDATA[
		<div class="item-content">
				<p align="center">
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
								<strong>我对<span>Java</span>的异常处理机制的理解<span><p></p></span></strong>
						</span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">
								<p>
								</p>
						</span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   首先从一个问题引出一个角度：跑<span>java</span>程序的机器在如何运行？<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   Jvm</span>
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">和物理机器构成了一个运行环境。这个运行环境“吸收”提供的<span>class</span>文件或其他资源，包括<span>java main</span>入口的给定参数等等，以多线程<span>thread</span>形式运行着。线程在另一个线程中诞生出来，某一天魂归西天。在线程诞生之初就属于一个分组<span>threadgroup</span>。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   然后描述另外一个角度：所谓运行环境吸收的材料中，比如<span>class</span>文件，其实是我们程序员给的运行规定。就是说我们按<span>java language specification</span>给出了我们对如何运行的命令信息。实际运行和我们的意愿之间到底是怎么相关呢？<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">运行环境的出现之初就会按我们的意愿试图执行某个类的<span>main.</span>首先运行环境会诞生一个主线程，这个主线程首先要求运行环境已经<span>initializing</span>这个类，没有就得<span>initializing</span>这个类，在做<span>initializing</span>之前又得要求<span>linking,</span>以致<span>loading,</span>不管怎么样，这样的约定导致主线程会运行<span>loading</span>，<span>linking,initializing</span>，然后再运行<span>main</span>方法里我们表达的意思。当然在这个主线程里也会按我们的意思诞生新线程，这个新线程也还是得在诞生之初按我们的意愿试图执行那个<span>runable</span>类的<span>run</span>方法，这当然也得要求<span>initializing</span>。所不同的是有可能这个<span>initializing</span>在某个其他线程里给运行了，那么也就是说运行时环境满足了这个要求，那在当前线程中就不干这个事了。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   最后我们来看异常的概念。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   显然我们的意愿是不容违背的。呵呵。可是现实归现实，总有那么多不尽人意。当运行时环境参照我们的意愿以各个线程运行时，总可能出现点违背意愿的事，也就是异常。这个情况的出现可能是机器内存条抖了下，可能是我们的意愿就不正常，比如想数组越界访问，或者我们的意愿就是“请此刻马上当作异常发生了”等等。那么这时会怎么运行呢？<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   这种情况当然是在线程中发生的，发生后运行时大师就会根据当前情况构造一<span>throwable</span>实例，然后寻找本线程要转到哪个点上去继续运行。这到底是哪个点，这个意愿当然还得我们程序员通过<span>java language specification</span>给出命令信息。我们的意愿不一定非要写出来，有一个是约定好的：异常传播跳出前释放同步块的锁。那么如果运行时大师找到了这个点，就会安排本线程继续从这个点运行，找不到，那么运行时大师就会把该线程杀了。杀之前先执行它的<span>threadgroup</span>的<span style="COLOR: black">uncaughtException</span><span style="COLOR: black">方法里我们表达的意愿。注意不管是在那个点还是这个方法，我们都有机会表达对那个</span><span>throwable</span>实例怎么怎么样的想法。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   Ok,</span>
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">现在基本框架已经有了，再具体的描述下。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   刚才说到了每个线程的运行，异常是有很多种情况的。那这种情况算什么时候发生的呢？总起来说就是什么时候触发了执行，什么时候算。比如我们有一句<span>a=1/b.</span>当线程参照这句执行时，发现<span>b=0,</span>那就可以说在这时发生了个异常。再比如我们某<span>StringUtils.contact(s1,s2);</span>当线程参照这句执行时，可能就会要求先做<span>StringUtils</span>的<span>resolving</span>（<span>linking</span>的最后一个可选步骤）<span>,</span>但也可能在线程<span>link</span>该句所属的类时就会做，这根据<span>jvm</span>规范得看<span>jvm</span>怎么实现了。但不管怎么说，什么时候做的<span>resolving</span>，而在这个过程中出异常了，就得算这个点。这样就有一个意识：发生点是可以嵌套的。比如<span>a</span>方法<span>a</span>步调用<span>b</span>方法，但<span>b</span>里<span>b</span>步抛异常了，我们可以说<span>b</span>步是个点，但对<span>a</span>来说，<span>a</span>步也是这个点。最原始的那个点怎么算？怎么说都无所谓。但有谓的是下面：<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   运行时大师就会根据当前情况构造一个<span>throwable</span>实例！其中当前情况就有一个当前线程的执行栈信息。这个当前信息怎么算有所谓。而且，然后寻找线程要转到哪个点上去继续运行。从哪里开始找起也有所谓。这两个所谓都在<span>jvm</span>中规范了。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   关键是我们程序员如何表达。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<ul>
						<li>
								<div style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 150%; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
										<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   1</span>
										<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">当前信息就是线程当时的栈信息。注意这个栈信息是我们的程序（包括<span>Lib</span>）的某个方法名的一些信息，而不是细化到某个操作<span>2</span>进制指令。<span><p></p></span></span>
								</div>
						</li>
						<li>
								<div style="MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 150%; TEXT-ALIGN: left; mso-pagination: widow-orphan" align="left">
										<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   2</span>
										<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">从哪里找起？<span><p></p></span></span>
								</div>
						</li>
				</ul>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   我们的程序中哪句是最终导致异常的，从这一句所在的代码块开始找起。所以主线程一开始时<span>initialize</span>那个<span>main</span>类，如果<span>jvm</span>实现是最早<span>link</span>，那么可能会由此递归<span>initialize</span>很多<span>main</span>类应用的类，如果这个过程中出异常了，我们甚至就没有必要找了，之后怎么处理无所谓；如果<span>initialize</span>后执行<span>main</span>方法过程中某句导致出异常了，那就得从这一句所在的代码块开始找起。<span>Try{</span></span>
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">~~~;a;~~~;}catch{}finally{}</span>
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">。<span>Catch</span>不匹配就要跳出这个<span>try</span>块，但跳出之前也要先让本线程运行完<span>finally</span>。如果<span>catch,finally</span>又抛异常了，那就形成一个新异常，原来的异常的信息不见了，所以要小心。注意“那个最终导致异常的那一句”是这个意思，比如<span>Try{~~~;a</span>（）<span>;~~~;}catch{}finally{}</span>。<span>a()</span>出异常了，但不是<span>a()</span>句，而是<span>a()</span>方法中出异常的最终那一句，由此递归到程序可见的最终一句。从那个地方找起。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">异常多数是同步发生的，就是在线程的某个固定环节发生，但也有异步的，比如内存溢出，谁也不知道会在哪个线程中哪个点发生，对于这样的异步异常，<span>jvm</span>规范中说<span>jvm</span>实现让这种异常实际发生后代码继续运行一有限段，所以给出一个简单实现模型：运行时对这种异常的检测时每次线程做控制转移指令时，比如条件转移啊等等。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   但是无论什么异常，对于我们用<span>java</span>表达的意愿，必须满足：异常逻辑发生时之前的<span>java</span>都执行了，之后的都没有执行。至于实际实现中，可能我们看到的异常发生时刻和实际的发生时刻有差别（因为运行时检测不是实时的），也可能我们看到的代码执行和编译器优化后实际的执行顺序不一致，但不管怎么样，我们看到的和表达的必须一致。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<p align="left">
						<span style="FONT-SIZE: 12pt; LINE-HEIGHT: 150%; FONT-FAMILY: 宋体; mso-bidi-font-family: 宋体; mso-font-kerning: 0pt">   最后看异常的分类。我截至目前说的异常都是一个广义的概念，实际上应该对应<span>throwable</span>这个类。<span>Throwable</span>之下有<span>exception</span>和<span>error.exception</span>下有很多，其中有一个是<span>RuntimeException</span>。我们用他们表达对运行的意愿，同时我们也用他们表达我们对提供的接口运行时可能出现的异常的提示。这种表达是<span>java</span>的特色，一般语言不会直接表达这种可能性。假如说我们的某个方法可能抛<span>exception</span>，意思是别人使用这个方法时能处理这个异常，对非<span>runtimeexception</span>一定要么捕捉下，要么继续传播；对<span>runtimeexception,</span>可以不做处理。而假如说我们的某个方法可能抛<span>error</span>，意思则是别人用这个方法可能会面对<span>error,</span>而且不认为别人能处理。从另一个方面，对于我们使用某个方法，如果他声明会抛一个非<span>runtimeexception</span>，我们必须处理，真有<span>error</span>的可能我们都不用，当然也可能记下日志就算了。考虑到这种含义，编译器帮助我们一定要处理非<span>runtimeexception</span>。<span><p></p></span></span>
				</p>
				<p>
				</p>
				<p>
				</p>
				<div class="clear">
				</div>
		</div>
<img src ="http://www.blogjava.net/baixch/aggbug/69171.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/baixch/" target="_blank">英雄</a> 2006-09-12 15:36 <a href="http://www.blogjava.net/baixch/articles/69171.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我对工作流概念的理解</title><link>http://www.blogjava.net/baixch/articles/69169.html</link><dc:creator>英雄</dc:creator><author>英雄</author><pubDate>Tue, 12 Sep 2006 07:31:00 GMT</pubDate><guid>http://www.blogjava.net/baixch/articles/69169.html</guid><wfw:comment>http://www.blogjava.net/baixch/comments/69169.html</wfw:comment><comments>http://www.blogjava.net/baixch/articles/69169.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/baixch/comments/commentRss/69169.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/baixch/services/trackbacks/69169.html</trackback:ping><description><![CDATA[
		<p align="center">
				<strong>
						<font face="宋体">我对工作流概念的理解</font>
				</strong>
		</p>
		<p align="left">
				<span style="FONT-FAMILY: 宋体; mso-bidi-font-family: 'TimesNewRoman,BoldItalic'; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold; mso-bidi-font-style: italic">
						<font size="3">
						</font>
				</span>
		</p>
		<p align="left">
				<span style="FONT-FAMILY: 宋体; mso-bidi-font-family: 'TimesNewRoman,BoldItalic'; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold; mso-bidi-font-style: italic">
						<font size="3">现在，很多所谓的协同工作流实现都出现了理解歪曲。对此，我将描述一种新的工作流概念的理解，然后基于其上，对<span>xpdl</span>做一个改造，形成新的工作流的描述语言。<span><p></p></span></font>
				</span>
		</p>
		<p>
		</p>
		<p>
		</p>
		<p align="left">
				<span style="FONT-FAMILY: 宋体; mso-bidi-font-family: 'TimesNewRoman,BoldItalic'; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold; mso-bidi-font-style: italic">
						<font size="3">我们做<span>software,</span>常常自然地关注功能概念，即写码<span>+</span>硬件组成一种可用的功能，比如我们常说给用户编出一个查询存货列表的功能，再加一个菜单；我们常常单纯基于这种功能概念构造系统。所谓对功能“搭积木”模式更加体现了这种概念。从深层次讲，这满足了一种静态观察的需求；而随着用户水平的提高，他们逐渐能够表达一种基于动态观察的需求。典型地说，管理者希望确保某个产品从进货到出货的整个过程都是最有效率的。继而，整个企业需要整个企业的运作中每个环节都是最正确有效的。对于企业而言，企业的每一个变化，活动，最好都是实现企业目标的最有效，最正确的一步。企业的需要，就是帮助他们实现企业，这个系统，一直以正确的活动序列向着企业目标运行着。目前用户还没有完全能把这种需求表达确切，现在所谓“协同”等概念其实就是对这种需求的模糊的表达。下面我试着表达解决这种需求的模型思路。<span><p></p></span></font>
				</span>
		</p>
		<p>
		</p>
		<p>
		</p>
		<p align="left">
				<span style="FONT-FAMILY: 宋体; mso-bidi-font-family: 'TimesNewRoman,BoldItalic'; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold; mso-bidi-font-style: italic">
						<font size="3">人如何实现目标？人类有一个一般的解决途径<span>---</span>控制系统的变化。比如我们追求自己的某个目标，往往先做一个计划，然后依照计划不断实现，反馈，修改计划。计划本质上就是对变化的控制。我们的思维中很重要的很基本的一条，就是从目标出发，分析出达到目标的途径。之后我们按途径进行受控活动。比如我们想解决温饱，最终就会分析到占有土地，提高种子质量等，然后我们会控制自己或员工去一步步做这些事。<span><p></p></span></font>
				</span>
		</p>
		<p>
		</p>
		<p>
		</p>
		<p align="left">
				<span style="FONT-FAMILY: 宋体; mso-bidi-font-family: 'TimesNewRoman,BoldItalic'; mso-font-kerning: 0pt; mso-bidi-font-size: 10.5pt; mso-bidi-font-weight: bold; mso-bidi-font-style: italic">
						<font size="3">企业的每一个具体活动如果都是某个定义好的流程实例的环节实例<span>(</span>都是计划的一部分<span>)</span>，那么所有的活动就可以完全受控。受控就意味着可以进行优化，监控等，所以能控制到所有活动基本就成为实现最终需求的基础。<span><p></p></span></font>
				</span>
		</p>
		<p>
		</p>
		<p>
		</p>
		<p>
				<font size="3">
						<span>
								<span style="mso-spacerun: yes">
										<font face="Times New Roman">   </font>
								</span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">控制的粒度需要非常灵活。我们允许用户去定义提交一个存货单就是一个环节，也可以包括更多的内容在这个环节中。不同的企业规模，即使同一个业务流程，肯定对控制粒度要求也不同。所以保证这种灵活性非常重要。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span>
								<span style="mso-spacerun: yes">
										<font face="Times New Roman">   </font>
								</span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">流程就是活动的阶段性集合。比如全局就是一个流程，就是说企业的整个运作就是一个流程。之后比如什么请假流程都只是其中的一部分。而活动是一个黑盒，不可再分，它的划分涉及到粒度的把握。定义一个流程，实际是需要规范一系列活动。随着流程种类的不断开发，整个企业的运作就会日益受到控制。随着粒度的分合，运作的管理更加细致科学。而且随着整个社会的进步，活动系列也会相应调整，流程定义也要不断更新。所以要保证流程定义的易操作。这个多采用图形化定义解决。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span>
								<span style="mso-spacerun: yes">
										<font face="Times New Roman">   </font>
								</span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">流程的定义本身是一个控制活动的直接手段。通过借助观察大量流程实例的数据，可以进行统计分析，反过来改善流程定义。再加上对一个流程实例本身可以做暂停等管理，从而实现对整个企业活动的长期规划，即时调整，最终满足企业的需求，控制住企业的良好运作。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span>
								<span style="mso-spacerun: yes">
										<font face="Times New Roman">   </font>
								</span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这是基于这种需求的理解，这种解决思路，使得这个模型非常不同。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span>
								<font face="Times New Roman">
										<span style="mso-spacerun: yes">   </span>1</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">流程定义。现在的流程定义，都出现了参与者等信息，而且还出现了如何运作的信息</span>
						<span>
								<font face="Times New Roman">---</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">关联某个应用功能模块。这些我认为都是一种歪曲。实际上这样做就将另一层次的需求混杂了进来。那就是通用的功能模块。比如某人在某环节可以填某个表的某些字段。这个出现在流程定义中，混淆了流程定义的本义。我认为流程定义本身仅仅是活动的划分。至于这个活动谁来完成，如何完成，根本不属于流程定义的范畴。定义一个流程，是对全局流程的某系列活动的一个划分，描述信息就是做什么的或者说达到什么目标的，本质是划分依据。每一个元素就是一个活动。这个活动的信息可能没办法明确出什么目标，但是基本上也是一个划分依据的描述。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span>
								<span style="mso-spacerun: yes">
										<font face="Times New Roman">   </font>
								</span>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">但是我们描述流程的时候，往往习惯有一个流的概念。即</span>
						<span>
								<font face="Times New Roman">A</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">结束后是</span>
						<span>
								<font face="Times New Roman">B</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。实际上这种信息根本无法静态描述。这一点和前面说的混淆，这两点导致实现非常不顺畅，高度太低的原因尔。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span>
								<font face="Times New Roman">2</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">反过来说这两点，以另外的方式处理。表的字段访问控制作为一个通用功能单元即可，参与者放到权限控制模型中去实现。对于</span>
						<span>
								<font face="Times New Roman">transition</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">，由活动环节本身在结束时指定下一个。而如何指定，提供一个根据默认定义指定的通用功能。而这默认指定，则可以在流程定义中给出。虽然形式上仍然是元素间连线，但意义不同，这样我们不把这种</span>
						<span>
								<font face="Times New Roman">transition</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">信息作为流程定义的必需组成。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span>
								<font face="Times New Roman">3worklist</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。实现这样一个功能单位，让用户自己去一个列表中领取进行中的环节即可，某个用户判断可以结束了，直接声明结束环节。这是最简单直接的实现。不用担心权限问题，因为即使领取了环节，也不一定有功能权限去做实际功能。当然为了方便用户，可以做一个功能单位，让不同用户看到可以做的环节。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span>
								<font face="Times New Roman">4</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">管理。其实就是那些暂停，看流程实例状态等。以新的理解，那其实这些也是某环节活动的组成部分。像原来一样做。当某个流程暂停了，那么系统就不会允许下一个环节的诞生。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span>
								<font face="Times New Roman">5</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">至于所谓业务数据流，其实对于某一个功能，如果当初设计的是环节相关的，那他就可以通过领取的环节取到环节</span>
						<span>
								<font face="Times New Roman">id,</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">流程</span>
						<span>
								<font face="Times New Roman">id,</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这些就足够了。如果不是环节相关的，比如某人的基本信息录入，那可能根本用不到这些数据。显然，一个环节可能是需要使用多个功能，这也和以前的理解不同。实际上我是这样做对，一个用户开始进入系统，默认持有系统流程大环节</span>
						<span>
								<font face="Times New Roman">id,</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">然后在列表中选择一个环节来参与进去，那就在会话中一直持有该环节。这体现了用户</span>
						<span>
								<font face="Times New Roman">A</font>
						</span>
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正在受理某业务环节中的现实表现。</span>
				</font>
		</p>
		<p>
				<font size="3">
						<span style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">探索中，欢迎交流！msn:sun_v2006@hotmail.com</span>
				</font>
		</p>
<img src ="http://www.blogjava.net/baixch/aggbug/69169.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/baixch/" target="_blank">英雄</a> 2006-09-12 15:31 <a href="http://www.blogjava.net/baixch/articles/69169.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>xpdl规范中文注释TC-1025_xpdl_2_2005-10-03</title><link>http://www.blogjava.net/baixch/articles/62999.html</link><dc:creator>英雄</dc:creator><author>英雄</author><pubDate>Fri, 11 Aug 2006 06:37:00 GMT</pubDate><guid>http://www.blogjava.net/baixch/articles/62999.html</guid><wfw:comment>http://www.blogjava.net/baixch/comments/62999.html</wfw:comment><comments>http://www.blogjava.net/baixch/articles/62999.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/baixch/comments/commentRss/62999.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/baixch/services/trackbacks/62999.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: TC-1025_xpdl_2_2005-10-03.doc								日期：				2006-8-10 8:50:13								对一个工作流程进行分析，建模，描述，书写文档的工具五花八门。本流程定义接口定义了一个通用的接口格式，以支持不同工具对流程定								义的可迁移性。																				 		...&nbsp;&nbsp;<a href='http://www.blogjava.net/baixch/articles/62999.html'>阅读全文</a><img src ="http://www.blogjava.net/baixch/aggbug/62999.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/baixch/" target="_blank">英雄</a> 2006-08-11 14:37 <a href="http://www.blogjava.net/baixch/articles/62999.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>BPMN-BPD-introduce部分翻译截取</title><link>http://www.blogjava.net/baixch/articles/62753.html</link><dc:creator>英雄</dc:creator><author>英雄</author><pubDate>Thu, 10 Aug 2006 03:33:00 GMT</pubDate><guid>http://www.blogjava.net/baixch/articles/62753.html</guid><wfw:comment>http://www.blogjava.net/baixch/comments/62753.html</wfw:comment><comments>http://www.blogjava.net/baixch/articles/62753.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/baixch/comments/commentRss/62753.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/baixch/services/trackbacks/62753.html</trackback:ping><description><![CDATA[1<br />Introduction to BPMN<br />Stephen A. White, IBM Corporation<br />Abstract<br />This paper is intended to provide a high-level overview and introduction to the Business Process<br />Modeling Notation (BPMN). The context and general uses for BPMN will be provided as a<br />supplement to the technical details defined the BPMN 1.0 Specification, which has been recently<br />completed and released to the public. The basics of the BPMN notation will be discribed—that is,<br />the types of graphical objects that comprise the notation and how they work together as part of a<br />Business Process Diagram. Also discussed will be the different uses of BPMN, including how levels<br />of precision affect what a modeler will include in a diagram. Finally, the value in using BPMN as a<br />standard notation will be defined and the future of BPMN outlined.<br />What Is BPMN?<br />The Business Process Management Initiative (BPMI) has developed a standard Business Process<br />Modeling Notation (BPMN). The BPMN 1.0 specification was released to the public in May, 2004.<br />This specification represents more than two years of effort by the BPMI Notation Working Group.<br />The primary goal of the BPMN effort was to provide a notation that is readily understandable by all<br />business users, from the business analysts that create the initial drafts of the processes, to the<br />technical developers responsible for implementing the technology that will perform those<br />processes, and finally, to the business people who will manage and monitor those processes. BPMN<br />will also be supported with an internal model that will enable the generation of executable<br />BPEL4WS. Thus, BPMN creates a standardized bridge for the gap between the business process<br />design and process implementation.<br />BPMN defines a Business Process Diagram (BPD), which is based on a flowcharting technique<br />tailored for creating graphical models of business process operations. A Business Process Model,<br />then, is a network of graphical objects, which are activities (i.e., work) and the flow controls that<br />define their order of performance.<br />BPMN Basics<br />A BPD is made up of a set of graphical elements. These elements enable the easy development of<br />simple diagrams that will look familiar to most business analysts (e.g., a flowchart diagram). The<br />elements were chosen to be distinguishable from each other and to utilize shapes that are familiar to<br />most modelers. For example, activities are rectangles and decisions are diamonds. It should be<br />emphasized that one of the drivers for the development of BPMN is to create a simple mechanism<br />for creating business process models, while at the same time being able to handle the complexity<br />inherent to business processes. The approach taken to handle these two conflicting requirements<br />was to organize the graphical aspects of the notation into specific categories. This provides a small<br />set of notation categories so that the reader of a BPD can easily recognize the basic types of<br />注释小结：Microsoft Word - BPMN<br />Introductory White Paper.doc<br />页面：1<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />摘要：<br />本文目的在于提供一份关于BPMN的概括性介绍。包括BPMN的来历，应用，基本概--念-在BPD图中元素各自的意义，和彼此的关系。同时<br />也包括针对不同的应用，对图形元素的使用量水平也有一个水平界定。最后，使B用PMN的价值和BPMN未来前景。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />BPMI开发的BPMN。1.0规范已经与2004.5发布。大约是2年的努力。主要目的是提供一个统一的概念，而这个概念可以让所有的用户都<br />理解，包括工作流程设计者，开发者，使用B者PM。N有一个内部模拟高兴，可以产生可执行的BPEL4WS.总之，BPMN为流程设计和实现搭建<br />了一个标准的桥梁。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />BPMN定义了一个BPD，这是一个用来表示工作流的图形化模型。一个工作流定义，因此，使一个诸多图形元素的网络图，每一个元素描述<br />一个工作实体，关系代表了执行顺序等流程控制。<br />Introduction to BPMN<br />2<br />elements and understand the diagram. Within the basic categories of elements, additional variation<br />and information can be added to support the requirements for complexity without dramatically<br />changing the basic look-and-feel of the diagram. The four basic categories of elements are:<br />􀁸 Flow Objects<br />􀁸 Connecting Objects<br />􀁸 Swimlanes<br />􀁸 Artifacts<br />Flow Objects<br />A BPD has a small set of (three) core elements, which are the Flow Objects, so that modelers do not<br />have to learn and recognize a large number of different shapes. The three Flow Objects are:<br />Event<br />An Event is represented by a circle and is something that<br />“happens” during the course of a business process. These<br />Events affect the flow of the process and usually have a<br />cause (trigger) or an impact (result). Events are circles<br />with open centers to allow internal markers to<br />differentiate different triggers or results. There are three<br />types of Events, based on when they affect the flow:<br />Start, Intermediate, and End (see the figures to the right,<br />respectively).<br />Activity<br />An Activity is represented by a rounded-corner rectangle<br />(see the figure to the right) and is a generic term for work<br />that company performs. An Activity can be atomic or nonatomic<br />(compound). The types of Activities are: Task and<br />Sub-Process. The Sub-Process is distinguished by a small<br />plus sign in the bottom center of the shape.<br />Gateway<br />A Gateway is represented by the familiar diamond shape<br />(see the figure to the right) and is used to control the<br />divergence and convergence of Sequence Flow. Thus, it<br />will determine traditional decisions, as well as the forking,<br />merging, and joining of paths. Internal Markers will<br />indicate the type of behavior control.<br />Table 1: Core BPD Flow Objects<br />页面：2<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />一个BPD是由一个图形元素的集合组成的一个图。这些图形化元素对大多数工作流设计者非常熟悉。使用这些元素建立工作流将非常<br />容易。不同种类的元素以不同的图形区别表示。比如工作实体是一个矩形。判断时一个菱形。有一点强调下：BPMN的开发就是要简化<br />工作流模型的创建，而同时又要可以能处理工作流本身的复杂性。鱼和熊掌兼得的解决之道即为这些图形元素分类。这样，基于很少的<br />图形元素分类，一个BPD的读者能够很容易地识别理解工作流图。有了基本分类，对图形的额外信息补充也会保持整体感。4种基本分类：<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />BPD有3个核心对象，建模者甚至无须去了解更多对象。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />event用一个圈表示，代表在流程中发生的事件。event影响工作流程。通常有一个trigger(触发原因)和impact（结果），在圈中间可以做些<br />内部标记来区分。基于何时影响工作流，有3种event分别代表开始，中间，结束。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />一个工作实体由一个圆角矩形代表。指具体某一个工作环节。可以使原子性，也可以是复合式。又分为两类：任务，子流程。子流程在底<br />部中央以+标记。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />gateway使用菱形代表，用来描述分支或汇总。因此，用来表示决定，分支，汇总，联结。可做内部标记来区别。<br />Introduction to BPMN<br />3<br />Connecting Objects<br />The Flow Objects are connected together in a diagram to create the basic skeletal structure of a<br />business process. There are three Connecting Objects that provide this function. These connectors are:<br />Sequence Flow<br />A Sequence Flow is represented by a solid line with a<br />solid arrowhead (see the figure to the right) and is used<br />to show the order (the sequence) that activities will be<br />performed in a Process. Note that the term “control flow”<br />is generally not used in BPMN.<br />Message Flow<br />A Message Flow is represented by a dashed line with an<br />open arrowhead (see the figure to the right) and is used<br />to show the flow of messages between two separate<br />Process Participants (business entities or business roles)<br />that send and receive them. In BPMN, two separate Pools<br />in the Diagram will represent the two Participants.<br />Association<br />An Association is represented by a dotted line with a line<br />arrowhead (see the figure to the right) and is used to<br />associate data, text, and other Artifacts with flow objects.<br />Associations are used to show the inputs and outputs of<br />activities.<br />Table 2: BPD Connecting Elements<br />For modelers who require or desire a low level of precision to create process models for<br />documentation and communication purposes, the core elements plus the connectors will provide<br />the ability to easily create understandable diagrams (see Figure 1).<br />Figure 1: An Example of a Simple Business Process<br />For modelers who require a higher level of precision to create process models, which will be subject<br />to detailed analysis or will be managed by Business Process Management System (BPMS), additional<br />details can be added to the core elements and shown through internal markers (see Figure 2).<br />页面：3<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />flow object们被这里的connecting object们连接起来描述整个工作流框架。有3类connecting object：<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />sequence flow用实线箭头表示，描述了工作实体在流程中的执行顺序。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />message flow一个虚线箭头表示，描述流程参与者间的信息传递。在BPMN中，两个分离的Pool将代表两个参与者。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />association用来对flow object来进行data,text,或其他Artifacts的关联。用来显示工作实体的输入输出。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />对于低水平的应用，这两类元素足够了。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />对于高水平的，则可以再添加细节。<br />Introduction to BPMN<br />4<br />Figure 2: A Segment of a Process with more Details<br />Swimlanes<br />Many process modeling methodologies utilizes the concept of swimlanes as a mechanism to organize<br />activities into separate visual categories in order to illustrate different functional capabilities or<br />responsibilities. BPMN supports swimlanes with two main constructs. The two types of BPD<br />swimlane objects are:<br />Pool<br />A Pool represents a Participant in a<br />Process. It is also acts as a<br />graphical container for partitioning<br />a set of activities from other Pools<br />(see the figure to the right),<br />usually in the context of B2B<br />situations.<br />Lane<br />A Lane is a sub-partition within a<br />Pool and will extend the entire<br />length of the Pool, either vertically<br />or horizontally (see the figure to<br />the right). Lanes are used to<br />organize and categorize activities.<br />Table 3: BPD Swimlane Objects<br />Pools are used when the diagram involves two separate business entities or participants (see Figure<br />3) and are physically separated in the diagram. The activities within separate Pools are considered<br />self-contained Processes. Thus, the Sequence Flow may not cross the boundary of a Pool. Message<br />Flow is defined as being the mechanism to show the communication between two participants, and,<br />thus, must connect between two Pools (or the objects within the Pools).<br />页面：4<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />许多流程建模方法使用swimlanes<br />这个概念来以图的形式划分工作实体，以此描述功能或责任者划分。BPMN在两方面支持这个概念：<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />pool代表一个工作流程中的参与者划分。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />lane是pool的子划分，可能因而扩展了pool的长度或高度。用来划分工作实体。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />当需要划分描述不同工作或参与者时使用pool。在一个pool的实体被认为是自包含的工作流程。因此sequence flow不能跨越边界。而<br />message fow则可以跨越。<br />Introduction to BPMN<br />5<br />Figure 3: An Example of a BPD with Pools<br />Lanes are more closely related to the traditional swimlane process modeling methodologies. Lanes<br />are often used to separate the activities associated with a specific company function or role (see<br />Figure 4). Sequence Flow may cross the boundaries of Lanes within a Pool, but Message Flow may<br />not be used between Flow Objects in Lanes of the same Pool.<br />Figure 4: A Segment of a Process with Lanes<br />页面：5<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />而lane则更接近于传统的机制。常被用来划分一个具体的功能或角色。sequence flow可以跨越边界，但是message flow可能就用不着<br />了。<br />Introduction to BPMN<br />6<br />Artifacts<br />BPMN was designed to allow modelers and modeling tools some flexibility in extending the basic<br />notation and in providing the ability to additional context appropriate to a specific modeling<br />situation, such as for a vertical market (e.g., insurance or banking). Any number of Artifacts can be<br />added to a diagram as appropriate for the context of the business processes being modeled. The<br />current version of the BPMN specification pre-defines only three types of BPD Artifacts, which<br />are:<br />Data Object<br />Data Objects are a mechanism to show how<br />data is required or produced by activities.<br />They are connected to activities through<br />Associations.<br />Group<br />A Group is represented by a rounded corner<br />rectangle drawn with a dashed line (see the<br />figure to the right). The grouping can be used<br />for documentation or analysis purposes, but<br />does not affect the Sequence Flow.<br />Annotation<br />Annotations are a mechanism for a modeler<br />to provide additional text information for the<br />reader of a BPMN Diagram (see the figure to<br />the right).<br />Table 4: BPD Artifact Elements<br />Modelers can create their own types of Artifacts, which add more details about how the process is<br />performed—quite often to show the inputs and outputs of activities in the Process. However, the<br />basic structure of the process, as determined by the Activities, Gateways, and Sequence Flow, are<br />not changed with the addition of Artifacts in the diagram; as you can see by comparing Figure 4 and<br />Figure 5.<br />页面：6<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />上面提到的BPMN的灵活扩展性在这里体现。就是artifact可以任意加入到这个流程图中来。BPMN的目前版本预定义了3种：<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />data object用来描述工作实体需要或产生了什么数据的。用association连接。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />一个虚线围成的矩形，用来生成文档或辅助分析等，并不影响实际流程。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />annotation用来添加文本信息，以帮助reader来看图。<br />作者：Administrator<br />主题：附注<br />日期：2006-8-10 11:10:42<br />建模者可以随意加些自定义类型的actifacts---常常用来描述工作实体的输入输出。但是，工作流程不会受影响。<img src ="http://www.blogjava.net/baixch/aggbug/62753.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/baixch/" target="_blank">英雄</a> 2006-08-10 11:33 <a href="http://www.blogjava.net/baixch/articles/62753.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>j2ee 中文 编码</title><link>http://www.blogjava.net/baixch/articles/39447.html</link><dc:creator>英雄</dc:creator><author>英雄</author><pubDate>Wed, 05 Apr 2006 10:59:00 GMT</pubDate><guid>http://www.blogjava.net/baixch/articles/39447.html</guid><wfw:comment>http://www.blogjava.net/baixch/comments/39447.html</wfw:comment><comments>http://www.blogjava.net/baixch/articles/39447.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/baixch/comments/commentRss/39447.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/baixch/services/trackbacks/39447.html</trackback:ping><description><![CDATA[
		<p>1.编码<br />  ASCII码：128个码位。<br />  iso8859-1：又称为Latin-1 256个码位。<br />  从计算机的应用开始，我国已经颁布了多种中文信息编码标准，<br />  常用的是GB2312-1980，GB12345，GB13000（GBK），以及最新标准GB18030。向下兼容。<br />  值得一提的是，最新的GB18030标准将要作为强制标准实行，所有不支持GB18030标准的软件将不能作    为 产品出售。<br />  gb2312:[1~2个字节]<br />  汉字：第一个字节的值在0xB0到0xF7之间，第二个字节的值在0xA0到0xFE之间。<br />  gb12345,gb13000:[1~2个字节]<br />  汉字：大致为第一个字节的值在0x81到0xFE之间，第二个字节的值在0x40到0xFE之间。<br />  gb18030：[1~4个字节]<br />  单字节，其值从0到0x7F<br />  双字节，第一个字节的值从0x81到0xFE，第二个字节的值从0x40到0xFE（不包括0x7F）<br />  四字节，第一个字节的值从0x81到0xFE，第二个字节的值从0x30到0x39，第三个字节的值从0x81到0xFE，第四个字节的值从0x30到0x39。<br />  unicode：<br />  UCS-2：[统一2个字节][现在用的unicode]65536个码位。<br />  UCS-4：[统一4个字节]以防将来不够用的2的31次方个 码位。<br />  codepage:<br />  各国编码和unicode的对应表<br />  UTF编码：<br />  UTF是“UCS Transformation Format”的缩写。UTF-8 编码字符理论上可以最多到 6 个字节长，可以编入  所有可能的2的31次方个 UCS 代码，是变字节编码。<br /><font color="#cc6600">以上编码统一兼容ascii.</font><br />2.j2ee中文问题解决<br />  构架情景：<br />  前台显示通过jsp,html;中间java的filter,servelt处理请求;后台：java通过jdbc driver同数据库交互。<br />  基础：<br />  1]java运行总是以unicode为内存中存在形式。如：string s="中文"；s在运行时内存是unicode编码。<br />  2]数据库有一个存储编码集。表示了采用存储的形式。如：表中记录一个字段值为"中文"，在数据库中以该编码集编码存在。<br />  3]html有一个网页编码，可以通过meta指定。<br />  流程： <br />  1）浏览器获得的html总是来源于3个方面：<br />  1，java直接输出response,reponse.setContenttype指定编码<br />  2，jsp&lt;content type指定编码<br />  3, html&lt;meta指定编码<br />  前两种在指定时都同时把生成的html数据按指定编码编码传过来了[把内存unicode转成对应编码]。<br />  后1种的实际编码要看实际存储的时候如何存储的。<br />  这样浏览器按指定编码把获得的ｈｔｍｌ解码显示出来。<br />  2）浏览器发送数据时<br />  url根据ie设置可以总是以rtf-8发送，表单数据默认采用网页编码发送，当然也可以指定。<br />  3）java接受数据后首先把url按iso-8859-1解析,得到request参数。然后可以通过在request.setEncod~来按指定编码解析表单数据[编码的unicode转化]，否则默认按iso-8859-1解析。<br />   4）java访问数据库通过jdbc driver。jdbc driver负责完成unicode和db默认编码的转化。<br />  问题列举：<br />  如果传递的html含有中文，而编码默认指定为iso-8859-1,出现乱码<br />  如果url中含有中文以rtf-8发送，java不处理会出现问题。<br />  如果浏览器发送的form数据含有中文，而没有通过对应编码解析request,得到的参数会出现问题。<br />  如果jdbc driver出现bug,比如mysql，会导致乱码。<br />  <br />  <br />  <br />  <br />  <br />  <br />  <br />  </p>
		<p>
		</p>
		<p> </p>
<img src ="http://www.blogjava.net/baixch/aggbug/39447.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/baixch/" target="_blank">英雄</a> 2006-04-05 18:59 <a href="http://www.blogjava.net/baixch/articles/39447.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>