﻿<?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/bibi/category/4656.html</link><description>&lt;font size=2&gt;笨鸟后飞，天空会有我翅膀划过的痕迹！&lt;br&gt;关注世界，真情人生，扫描人间百态！&lt;br&gt;My contact: o_olle_e@hotmail.com&lt;/font&gt; 
</description><language>zh-cn</language><lastBuildDate>Tue, 27 Feb 2007 18:54:41 GMT</lastBuildDate><pubDate>Tue, 27 Feb 2007 18:54:41 GMT</pubDate><ttl>60</ttl><item><title>收藏的JAVA面试题大全</title><link>http://www.blogjava.net/bibi/archive/2006/07/18/58701.html</link><dc:creator>胡子鱼</dc:creator><author>胡子鱼</author><pubDate>Tue, 18 Jul 2006 02:32:00 GMT</pubDate><guid>http://www.blogjava.net/bibi/archive/2006/07/18/58701.html</guid><wfw:comment>http://www.blogjava.net/bibi/comments/58701.html</wfw:comment><comments>http://www.blogjava.net/bibi/archive/2006/07/18/58701.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/bibi/comments/commentRss/58701.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bibi/services/trackbacks/58701.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 以前的收藏，估计很少有这么全的面试题集了 ^_^&nbsp;&nbsp;<a href='http://www.blogjava.net/bibi/archive/2006/07/18/58701.html'>阅读全文</a><img src ="http://www.blogjava.net/bibi/aggbug/58701.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bibi/" target="_blank">胡子鱼</a> 2006-07-18 10:32 <a href="http://www.blogjava.net/bibi/archive/2006/07/18/58701.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Leadership and Outsourcing Project Management -- mIchael</title><link>http://www.blogjava.net/bibi/archive/2006/03/03/33501.html</link><dc:creator>胡子鱼</dc:creator><author>胡子鱼</author><pubDate>Fri, 03 Mar 2006 09:07:00 GMT</pubDate><guid>http://www.blogjava.net/bibi/archive/2006/03/03/33501.html</guid><wfw:comment>http://www.blogjava.net/bibi/comments/33501.html</wfw:comment><comments>http://www.blogjava.net/bibi/archive/2006/03/03/33501.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bibi/comments/commentRss/33501.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bibi/services/trackbacks/33501.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 有序，组员分工明确，能按计划提交高品质的项目产出的小组 <br>小组以任务为导向，无职务高低之区分，仅仅是任务分工不同 <br>有着一致的目标：在既定时辰内完成客户满意的工作产出 <br>&nbsp;&nbsp;<a href='http://www.blogjava.net/bibi/archive/2006/03/03/33501.html'>阅读全文</a><img src ="http://www.blogjava.net/bibi/aggbug/33501.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bibi/" target="_blank">胡子鱼</a> 2006-03-03 17:07 <a href="http://www.blogjava.net/bibi/archive/2006/03/03/33501.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>各种数据库中，如何读取前10条记录 </title><link>http://www.blogjava.net/bibi/archive/2006/01/19/28682.html</link><dc:creator>胡子鱼</dc:creator><author>胡子鱼</author><pubDate>Thu, 19 Jan 2006 09:39:00 GMT</pubDate><guid>http://www.blogjava.net/bibi/archive/2006/01/19/28682.html</guid><wfw:comment>http://www.blogjava.net/bibi/comments/28682.html</wfw:comment><comments>http://www.blogjava.net/bibi/archive/2006/01/19/28682.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/bibi/comments/commentRss/28682.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bibi/services/trackbacks/28682.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/bibi/archive/2006/01/19/28682.html'>阅读全文</a><img src ="http://www.blogjava.net/bibi/aggbug/28682.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bibi/" target="_blank">胡子鱼</a> 2006-01-19 17:39 <a href="http://www.blogjava.net/bibi/archive/2006/01/19/28682.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jsp-struts 常见问题集锦 --</title><link>http://www.blogjava.net/bibi/archive/2006/01/07/27032.html</link><dc:creator>胡子鱼</dc:creator><author>胡子鱼</author><pubDate>Sat, 07 Jan 2006 14:10:00 GMT</pubDate><guid>http://www.blogjava.net/bibi/archive/2006/01/07/27032.html</guid><wfw:comment>http://www.blogjava.net/bibi/comments/27032.html</wfw:comment><comments>http://www.blogjava.net/bibi/archive/2006/01/07/27032.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/bibi/comments/commentRss/27032.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bibi/services/trackbacks/27032.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 刚刚碰到的问题—— ＜html:text name="userForm" property="user.userAccount" styleClass="myInput" readOnly="true" ／＞ 有错吗？ 晕哦，就是错了，得把readOnly="true"改为readonly="true"，可是在javasript下，用函数去指定true或者false，O就必须大写…… 所以就去找了以下一篇。&nbsp;&nbsp;<a href='http://www.blogjava.net/bibi/archive/2006/01/07/27032.html'>阅读全文</a><img src ="http://www.blogjava.net/bibi/aggbug/27032.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bibi/" target="_blank">胡子鱼</a> 2006-01-07 22:10 <a href="http://www.blogjava.net/bibi/archive/2006/01/07/27032.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何把awt或者swing的UI生成一个图形文件</title><link>http://www.blogjava.net/bibi/archive/2005/12/20/24822.html</link><dc:creator>胡子鱼</dc:creator><author>胡子鱼</author><pubDate>Tue, 20 Dec 2005 09:16:00 GMT</pubDate><guid>http://www.blogjava.net/bibi/archive/2005/12/20/24822.html</guid><wfw:comment>http://www.blogjava.net/bibi/comments/24822.html</wfw:comment><comments>http://www.blogjava.net/bibi/archive/2005/12/20/24822.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bibi/comments/commentRss/24822.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bibi/services/trackbacks/24822.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/bibi/archive/2005/12/20/24822.html'>阅读全文</a><img src ="http://www.blogjava.net/bibi/aggbug/24822.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bibi/" target="_blank">胡子鱼</a> 2005-12-20 17:16 <a href="http://www.blogjava.net/bibi/archive/2005/12/20/24822.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>my.ini备份</title><link>http://www.blogjava.net/bibi/archive/2005/12/11/23312.html</link><dc:creator>胡子鱼</dc:creator><author>胡子鱼</author><pubDate>Sat, 10 Dec 2005 19:45:00 GMT</pubDate><guid>http://www.blogjava.net/bibi/archive/2005/12/11/23312.html</guid><wfw:comment>http://www.blogjava.net/bibi/comments/23312.html</wfw:comment><comments>http://www.blogjava.net/bibi/archive/2005/12/11/23312.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bibi/comments/commentRss/23312.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bibi/services/trackbacks/23312.html</trackback:ping><description><![CDATA[<P><FONT face="Courier New">Q: 在本地计算机 无法启动MySQL服务 错误1067：进程意外中止<BR>A: 5.0以上版本，my.ini放在安装目录下即要；以下版本放在windows目录下。<BR>以下是5.0.16版本的备份：<BR># MySQL Server Instance Configuration File<BR># ----------------------------------------------------------------------<BR># Generated by the MySQL Server Instance Configuration Wizard<BR>#<BR>#<BR># Installation Instructions<BR># ----------------------------------------------------------------------<BR>#<BR># On Linux you can copy this file to /etc/my.cnf to set global options,<BR># mysql-data-dir/my.cnf to set server-specific options<BR># (@localstatedir@ for this installation) or to<BR># ~/.my.cnf to set user-specific options.<BR>#<BR># On Windows you should keep this file in the installation directory <BR># of your server (e.g. C:\Program Files\MySQL\MySQL Server 4.1). To<BR># make sure the server reads the config file use the startup option <BR># "--defaults-file". <BR>#<BR># To run run the server from the command line, execute this in a <BR># command line shell, e.g.<BR># mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini"<BR>#<BR># To install the server as a Windows service manually, execute this in a <BR># command line shell, e.g.<BR># mysqld --install MySQL41 --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini"<BR>#<BR># And then execute this in a command line shell to start the server, e.g.<BR># net start MySQL41<BR>#<BR>#<BR># Guildlines for editing this file<BR># ----------------------------------------------------------------------<BR>#<BR># In this file, you can use all long options that the program supports.<BR># If you want to know the options a program supports, start the program<BR># with the "--help" option.<BR>#<BR># More detailed information about the individual options can also be<BR># found in the manual.<BR>#<BR>#<BR># CLIENT SECTION<BR># ----------------------------------------------------------------------<BR>#<BR># The following options will be read by MySQL client applications.<BR># Note that only client applications shipped by MySQL are guaranteed<BR># to read this section. If you want your own MySQL client program to<BR># honor these values, you need to specify it as an option during the<BR># MySQL client library initialization.<BR>#<BR>[client]</FONT></P>
<P><FONT face="Courier New">port=3306</FONT></P>
<P><FONT face="Courier New">[mysql]</FONT></P>
<P><FONT face="Courier New">default-character-set=gbk</FONT></P><FONT face="Courier New">
<P><BR># SERVER SECTION<BR># ----------------------------------------------------------------------<BR>#<BR># The following options will be read by the MySQL Server. Make sure that<BR># you have installed the server correctly (see above) so it reads this <BR># file.<BR>#<BR>[mysqld]</P>
<P># The TCP/IP Port the MySQL Server will listen on<BR>port=3306</P>
<P><BR>#Path to installation directory. All paths are usually resolved relative to this.<BR>basedir="D:/DB/mysql/"</P>
<P>#Path to the database root<BR>datadir="D:/DB/mysql/Data/"</P>
<P># The default character set that will be used when a new schema or table is<BR># created and no character set is defined<BR>default-character-set=gbk</P>
<P># The default storage engine that will be used when create new tables when<BR>default-storage-engine=INNODB</P>
<P># Set the SQL mode to strict<BR>sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"</P>
<P># The maximum amount of concurrent sessions the MySQL server will<BR># allow. One of these connections will be reserved for a user with<BR># SUPER privileges to allow the administrator to login even if the<BR># connection limit has been reached.<BR>max_connections=100</P>
<P># Query cache is used to cache SELECT results and later return them<BR># without actual executing the same query once again. Having the query<BR># cache enabled may result in significant speed improvements, if your<BR># have a lot of identical queries and rarely changing tables. See the<BR># "Qcache_lowmem_prunes" status variable to check if the current value<BR># is high enough for your load.<BR># Note: In case your tables change very often or if your queries are<BR># textually different every time, the query cache may result in a<BR># slowdown instead of a performance improvement.<BR>query_cache_size=0</P>
<P># The number of open tables for all threads. Increasing this value<BR># increases the number of file descriptors that mysqld requires.<BR># Therefore you have to make sure to set the amount of open files<BR># allowed to at least 4096 in the variable "open-files-limit" in<BR># section [mysqld_safe]<BR>table_cache=256</P>
<P># Maximum size for internal (in-memory) temporary tables. If a table<BR># grows larger than this value, it is automatically converted to disk<BR># based table This limitation is for a single table. There can be many<BR># of them.<BR>tmp_table_size=5M</P>
<P><BR># How many threads we should keep in a cache for reuse. When a client<BR># disconnects, the client's threads are put in the cache if there aren't<BR># more than thread_cache_size threads from before.&nbsp; This greatly reduces<BR># the amount of thread creations needed if you have a lot of new<BR># connections. (Normally this doesn't give a notable performance<BR># improvement if you have a good thread implementation.)<BR>thread_cache_size=8</P>
<P>#*** MyISAM Specific options</P>
<P># The maximum size of the temporary file MySQL is allowed to use while<BR># recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE.<BR># If the file-size would be bigger than this, the index will be created<BR># through the key cache (which is slower).<BR>myisam_max_sort_file_size=100G</P>
<P># If the temporary file used for fast index creation would be bigger<BR># than using the key cache by the amount specified here, then prefer the<BR># key cache method.&nbsp; This is mainly used to force long character keys in<BR># large tables to use the slower key cache method to create the index.<BR>myisam_max_extra_sort_file_size=100G</P>
<P># If the temporary file used for fast index creation would be bigger<BR># than using the key cache by the amount specified here, then prefer the<BR># key cache method.&nbsp; This is mainly used to force long character keys in<BR># large tables to use the slower key cache method to create the index.<BR>myisam_sort_buffer_size=8M</P>
<P># Size of the Key Buffer, used to cache index blocks for MyISAM tables.<BR># Do not set it larger than 30% of your available memory, as some memory<BR># is also required by the OS to cache rows. Even if you're not using<BR># MyISAM tables, you should still set it to 8-64M as it will also be<BR># used for internal temporary disk tables.<BR>key_buffer_size=8M</P>
<P># Size of the buffer used for doing full table scans of MyISAM tables.<BR># Allocated per thread, if a full scan is needed.<BR>read_buffer_size=64K<BR>read_rnd_buffer_size=256K</P>
<P># This buffer is allocated when MySQL needs to rebuild the index in<BR># REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE<BR># into an empty table. It is allocated per thread so be careful with<BR># large settings.<BR>sort_buffer_size=212K</P>
<P><BR>#*** INNODB Specific options ***</P>
<P><BR># Use this option if you have a MySQL server with InnoDB support enabled<BR># but you do not plan to use it. This will save memory and disk space<BR># and speed up some things.<BR>#skip-innodb</P>
<P># Additional memory pool that is used by InnoDB to store metadata<BR># information.&nbsp; If InnoDB requires more memory for this purpose it will<BR># start to allocate it from the OS.&nbsp; As this is fast enough on most<BR># recent operating systems, you normally do not need to change this<BR># value. SHOW INNODB STATUS will display the current amount used.<BR>innodb_additional_mem_pool_size=2M</P>
<P># If set to 1, InnoDB will flush (fsync) the transaction logs to the<BR># disk at each commit, which offers full ACID behavior. If you are<BR># willing to compromise this safety, and you are running small<BR># transactions, you may set this to 0 or 2 to reduce disk I/O to the<BR># logs. Value 0 means that the log is only written to the log file and<BR># the log file flushed to disk approximately once per second. Value 2<BR># means the log is written to the log file at each commit, but the log<BR># file is only flushed to disk approximately once per second.<BR>innodb_flush_log_at_trx_commit=1</P>
<P># The size of the buffer InnoDB uses for buffering log data. As soon as<BR># it is full, InnoDB will have to flush it to disk. As it is flushed<BR># once per second anyway, it does not make sense to have it very large<BR># (even with long transactions).<BR>innodb_log_buffer_size=1M</P>
<P># InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and<BR># row data. The bigger you set this the less disk I/O is needed to<BR># access data in tables. On a dedicated database server you may set this<BR># parameter up to 80% of the machine physical memory size. Do not set it<BR># too large, though, because competition of the physical memory may<BR># cause paging in the operating system.&nbsp; Note that on 32bit systems you<BR># might be limited to 2-3.5G of user level memory per process, so do not<BR># set it too high.<BR>innodb_buffer_pool_size=8M</P>
<P># Size of each log file in a log group. You should set the combined size<BR># of log files to about 25%-100% of your buffer pool size to avoid<BR># unneeded buffer pool flush activity on log file overwrite. However,<BR># note that a larger logfile size will increase the time needed for the<BR># recovery process.<BR>innodb_log_file_size=10M</P>
<P># Number of threads allowed inside the InnoDB kernel. The optimal value<BR># depends highly on the application, hardware as well as the OS<BR># scheduler properties. A too high value may lead to thread thrashing.<BR>innodb_thread_concurrency=8<BR><BR><BR></P></FONT><img src ="http://www.blogjava.net/bibi/aggbug/23312.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bibi/" target="_blank">胡子鱼</a> 2005-12-11 03:45 <a href="http://www.blogjava.net/bibi/archive/2005/12/11/23312.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GOOGLE挑战赛练习题1及答案(200分)</title><link>http://www.blogjava.net/bibi/archive/2005/11/28/21620.html</link><dc:creator>胡子鱼</dc:creator><author>胡子鱼</author><pubDate>Mon, 28 Nov 2005 02:32:00 GMT</pubDate><guid>http://www.blogjava.net/bibi/archive/2005/11/28/21620.html</guid><wfw:comment>http://www.blogjava.net/bibi/comments/21620.html</wfw:comment><comments>http://www.blogjava.net/bibi/archive/2005/11/28/21620.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/bibi/comments/commentRss/21620.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bibi/services/trackbacks/21620.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 总得分1485.45分，在300多人中，暂时排名12，但本题只得132.86分。&nbsp;&nbsp;<a href='http://www.blogjava.net/bibi/archive/2005/11/28/21620.html'>阅读全文</a><img src ="http://www.blogjava.net/bibi/aggbug/21620.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bibi/" target="_blank">胡子鱼</a> 2005-11-28 10:32 <a href="http://www.blogjava.net/bibi/archive/2005/11/28/21620.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>cocoon学习笔记[转自竹笋炒肉]</title><link>http://www.blogjava.net/bibi/archive/2005/11/10/cocoon.html</link><dc:creator>胡子鱼</dc:creator><author>胡子鱼</author><pubDate>Thu, 10 Nov 2005 09:56:00 GMT</pubDate><guid>http://www.blogjava.net/bibi/archive/2005/11/10/cocoon.html</guid><wfw:comment>http://www.blogjava.net/bibi/comments/19199.html</wfw:comment><comments>http://www.blogjava.net/bibi/archive/2005/11/10/cocoon.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bibi/comments/commentRss/19199.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bibi/services/trackbacks/19199.html</trackback:ping><description><![CDATA[<P>　　cocoon读[ke'ku:n],茧的意思。</P><A name=more></A>
<P>　　接连看到几篇文章谈cocoon，因其中牵扯术语太多，看后一头雾水，遂起学习之心。</P>
<P>　　网上找到很多谈cocoon的，IBM : developerWorks 中国网站 的在线教程写得最棒。下面就是学习笔记，觉得有意思就顺手记下来了。</P>
<P>　　以下三行是取源码的命令。<BR>　　cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login<BR>　　cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic -z3 checkout -r cocoon_20_branch xml-cocoon2<BR>　　cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic logout<BR>　　<BR>　　管道由一些输入数据以及随后对它进行的一些处理步骤构成。每个处理步骤接受前一步的输出作为输入，一直到达管道的末端并产生最终输出。</P>
<P>　　Cocoon 包含许多常规管道组件，根据在管道中扮演的角色，它们分组成几种完全不同的类型。</P>
<P>　　管道输入 — 生成器(如FileGenerator,HTMLGenerator,DirectoryGenerator)和阅读器(常用来读静态文件) <BR>　　处理步骤 — 转换器(如XSLT 转换器)和操作 <BR>　　管道输出 — 序列化器(如XML,HTML,SVG,PDF序列化器 ) <BR>　　条件的处理 — 匹配器和选择器 </P>
<P>　　Cocoon 管道通常至少由生成器和序列化器组成，但可能含有任意数量的处理步骤。将数据作为 SAX 事件通过 Cocoon 管道传递。 </P>
<P>　　对接收请求和为响应提供服务的逻辑周期如下：<BR>　　1、从用户接受请求。 <BR>　　2、确定用来解释该请求并生成响应的适当管道（使用匹配器）。 <BR>　　3、从可用的预配置的组件构造管道。 <BR>　　4、指示管道为请求服务。 <BR>　　5、将由管道生成的响应返回用户，可能对结果进行高速缓存以便以后使用。 </P>
<P>　　网站地图（sitemap）两个功能：<BR>　　1、声明组件； <BR>　　2、定义管道。 </P>
<P>　　XML Server Pages（XSP）编译过程如下图：<BR>　　 
<CENTER><IMG src="http://www-900.ibm.com/developerWorks/cn/education/xml/x-xsp/tutorial/images/xsp.gif"></CENTER>
<P></P>
<P>　　XSP语法：<BR>　　1、xsp:page 元素是每个 XSP 文档的根元素。它必须有一个标识该页面包含的编程语言 — 具体说就是“java”— 的语言属性。<BR>　　该页面元素可能包含：<BR>　　　任意数目的 xsp:structure 元素 <BR>　　　任意数目的 xsp:logic 元素 <BR>　　　单个用户元素 <BR>　　这最后一个限制非常重要。“用户元素”表示不在 XSP 名称空间中的任何元素，包括无名称空间的元素。之所以有这个限制是因为用户元素成为由 XSP 页面创建的 XML 文档的根元素，而 XML 文档只能有单个根元素。</P>
<P>　　2、xsp:structure 和 xsp:include 元素用于向代码生成过程提供这些附加提示。这两个元素是一前一后使用的，xsp:structure 元素将许多 xsp:include 元素组合在一起。每个 xsp:include 定义一个要导入的附加 Java 包或类。</P>
<P>　　3、xsp:logic 元素用于将 Java 代码块添加到 XSP。<BR>　　在这些元素作为 xsp:page 元素的直接子元素出现的任何地方（也就是，单个用户元素以外），这个代码块都应包含方法定义和／或成员变量。之所以存在这一点是因为出现在用户元素以外的代码不包含在生成器的 generate() 方法内。常规的 Java 语法规则意味着这个代码必须是成员或类（也就是，静态）变量或方法。<BR>　　xsp:logic 元素也可以使用在 XSP 页面的其它地方。在这种情况下，它们应该包含将被添加到已编译的生成器中的 generate() 方法的 Java 语句。这使 xsp:logic 元素类似于 JSP 页面中使用的 <% ... %>scriptlet 语法。</P>
<P>　　4、CDATA 节，它向 XML 解析器发出信号以对于那节内容不采用良好格式规则<BR>　　&lt;![CDATA[...]]&gt;</P>
<P>　　5、xsp:expr 元素用于封装一个表达式，该表达式的值将直接添加到输出文档。与此相反，xsp:logic 元素包含生成器的代码。因此，xsp:expr 元素等价于在 JSP 中实现类似角色的 &lt;%= ... %&gt; 表达式语法。例如：<BR>&lt;elements&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsp:logic&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(int&nbsp;i=1;&nbsp;i&lt;11;&nbsp;i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;element&gt;&lt;xsp:expr&gt;i&lt;/xsp:expr&gt;&lt;/element&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&lt;/xsp:logic&gt;<BR>&lt;/elements&gt;<BR><BR>　　6、通过使用 xsp:element 生成动态元素。如：<BR>&lt;xsp:element&nbsp;prefix="my"&nbsp;uri="http://www.examples.org"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsp:param&nbsp;name="name"&gt;&lt;xsp:expr&gt;"myElementName"&lt;/xsp:expr&gt;&lt;/xsp:param&gt;<BR>&nbsp;&nbsp;&nbsp;Element&nbsp;content<BR>&lt;/xsp:element&gt;<BR>这个示例生成了以下&nbsp;XML&nbsp;输出：<BR>&lt;my:myElementName&nbsp;xmlns:my="http://www.examples.org"&gt;Element&nbsp;content&lt;/my:myElementName&gt;</P>
<P>　　7、通过使用 xsp:attribute 生成动态属性<BR>&lt;xsp:element&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsp:param&nbsp;name="name"&gt;&lt;xsp:expr&gt;"myElementName"&lt;/xsp:expr&gt;&lt;/xsp:param&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsp:attribute&nbsp;name="myAttribute"&gt;myAttributeValue&lt;/xsp:attribute&gt;<BR>&nbsp;&nbsp;&nbsp;Element&nbsp;content<BR>&lt;/xsp:element&gt;<BR>和（两个例程没关系）<BR>&lt;image&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsp:attribute&nbsp;name="href"&gt;&lt;xsp:expr&gt;calculateImageURL()&lt;/xsp:expr&gt;&lt;/xsp:attribute&gt;<BR>&lt;/image&gt;</P>
<P>　　8、xsp:comment 和 xsp:pi 元素用于创建注释和处理指令。<BR>&lt;xsp:comment&gt;This&nbsp;is&nbsp;a&nbsp;comment&lt;/xsp:comment&gt;<BR>然后这个注释变成：<BR>&lt;!--&nbsp;This&nbsp;is&nbsp;a&nbsp;comment&nbsp;--&gt;<BR>请注意：尽管任何文本将被添加到注释，但任何嵌套标记都被忽略了。</P>
<P>创建处理指令类似于创建动态元素或属性。xsp:pi&nbsp;元素应该有一个标识处理指令目标的嵌套参数。照例对&nbsp;xsp:pi&nbsp;元素的剩余内容求值。这里是一个简单示例：<BR>&lt;xsp:pi&nbsp;target="myApplication"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsp:expr&gt;"param1=value,&nbsp;param2=value,&nbsp;generatorTimestamp="&nbsp;+<BR>&nbsp;&nbsp;&nbsp;System.currentTimeMillis()&lt;/xsp:expr&gt;<BR>&lt;/xsp:pi&gt;<BR>输出如下：<BR>&lt;?myApplication&nbsp;param1=value,&nbsp;param2=value,&nbsp;generatorTimestamp=1017407796870?&gt;</P>
<P>　　逻辑单是可以被添加到 XSP 页面的定制元素库，是通过使用 XSLT 转换实现的。这些转换将附加的代码块和／或 XSP 标记引入到 XSP 文档，这样扩展了产生 Generator 类的能力。<BR>　　每个逻辑单都与一个特殊的名称空间关联。使用逻辑单仅仅涉及在 XSP 文档中声明相应的名称空间，然后在需要的时候添加来自那个名称空间的元素。如<BR>&lt;xsp:page&nbsp;language="java"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:xsp="http://apache.org/xsp"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:util="http://apache.org/xsp/util/2.0"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;clock&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;day&gt;&lt;util:time&nbsp;format="EE"/&gt;&lt;/day&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;month&gt;&lt;util:time&nbsp;format="MMMM"/&gt;&lt;/month&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;year&gt;&lt;util:time&nbsp;format="yyyy"/&gt;&lt;/year&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;time&gt;&lt;util:time&nbsp;format="HH:mm:ss&nbsp;'on'&nbsp;dd/MM/yyyy"/&gt;&lt;/time&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;/clock&gt;<BR>&lt;/xsp:page&gt;</P>
<P>请注意该页面声明了实用程序的名称空间&nbsp;http://apache.org/xsp/util/2.0，并使用一个附加的元素，而没有插入任何附加&nbsp;Java&nbsp;代码。当对它求值时，这个页面产生：</P>
<P>&lt;clock&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;day&gt;Fri&lt;/day&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;month&gt;March&lt;/month&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;year&gt;2002&lt;/year&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;time&gt;15:14:27&nbsp;on&nbsp;29/03/2002&lt;/time&gt;<BR>&lt;/clock&gt;</P>
<P>　　Cocoon 2 提供了许多预先定义的逻辑单，它们提供大量有用功能，而不必编写 Java 代码。根据这些预先定义的的逻辑单提供的功能类型，可以对它们进行松散分类：<BR>　　1、环境（Environmental）逻辑单 — 提供了对 Cocoon 处理环境的访问（例如，请求和响应） ,有以下四个：<BR>　　1）请求（request）逻辑单提供了对请求属性的访问，包括对请求参数、请求方法（例如，GET、POST 等等）以及请求标题的访问。当请求参数的某些方面用于改变输出文档的生成时，这个逻辑单就格外有用。<BR>　　2）响应（response）逻辑单提供对与当前请求关联的 HTTP 响应的限制访问；它只提供对请求标题的访问。XSP 文档不能用与 Java Servlet 或 JSP 页面相同的方法执行包含或转发，因为分离问题是 Cocoon 2 体系结构的核心部分。这个功能描述在网站地图中；XSP 页面生成 XML 内容而不指导处理。<BR>　　3）会话（session）逻辑单提供了对 HTTP 会话信息的访问，包括创建和删除会话以及添加和除去会话属性的能力。很明显，这个功能在必须为上下文维护用户会话的 Web 应用程序中是最有用的。Cocoon 2 中的会话管理正好等价于它的 JSP 对手。<BR>　　4）cookie 逻辑单提供了 cookie 维护功能，诸如添加和除去 cookie、允许优先存储到用户的浏览器中。</P>
<P><BR>　　2、实用程序逻辑单 — 多用途实用程序代码（例如，文件包含、日志记录、发送邮件等等） <BR>　　有三个逻辑单，每个逻辑单都提供了一些简单的实用程序功能。<BR>　　1）日期和时间</P>
<P>　　2）日志（log）逻辑单处理用户请求时，它允许从&nbsp;XSP&nbsp;生成器上写入日志消息。如：<BR>&lt;log:debug&gt;This&nbsp;is&nbsp;a&nbsp;debug&nbsp;message&nbsp;from&nbsp;an&nbsp;XSP&nbsp;generator&lt;/log:debug&gt;<BR>还有附加的&nbsp;info、warn、error&nbsp;和&nbsp;fatal-error&nbsp;元素用于写其它各种日志语句。</P>
<P>　　3）发送邮件（sendmail）&nbsp;逻辑单包含了一个提供从&nbsp;XSP&nbsp;页面对&nbsp;JavaMail&nbsp;API&nbsp;访问的有用元素,如：<BR>&lt;sendmail:send-mail&nbsp;from="myemail@email.com"&nbsp;to="user@user.com"&nbsp;smtphost="smtphost@email.com"&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsp:param&nbsp;name="subject"&gt;&lt;xsp:expr&gt;"The&nbsp;subject&nbsp;of&nbsp;this&nbsp;email..."&lt;/xsp:expr&gt;&lt;/xsp:param&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;xsp:param&nbsp;name="body"&gt;&lt;xsp:expr&gt;"The&nbsp;body&nbsp;of&nbsp;this&nbsp;email..."&lt;/xsp:expr&gt;&lt;/xsp:param&gt;<BR>&lt;/sendmail:send-mail&gt;</P>
<P>　　3、数据操作 — 提供了对数据验证和与数据库关联的功能的访问 <BR>有两个逻辑单属于该类别，其中的一个提供了比另一个明显更多的功能。</P>
<P>　　表单验证器（form validator）逻辑单从未真正单独使用。它向 Cocoon 表单验证器行为（Cocoon Form Validator Action）提供一个整齐的界面。这个行为能够对从 HTML 表单发送到 Cocoon 应用程序的数据执行基本验证操作，包括检查整数的最小和最大值、检查字符串的大小以及检查提供的某些参数。一个著名功能是能够测试传递的变量是否匹配给定的正则表达式。</P>
<P>　　验证的结果存储在请求参数中。验证器（validator）逻辑单提供了解释来自 XSP 页面内的这些结果的方法。这样允许为用户动态生成错误消息。</P>
<P>　　在数据被确认为有效之后，下一步是将那个数据存储到数据库中。esql 逻辑单提供了执行这一步的方法，并提供了更多的功能，包括选择、删除和更新数据库。本质上，esql 逻辑单提供了将 SQL 语句直接嵌入到 XSP 文档的方法。然后这个逻辑单生成相应的 JDBC 代码来实现 SQL 操作，这样通过使用 Cocoon 2 简化了对数据库数据的操作和检索。<BR><BR><A href="http://hedong.3322.org/1stblog/archives.html">http://hedong.3322.org/1stblog/archives.html</A></P><img src ="http://www.blogjava.net/bibi/aggbug/19199.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bibi/" target="_blank">胡子鱼</a> 2005-11-10 17:56 <a href="http://www.blogjava.net/bibi/archive/2005/11/10/cocoon.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>