﻿<?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-BeanSoft's Java Blog-随笔分类-Web</title><link>http://www.blogjava.net/beansoft/category/17587.html</link><description>MyEclipse 6, Java EE 5, JSPWiki, Spring, Struts, Hibernate, JPA, SWT, Swing, AJAX, JavaScript, Netbeans</description><language>zh-cn</language><lastBuildDate>Fri, 25 Apr 2008 09:22:45 GMT</lastBuildDate><pubDate>Fri, 25 Apr 2008 09:22:45 GMT</pubDate><ttl>60</ttl><item><title>分享到底：50MB的Web学习资料以及CodeLibrary.NET免费版</title><link>http://www.blogjava.net/beansoft/archive/2008/03/26/188642.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Wed, 26 Mar 2008 01:38:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2008/03/26/188642.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/188642.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2008/03/26/188642.html#Feedback</comments><slash:comments>15</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/188642.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/188642.html</trackback:ping><description><![CDATA[<a href="ftp://beansoftdown:1234@219.141.70.147/">ftp://beansoftdown:1234@219.141.70.147/</a>&nbsp;&nbsp; 进入目录 CodeLibrary_NET <p>我在先前的时候介绍过 <a href="/beansoft/archive/2006/11/22/82873.html">CodeLibrary.NET 免费版(资料管理软件)</a> 这个软件，不过可惜的是免费版逐渐下载不到了。还好，我有，现在大家可以通过这里下载（运行需要.NET 1.1）：</p> <p>CodeLibAccess.zip CodeLibWeb.zip，按照顺序安装就可以了。</p> <p>&nbsp;</p> <p>我先后从网上收集过很多的学习资料，用这个软件，总共有454MB那么大，不过随着岁月流逝，日月轮回，斗转星移，沧海桑田，物是人非，花开花谢，潮起潮落，人来人往，发现这些资料大部分时候都用不到，还不如取之于网，用之于网，分享一部分给大家，要不然留电脑上也是发霉。现在大家可以下载上面两个软件，然后再下载这个数据库资料：</p> <p>Web.mdb.7z 用软件打开，即可浏览到内容，并可修改，文件是压缩过的15MB，解压缩后文件大小 49.5MB。</p> <p>如果您只是想看资料，而不想安装或者修改，可以试试只下载这两个文件: Web.mdb.7z&nbsp; CodeLibViewer.zip ，不过，还需要安装.NET 1.1。</p> <p>如果你有的是 .NET 2，那你只看资料的话可以下载这个：Web.mdb.7z CodeLibViewer.exe。</p> <p>用查看器打开Web.mdb就行了。查看器界面如下：</p> <p><a href="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/Web50MB_86B6/codelibviewer2_2.png"><img height="552" alt="codelibviewer2" src="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/Web50MB_86B6/codelibviewer2_thumb.png" width="639" border="0"></a> </p> <p>下面是资料内容列表（主要是和Web开发有关的一些资料，内容并未做验证，仅供参考）：</p> <p><a href="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/Web50MB_86B6/Web_codelib_2.png"><img height="4500" alt="Web_codelib" src="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/Web50MB_86B6/Web_codelib_thumb.png" width="742" border="0"></a></p><img src ="http://www.blogjava.net/beansoft/aggbug/188642.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2008-03-26 09:38 <a href="http://www.blogjava.net/beansoft/archive/2008/03/26/188642.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>触犯天条的离奇表单验证代码</title><link>http://www.blogjava.net/beansoft/archive/2008/03/12/185837.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Wed, 12 Mar 2008 14:12:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2008/03/12/185837.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/185837.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2008/03/12/185837.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/185837.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/185837.html</trackback:ping><description><![CDATA[<p>&nbsp; 晚饭后，有人在发疑问为啥编写的Struts里面的表单验证代码死活不会执行。原始代码如下：</p> <div><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="background-color: #ffff00">&lt;%@page contentType="text/html;charset=gb2312"%&gt;</span>
<span style="background-color: #ffff00">&lt;%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">html:html</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span>welcome next<span style="color: #0000ff">&lt;/</span><span style="color: #800000">title</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">head</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">center</span><span style="color: #0000ff">&gt;</span>
注销页面
<span style="color: #0000ff">&lt;</span><span style="color: #800000">html:form</span> <span style="color: #ff0000">action</span><span style="color: #0000ff">="/delete"</span> <span style="color: #ff0000">enctype</span><span style="color: #0000ff">="multipart/form-data"</span> <span style="color: #ff0000">onsubmit</span><span style="color: #0000ff">="return delete(this);"</span><span style="color: #0000ff">&gt;</span>
用户名:<span style="color: #0000ff">&lt;</span><span style="color: #800000">html:text</span> <span style="color: #ff0000">property</span><span style="color: #0000ff">="username"</span><span style="color: #0000ff">/&gt;&lt;</span><span style="color: #800000">br</span><span style="color: #0000ff">&gt;</span>
年<span style="color: #ff0000">&amp;nbsp;</span><span style="color: #ff0000">&amp;nbsp;</span>龄:<span style="color: #0000ff">&lt;</span><span style="color: #800000">html:text</span> <span style="color: #ff0000">property</span><span style="color: #0000ff">="age"</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=""</span><span style="color: #0000ff">/&gt;&lt;</span><span style="color: #800000">br</span><span style="color: #0000ff">&gt;</span>
地<span style="color: #ff0000">&amp;nbsp;</span><span style="color: #ff0000">&amp;nbsp;</span>址:<span style="color: #0000ff">&lt;</span><span style="color: #800000">html:text</span> <span style="color: #ff0000">property</span><span style="color: #0000ff">="address"</span><span style="color: #0000ff">/&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">br</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">html:submit</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">="注销"</span><span style="color: #0000ff">/&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">html:form</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">center</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">script</span> <span style="color: #ff0000">language</span><span style="color: #0000ff">="javascript"</span><span style="color: #0000ff">&gt;</span><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   1:</span>&nbsp; </pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   2:</span> <span style="color: #0000ff">function</span> delete(form){</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   3:</span> <span style="color: #0000ff">if</span>(form.username.value==<span style="color: #006080">""</span>||form.age.value==<span style="color: #006080">""</span>||form.address.value==<span style="color: #006080">""</span>){</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   4:</span> alert(<span style="color: #006080">"请输入所有的信息!!!"</span>);</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   5:</span> <span style="color: #0000ff">return</span> <span style="color: #0000ff">false</span>;</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   6:</span> }</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   7:</span> <span style="color: #0000ff">else</span>{</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">   8:</span> alert(<span style="color: #006080">"注销成功!!!"</span>);</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">   9:</span> <span style="color: #0000ff">return</span> <span style="color: #0000ff">true</span>;</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060">  10:</span> }</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060">  11:</span> }</pre><span style="color: #0000ff">&lt;/</span><span style="color: #800000">script</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">body</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">html:html</span><span style="color: #0000ff">&gt;</span> </pre></div>
<p>运行症状就是不管怎么搞，都不会执行验证方法！对应的HTML代码如下： 
<blockquote>
<p>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;welcome next&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;center&gt;<br>注销页面<br>&lt;form name="deleteForm" method="post" action="/DataBaseStruts/delete.do" enctype="multipart/form-data" onsubmit="return delete(this);"&gt;<br>用户名:&lt;input type="text" name="username" value=""&gt;&lt;br&gt;<br>年&amp;nbsp;&amp;nbsp;龄:&lt;input type="text" name="age" value=""&gt;&lt;br&gt;<br>地&amp;nbsp;&amp;nbsp;址:&lt;input type="text" name="address" value=""&gt;<br>&lt;br&gt;<br>&lt;input type="submit" value="注销"&gt;<br>&lt;/form&gt;<br>&lt;/center&gt;<br>&lt;script language="javascript"&gt;&nbsp;&nbsp; <br>function delete(form){&nbsp;&nbsp; <br>&nbsp; if(form.username.value==""||form.age.value==""||form.address.value==""){&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; alert("请输入所有的信息!!!");&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; return false;&nbsp;&nbsp; <br>&nbsp; }&nbsp;&nbsp; <br>&nbsp; else{&nbsp;&nbsp; <br>&nbsp;&nbsp; alert("注销成功!!!");&nbsp;&nbsp; <br>&nbsp;&nbsp; return true;&nbsp; <br>&nbsp;&nbsp;&nbsp; }&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; return true;&nbsp; <br>}<br>&nbsp;&nbsp; &lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt; </p></blockquote>
<div>把这个页面存成HTML代码，不论在IE还是Firefox中，都不会执行！但是又不报任何错误！难道我们写错了嘛？那当然，这个错误真是特别特别的隐蔽，因为：delete是个JavaScript的关键字！ </div>
<p>JScript <br><a href="../html-vss/jsTOC.htm">语言参考</a> 
<hr>

<h3><a name="jsoprdelete"></a>delete 运算符</h3>
<p>从对象中删除一个属性，或从数组中删除一个元素。 
<p><code><b>delete</b> expression</code> 
<p><i>expression</i> 参数是一个有效的 JScript 表达式，通常是一个属性名或数组元素。 
<h6>说明</h6>
<p>如果 <i>expression</i> 的结果是一个对象，且在 <i>expression </i>中指定的属性存在，而该对象又不允许它被删除，则返回 <b>false</b>。 
<p>在所有其他情况下，返回 <b>true</b>。 
<p>&nbsp; <p>所以，把delete这个方法名随便改成其它有效的就行了！</p><img src ="http://www.blogjava.net/beansoft/aggbug/185837.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2008-03-12 22:12 <a href="http://www.blogjava.net/beansoft/archive/2008/03/12/185837.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转载:servletAPI2.1中文版.txt</title><link>http://www.blogjava.net/beansoft/archive/2007/11/02/157665.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Fri, 02 Nov 2007 02:14:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/11/02/157665.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/157665.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/11/02/157665.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/157665.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/157665.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: http://www.blogjava.net/Files/beansoft/servletAPI2.1中文版.txt.zip &nbsp; 译者前言：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 近来在整理有关Servlet资料时发现，在网上竟然找不到一份中文的Java Servlet API的说明文档，而在有一本有关JSP的书后面附的Java Servlet API说明竟然不全...&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/11/02/157665.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/157665.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-11-02 10:14 <a href="http://www.blogjava.net/beansoft/archive/2007/11/02/157665.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript 三级级联菜单</title><link>http://www.blogjava.net/beansoft/archive/2007/10/22/154898.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Mon, 22 Oct 2007 02:43:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/10/22/154898.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/154898.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/10/22/154898.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/154898.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/154898.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 2005 年的时候帮人收集整理修改的一份脚本级联菜单, 没用到 AJAX, 写死的数据. 效果自己试试就知道了. 支持主流浏览器. 自己现在看看这代码就觉得头大... 呵呵 脚本就是脚本啊. 一段时间放下就看不懂了.		 						&lt;				HTML				&gt;																		&lt;				HEAD				&gt;	...&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/10/22/154898.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/154898.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-10-22 10:43 <a href="http://www.blogjava.net/beansoft/archive/2007/10/22/154898.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Tomcat JSP Web 开发中的乱码问题小姐</title><link>http://www.blogjava.net/beansoft/archive/2007/10/10/151848.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Wed, 10 Oct 2007 10:20:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/10/10/151848.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/151848.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/10/10/151848.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/151848.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/151848.html</trackback:ping><description><![CDATA[<p>1. 静态页面的乱码问题<br>&nbsp;&nbsp;&nbsp; 文件的编码和浏览器要显示的编码不一致。<br>&nbsp;&nbsp;&nbsp; 1) 检查文件原始的编码, 可以用记事本打开, 然后选择另存为来看;<br>&nbsp;&nbsp;&nbsp; 2) 给当前页面加入一个指令来建议浏览器用指定的编码来显示文件字符内容.<br>&nbsp;&nbsp;&nbsp; &lt;meta http-equiv="content-type" content="text/html; charset=GBK"&gt;<br>&nbsp;&nbsp;&nbsp; 3) 如果系统是英文XP,没装东亚字符集支持, 也会显示乱码.  <p>2. JSP 页面的乱码问题<br>&nbsp;&nbsp;&nbsp; 1) page 指令有个 pageEncoding="GBK" 这个会指定当前页面保存的编码, 如果写成ISO8859-1就不能保存汉字;<br>&nbsp;&nbsp;&nbsp; 2) page 指令的 contentType="text/html; charset=ISO8859-1" 也会像静态页面一样让浏览器来优先选择一种编码.<br>&nbsp;&nbsp;&nbsp; 如果JSP乱码的话,一般就显示成?，而且不管你给浏览器选什么样的编码，它都不能正确显示<br>3. 表单提交的乱码问题(Tomcat 特有)<br>&nbsp;&nbsp;&nbsp; 1). POST 的乱码<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a. 首先浏览器提交表单的编码是根据表单所在页面来决定的, 而不是根据提交后的 JSP 页面的编码来决定的. 把所有的页面的编码都设置成一样的,例如 GBK.  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b. 处理方式就是在获取参数之前设置编码:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; request.setCharacterEncoding("GBK");  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c. 可以用过滤器的方式来解决, Tomcat 已经带了一个现成的:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; apache-tomcat-5.5.23\webapps\jsp-examples\WEB-INF\classes\filters\SetCharacterEncodingFilter.java<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; web.xml<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;filter&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Set Character Encoding&lt;/filter-name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;filter-class&gt;filters.SetCharacterEncodingFilter&lt;/filter-class&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;init-param&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-name&gt;encoding&lt;/param-name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-value&gt;GBK&lt;/param-value&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/init-param&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/filter&gt;  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;filter-mapping&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Set Character Encoding&lt;/filter-name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/filter-mapping&gt;<br>&nbsp;&nbsp;&nbsp; 2) GET 方式的乱码<br>&nbsp;&nbsp;&nbsp; 用 setCharacterEncoding() 不能解决. TOMCAT 的一个BUG, GET 方式传送的表单参数总是用的 ISO8859-1 编码. 我们要把它转成 GBK 方式.<br>&nbsp;&nbsp;&nbsp; String username = request.getParameter("username");<br>System.out.println(username);<br>// 转码, 先取得原始的二进制字节数组<br>byte[] data = username.getBytes("ISO8859-1");<br>// 根据新的字符集再构造新的字符串<br>username = new String(data, "GBK");  <p>小结:<br>所有的页面(除了最后的 GET 的乱码问题)都用统一的编码(GBK或者UTF-8), 就不会出现乱码问题.  <p>4. 用过滤器来一次编码彻底解决表单参数的乱码问题 <p><a href="http://www.blogjava.net/beansoft/archive/2007/10/09/151368.html">Tomcat 5/6 GBK 编码下完美解决中文表单问题的过滤器</a></p><img src ="http://www.blogjava.net/beansoft/aggbug/151848.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-10-10 18:20 <a href="http://www.blogjava.net/beansoft/archive/2007/10/10/151848.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Tomcat 5/6 GBK 编码下完美解决中文表单问题的过滤器</title><link>http://www.blogjava.net/beansoft/archive/2007/10/09/151368.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 09 Oct 2007 05:29:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/10/09/151368.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/151368.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/10/09/151368.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/151368.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/151368.html</trackback:ping><description><![CDATA[<p>常见的 Tomcat 5 表单编码提交后乱码的解决方案有很多, 有改 Tomcat Connector 属性的, 有加过滤器的. 但是 Tomcat 自带的那个过滤器只解决了 POST 方式的乱码却不能处理 GET 方式的乱码.&nbsp; 在这里那我就给出一个不需要修改任何 Tomcat 配置文件的完美解决中文问题的过滤器的代码:</p> <p>首先是我们的测试页面:</p> <p> <form action="http://localhost/action.jsp">GET 方式: <input value="GET 中文" name="name"> <input type="submit" value="提交查询内容"> </form> <form action="http://localhost/action.jsp" method="post">POST 方式: <input value="POST 中文" name="name"> <input type="submit" value="提交查询内容"> </form></p> <p>index.jsp</p> <div><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">&lt;%@ page language=<span style="color: #006080">"java"</span> import=<span style="color: #006080">"java.util.*"</span> pageEncoding=<span style="color: #006080">"GBK"</span>%&gt;


&lt;!DOCTYPE HTML PUBLIC <span style="color: #006080">"-//W3C//DTD HTML 4.01 Transitional//EN"</span>&gt;
&lt;html&gt;
  &lt;head&gt;
   
    &lt;title&gt;表单测试页面&lt;/title&gt;

  &lt;/head&gt;
  
  &lt;body&gt;
   &lt;form action=<span style="color: #006080">"action.jsp"</span>&gt;
   GET 方式: &lt;input type=text name=<span style="color: #006080">"name"</span> <span style="color: #0000ff">value</span>=<span style="color: #006080">"GET 中文"</span>&gt;
   &lt;input type=submit&gt;
   &lt;/form&gt;
   
      &lt;form action=<span style="color: #006080">"action.jsp"</span> method=<span style="color: #006080">"POST"</span>&gt;
   POST 方式: &lt;input type=text name=<span style="color: #006080">"name"</span> <span style="color: #0000ff">value</span>=<span style="color: #006080">"POST 中文"</span>&gt;
   &lt;input type=submit&gt;
   &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre></div>
<p>和普通的表单没有任何区别.</p>
<p>然后就是表单提交页面 action.jsp:</p>
<div><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">&lt;%@ page language=<span style="color: #006080">"java"</span> pageEncoding=<span style="color: #006080">"GBK"</span>%&gt;
&lt;html&gt;
  &lt;body&gt;
   参数: &lt;%=request.getParameter(<span style="color: #006080">"name"</span>) %&gt; &lt;br&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre></div>
<p>接着是过滤器的配置文件 web.xml (用 2.5 版本也可以):</p>
<div><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #0000ff">&lt;?</span><span style="color: #800000">xml</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">="1.0"</span> <span style="color: #ff0000">encoding</span><span style="color: #0000ff">="UTF-8"</span>?<span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">web-app</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">="2.4"</span> 
    <span style="color: #ff0000">xmlns</span><span style="color: #0000ff">="http://java.sun.com/xml/ns/j2ee"</span> 
    <span style="color: #ff0000">xmlns:xsi</span><span style="color: #0000ff">="http://www.w3.org/2001/XMLSchema-instance"</span> 
    <span style="color: #ff0000">xsi:schemaLocation</span><span style="color: #0000ff">="http://java.sun.com/xml/ns/j2ee 
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">filter</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">filter-name</span><span style="color: #0000ff">&gt;</span>TomcatFormFilter<span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter-name</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">filter-class</span><span style="color: #0000ff">&gt;</span>filters.TomcatFormFilter<span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter-class</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter</span><span style="color: #0000ff">&gt;</span>
    
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">filter-mapping</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">filter-name</span><span style="color: #0000ff">&gt;</span>TomcatFormFilter<span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter-name</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">url-pattern</span><span style="color: #0000ff">&gt;</span>*.jsp<span style="color: #0000ff">&lt;/</span><span style="color: #800000">url-pattern</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">filter-mapping</span><span style="color: #0000ff">&gt;</span>
    
  <span style="color: #0000ff">&lt;</span><span style="color: #800000">welcome-file-list</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">welcome-file</span><span style="color: #0000ff">&gt;</span>index.jsp<span style="color: #0000ff">&lt;/</span><span style="color: #800000">welcome-file</span><span style="color: #0000ff">&gt;</span>
  <span style="color: #0000ff">&lt;/</span><span style="color: #800000">welcome-file-list</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">web-app</span><span style="color: #0000ff">&gt;</span></pre></div>
<p>最后最关键的就是我们的过滤器代码了, 对 GET 方式使用请求包装器, 而 POST 方式则用 setCharacterEncoding():</p>
<div><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">package filters;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletException;
import  javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletResponse;

<span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> TomcatFormFilter implements Filter {
    <span style="color: #008000">/**</span>
<span style="color: #008000">      * Request.java</span>
<span style="color: #008000">      * 对 HttpServletRequestWrapper 进行扩充, 不影响原来的功能并能提供所有的 HttpServletRequest</span>
<span style="color: #008000">      * 接口中的功能. 它可以统一的对 Tomcat 默认设置下的中文问题进行解决而只需要用新的 Request 对象替换页面中的</span>
<span style="color: #008000">      * request 对象即可.</span>
<span style="color: #008000">      */</span>

    <span style="color: #0000ff">class</span> Request extends HttpServletRequestWrapper
    {

        <span style="color: #0000ff">public</span> Request(HttpServletRequest request) {
            super(request);
        }

        <span style="color: #008000">/**</span>
<span style="color: #008000">         * 转换由表单读取的数据的内码.</span>
<span style="color: #008000">         * 从 ISO 字符转到 GBK.</span>
<span style="color: #008000">         */</span>
        <span style="color: #0000ff">public</span> String toChi(String input) {
            <span style="color: #0000ff">try</span> {
              <span style="color: #0000ff">byte</span>[] bytes = input.getBytes(<span style="color: #006080">"ISO8859-1"</span>);
              <span style="color: #0000ff">return</span> <span style="color: #0000ff">new</span> String(bytes, <span style="color: #006080">"GBK"</span>);
            }
            <span style="color: #0000ff">catch</span> (Exception ex) {
            }
            <span style="color: #0000ff">return</span> <span style="color: #0000ff">null</span>;
        }

        <span style="color: #008000">/**</span>
<span style="color: #008000">         * Return the HttpServletRequest holded by this object.</span>
<span style="color: #008000">         */</span>
        <span style="color: #0000ff">private</span> HttpServletRequest getHttpServletRequest()
        {
            <span style="color: #0000ff">return</span> (HttpServletRequest)super.getRequest();
        }

        <span style="color: #008000">/**</span>
<span style="color: #008000">         * 读取参数 -- 修正了中文问题.</span>
<span style="color: #008000">         */</span>
        <span style="color: #0000ff">public</span> String getParameter(String name)
        {
            <span style="color: #0000ff">return</span> toChi(getHttpServletRequest().getParameter(name));
        }

        <span style="color: #008000">/**</span>
<span style="color: #008000">         * 读取参数列表 - 修正了中文问题.</span>
<span style="color: #008000">         */</span>
        <span style="color: #0000ff">public</span> String[] getParameterValues(String name)
        {
              String values[] = getHttpServletRequest().getParameterValues(name);
              <span style="color: #0000ff">if</span> (values != <span style="color: #0000ff">null</span>) {
                <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; values.length; i++) {
                  values[i] = toChi(values[i]);
                }
              }
              <span style="color: #0000ff">return</span> values;
        }
    }
    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> destroy() {
        
    }

    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain) throws IOException, ServletException {
        HttpServletRequest httpreq = (HttpServletRequest)request;
        <span style="color: #0000ff">if</span>(httpreq.getMethod().equals(<span style="color: #006080">"POST"</span>)) {
            request.setCharacterEncoding(<span style="color: #006080">"GBK"</span>);
        } <span style="color: #0000ff">else</span> {
            request = <span style="color: #0000ff">new</span> Request(httpreq);
        }

        chain.doFilter(request, response);
    }

    <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> init(FilterConfig filterConfig) throws ServletException {
    }

}
</pre></div>
<p>怎么样, 是不是很简单也很方便呢?</p><img src ="http://www.blogjava.net/beansoft/aggbug/151368.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-10-09 13:29 <a href="http://www.blogjava.net/beansoft/archive/2007/10/09/151368.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Code Conventions for the JavaServer Pages Technology Version 1.x Language</title><link>http://www.blogjava.net/beansoft/archive/2007/09/22/147391.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Sat, 22 Sep 2007 05:37:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/09/22/147391.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/147391.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/09/22/147391.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/147391.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/147391.html</trackback:ping><description><![CDATA[<p>The source is here: <a href="http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/">http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/</a></p> <div class="pagetitle2">Article</div> <div class="pagetitle">Code Conventions for the JavaServer Pages Technology Version 1.x Language</div> <p><a name="skip2content"></a><em></em>&nbsp;  <div class="sitelinks">&nbsp; <a href="http://java.sun.com/jsp_utils/PrintPage.jsp" target="printFriendlyView"><img height="12" alt="Print-friendly Version" hspace="4" src="http://java.sun.com/im/ic_print.gif" width="14" border="0">Print-friendly Version</a><br></div><em>By <a href="http://java.sun.com/features/authors.html#fung">Kam Hay Fung</a>, Java Technology Consultant and <a href="http://java.sun.com/features/authors.html#roth">Mark Roth</a>, JavaServer Pages 2.0 Specification Co-Lead, February 2003 </em>&nbsp;  <div class="sitelinks"></div> <div class="contentdivider"><img height="4" alt=" " src="http://java.sun.com/im/a.gif" width="1" border="0"></div> <p><a href="http://java.sun.com/developer/technicalArticles/">Articles Index</a></p> <p>As JavaServer Pages (JSP) technology is becoming widely adopted in web-based applications, many JSP programmers and web developers embarking on developing and maintaining these applications face a dilemma like that of many Java programmers: "How do we structure JSP code that is easier to read, write and maintain consistently?" </p> <p>In this article, we propose a set of standard conventions for writing JSP pages (versions 1.1 and 1.2) that should be followed on a typical software project using web components. The article draws on the <a href="http://java.sun.com/docs/codeconv/" target="_blank">Code Conventions for the Java Programming Language</a> as a template to identify various important elements that should be addressed in a coding conventions specification (relevant to JSP technology). In particular, it addresses file names and organization, indentation, comments, directives, declarations, scriptlets, expressions, white space, naming conventions, and programming practices. As this is our first attempt at presenting a set of JSP coding conventions, we're quite interested in any feedback you may have on these recommendations. Please send all feedback to <a href="mailto:jsp-codeconv-comments@sun.com">jsp-codeconv-comments@sun.com</a>. </p> <p>The <a href="http://jcp.org/en/jsr/detail?id=152" target="_blank">JavaServer Pages 2.0 Specification</a>, while fully backwards compatible with version 1.2, allows for a script-free programming style (without declarations, scriptlets and expressions) and has a number of new features that are expected to evolve these conventions. Where possible, this article chooses conventions that will leverage the new JSP 2.0 technology features. </p> <p>Finally, we assume that you are familiar with JSP technology, Java technology and <a href="http://java.sun.com/blueprints/code/namingconventions.html" target="_blank">Java code conventions</a> as already adopted by your organization for your projects. If not, we recommend that you start with Java technology <a href="http://java.sun.com/index.jsp" target="_blank">here</a> and JSP technology <a href="http://java.sun.com/products/jsp/download.html" target="_blank">here</a>.<br><br></p>Why Have Code Conventions?  <p>Code conventions are important to programmers and web content developers for a number of reasons: </p> <ol> <li>They improve the readability of software artifacts  <li>They reduce training management and effort  <li>They leverage organizational commitment towards standardization </li></ol>File Names and Locations  <p>File naming gives tool vendors and web containers a way to determine file types and interpret them accordingly. The following table lists our recommended file suffixes and locations. </p><b>File Type</b> <b>File Suffix</b> <b>Recommended Location</b> JSP technology .jsp &lt;context root&gt;/&lt;subsystem path&gt;/ JSP fragment .jsp &lt;context root&gt;/&lt;subsystem path&gt;/ .jspf &lt;context root&gt;/WEB-INF/jspf/&lt;subsystem path&gt;/ cascading style sheet .css &lt;context root&gt;/css/ JavaScript technology .js &lt;context root&gt;/js/ HTML page .html &lt;context root&gt;/&lt;subsystem path&gt;/ web resource .gif, .jpg, etc. &lt;context root&gt;/images/ tag library descriptor .tld &lt;context root&gt;/WEB-INF/tld/  <p>There are a few things to keep in mind when reading the table above. First, &lt;context root&gt; is the root of the context of the web application (the root directory inside a .war file). Second, &lt;subsystem path&gt; is used to provide refined logical grouping of dynamic and static web page contents. For a small web application, this may be an empty string. </p> <p>Third, we use the term <i>JSP fragment</i> to refer to a JSP page that can be included in another JSP page. Note that in the JSP 2.0 Specification, the term "JSP segment" is used instead as the term "JSP fragment" is overloaded. JSP fragments can use either .jsp or .jspf as a suffix, and should be placed either in /WEB-INF/jspf or with the rest of the static content, respectively. JSP fragments that are not complete pages should always use the .jspf suffix and should always be placed in /WEB-INF/jspf. Fourth, though the JSP specification recommends both .jspf and .jsp as possible extensions for JSP fragments, we recommend .jspf as .jsf might be used by the <a href="http://java.sun.com/j2ee/javaserverfaces/" target="_blank">JavaServer Faces</a> specification. </p> <p>Finally, it is in general a good practice to place tag library descriptor files and any other non-public content under WEB-INF/ or a subdirectory underneath it. In this way, the content will be inaccessible and invisible to the clients as the web container will not serve any files underneath WEB-INF/. </p> <p>An optional welcome file's name, as declared in the welcome-file element of the deployment descriptor (web.xml), should be index.jsp if dynamic content will be produced, or index.html if the welcome page is static. </p> <p>When internationalizing JSP files, we recommend that you group JSP pages into directories by their locale. For example, the US English version of index.jsp would appear under /en_US/index.jsp whereas the Japanese version of the same file would appear under /ja_JP/index.jsp. The <a href="http://java.sun.com/docs/books/tutorial/i18n/locale/create.html" target="_blank">Java Tutorial</a> provides additional information about internationalizing Java code in general, and the book <a href="http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/index.html" target="_blank">Designing Enterprise Applications with the J2EE Platform</a> provides information about internationalization for web applications. </p>File Organization  <p>A well-structured source code file is not only easier to read, but also makes it quicker to locate information within the file. In this section, we'll introduce the structures for both JSP and tag library descriptor files. </p><a name="jsp_file_fragment_file"></a>JSP File / JSP Fragment File  <p>A JSP file consists of the following sections in the order they are listed: </p> <ol> <li>Opening comments  <li>JSP page directive(s)  <li>Optional tag library directive(s)  <li>Optional JSP declaration(s)  <li>HTML and JSP code </li></ol><a name="openning_comments"></a>Opening Comments  <p>A JSP file or fragment file begins with a server side style comment: </p>&lt;%-- - Author(s): - Date: - Copyright Notice: - @(#) - Description: --%&gt; <br> <p>This comment is visible only on the server side because it is removed during JSP page translation. Within this comment are the author(s), the date, and the copyright notice of the revision, an identifier and a description about the JSP page for web developers. The combination of characters "@(#)" is recognized by certain programs as indicating the start of an identifier. While such programs are seldom used, the use of this string does no harm. In addition, this combination is sometimes appended by "$Id$" for the identification information to be automatically inserted into the JSP page by some version control programs. The Description part provides concise information about the purpose of the JSP page. It does not span more than one paragraph. </p> <p>In some situations, the opening comments need to be retained during translation and propagated to the client side (visible to a browser) for authenticity and legal purposes. This can be achieved by splitting the comment block into two parts; first, the client-side style comment: </p>&lt;!-- - Author(s): - Date: - Copyright Notice: --&gt; <br> <p>and then a shorter server side style comment: </p>&lt;%-- - @(#) - Description: --%&gt; JSP Page Directive(s)  <p>A JSP page directive defines attributes associated with the JSP page at translation time. The JSP specification does not impose a constraint on how many JSP page directives can be defined in the same page. So the following two Code Samples are equivalent (except that the first example introduces two extra blank lines in the output): </p> <p><b>Code Sample 1:</b> </p>&lt;%@ page session="false" %&gt; &lt;%@ page import="java.util.*" %&gt; &lt;%@ page errorPage="/common/errorPage.jsp" %&gt;  <p>If the length of any directive, such as a page directive, exceeds the normal width of a JSP page (80 characters), the directive is broken into multiple lines: </p> <p><b>Code Sample 2:</b> </p>&lt;%@ page session="false" import="java.util.*" errorPage="/common/errorPage.jsp" %&gt;  <p>In general, Code Sample 2 is the preferred choice for defining the page directive over Code Sample 1. An exception occurs when multiple Java packages need to be imported into the JSP pages, leading to a very long import attribute: </p>&lt;%@ page session="false" import="java.util.*,java.text.*, com.mycorp.myapp.taglib.*, com.mycorp.myapp.sql.*, ..." ... %&gt; <br> <p>In this scenario, breaking up this page directive like the following is preferred: </p>&lt;%-- all attributes except import ones --%&gt; &lt;%@ page ... %&gt; &lt;%-- import attributes start here --%&gt; &lt;%@ page import="java.util.*" %&gt; &lt;%@ page import="java.text.*" %&gt; ... <br> <p>Note that in general the import statements follow the local code conventions for Java technology. For instance, it may generally be accepted that when up to three classes from the same package are used, import should declare specific individual classes, rather than their package. Beyond three classes, it is up to a web developer to decide whether to list those classes individually or to use the ".*" notation. In the former case, it makes life easier to identify an external class, especially when you try to locate a buggy class or understand how the JSP page interacts with Java code. For instance, without the knowledge of the imported Java packages as shown below, a web developer will have to search through all these packages in order to locate a Customer class: </p>&lt;%@ page import="com.mycorp.bank.savings.*" %&gt; &lt;%@ page import="com.thirdpartycorp.cashmanagement.*" %&gt; &lt;%@ page import="com.mycorp.bank.foreignexchange.*" %&gt; ...  <p>In the latter case, the written JSP page is neater but it is harder to locate classes. In general, if a JSP page has too many import directives, it is likely to contain too much Java code. A better choice would be to use more JSP tags (discussed later in this article). </p>Optional Tag Library Directive(s)  <p>A tag library directive declares custom tag libraries used by the JSP page. A short directive is declared in a single line. Multiple tag library directives are stacked together in the same location within the JSP page's body: </p>&lt;%@ taglib uri="URI1" prefix="tagPrefix1" %&gt; &lt;%@ taglib uri="URI2" prefix="tagPrefix2" %&gt; ...  <p>Just as with the page directive, if the length of a tag library directive exceeds the normal width of a JSP page (80 characters), the directive is broken into multiple lines: </p>&lt;%@ taglib uri="URI2" prefix="tagPrefix2" %&gt;  <p>Only tag libraries that are being used in a page should be imported. </p> <p>From JSP 1.2 Specification, it is highly recommended that the <a href="http://java.sun.com/products/jsp/jstl/index.jsp" target="_blank">JSP Standard Tag Library</a> (JSTL) be used in your web application to help reduce the need for JSP scriptlets in your pages. Pages that use JSTL are, in general, easier to read and maintain. </p>Optional JSP Declaration(s)  <p>JSP declarations declare methods and variables owned by a JSP page. These methods and variables are no different from declarations in the Java programming language, and therefore the relevant code conventions should be followed. Declarations are preferred to be contained in a single &lt;%! ... %&gt; JSP declaration block, to centralize declarations within one area of the JSP page's body. Here is an example: </p><b>Disparate declaration blocks</b> <b>Preferred declaration block</b> &lt;%! private int hitCount; %&gt; &lt;%! private Date today; %&gt; ... &lt;%! public int getHitCount() { return hitCount; } %&gt; <br>&lt;%! private int hitCount; private Date today; public int getHitCount() { return hitCount; } %&gt; <br>HTML and JSP Code  <p>This section of a JSP page holds the HTML body of the JSP page and the JSP code, such JSP expressions, scriptlets, and JavaBeans instructions. </p>Tag Library Descriptor  <p>A tag library descriptor (TLD) file must begin with a proper XML declaration and the correct DTD statement. For example, a JSP 1.2 TLD file must begin with: </p>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt; &lt;!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"&gt;  <p>This is immediately followed by a server-side style comment that lists the author(s), the date, the copyright, the identification information, and a short description about the library: </p>&lt;!-- - Author(s): - Date: - Copyright Notice: - @(#) - Description: --&gt; <br> <p>The rules and guidelines regarding the use of these elements are the same for those defined for JSP files/fragment files. </p> <p>The rest of the file consists of the following, in the order they appear below: </p> <ul> <li>Optional declaration of one tag library validator  <li>Optional declaration of event listeners  <li>Declaration of one or more available tags </li></ul> <p>It is recommended that you always add the following optional sub-elements for the elements in a TLD file. These sub-elements provide placeholders for tag designers to document the behavior and additional information of a TLD file, and disclose them to web component developers. </p><b>TLD Element</b> <b>JSP 1.2 Recommended<br>Sub-element</b> <b>JSP 1.1 Recommended<br>Sub-element</b> attribute (JSP 1.2) description &nbsp; init-param (JSP 1.2) description &nbsp; tag display-name, description, example name, info taglib uri, display-name, description uri, info validator (JSP 1.2) description &nbsp; variable (JSP 1.2) description &nbsp; Indentation  <p>Indentations should be filled with space characters. Tab characters cause different interpretation in the spacing of characters in different editors and should not be used for indentation inside a JSP page. Unless restricted by particular integrated development environment (IDE) tools, a unit of indentation corresponds to 4 space characters. Here is an example: </p>&lt;myTagLib:forEach var="client" items="${clients}"&gt; &lt;myTagLib:mail value="${client}" /&gt; &lt;/myTagLib:forEach&gt;  <p>A continuation indentation aligns subsequent lines of a block with an appropriate point in the previous line. The continuation indentation is in multiple units of the normal indentation (multiple lots of 4 space characters): </p>&lt;%@ page attribute1="value1" attribute2="value2" ... attributeN="valueN" %&gt; <br>Indentation of Scripting Elements  <p>When a JSP scripting element (such as declaration, scriptlet, expression) does not fit on a single line, the adopted indentation conventions of the scripting language apply to the body of the element. The body begins from the same line for the opening symbol of the element &lt;%=, and from a new line for the opening symbol &lt;%=. The body is then terminated by an enclosing symbol of the element (%&gt;) on a separate line. For example: </p>&lt;%= (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=Calendar.SUNDAY) ? &nbsp;&nbsp;&nbsp;&nbsp;"Sleep in" : &nbsp;&nbsp;&nbsp;&nbsp;"Go to work" %&gt; <br> <p>The lines within the body not containing the opening and the enclosing symbols are preceded with one unit of normal indentation (shown as &nbsp; in the previous example) to make the body distinctively identifiable from the rest of the JSP page. </p>Compound Indentation with JSP, HTML and Java  <p>Compound indentation, for JSP elements intermingled with Java scripting code and template text (HTML), is necessary to reduce the effort of comprehending a JSP source file. This is because the conventional normal indentation might make seeing the JSP source file difficult. As a general rule, apply an extra unit of normal indentation to every element introduced within another one. Note that this alters the indentations of the final output produced for the client side to render for display. The additional indentations, however, are usually ignored (by the browser) and have no effect on the rendered output on the browser. For instance, adding more space characters before a &lt;TABLE&gt; tag does not change the position of a table. So, applying this convention for indentation makes this looks nicer: </p>&lt;table&gt; &lt;% if ( tableHeaderRequired ) { %&gt; &lt;tr&gt; &lt;th&gt;Last Name&lt;/th&gt; &lt;th&gt;First Name&lt;/th&gt; &lt;/tr&gt; &lt;% } %&gt; &lt;c:forEach var="customer" items="${customers}"&gt; &lt;tr&gt; &lt;td&gt;&lt;c:out value="${customer.lastName}"/&gt;&lt;/td&gt; &lt;td&gt;&lt;c:out value="${customer.firstName}"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;/table&gt; <br> <p>than this:</p>&lt;table&gt; &lt;% if ( tableHeaderRequired ) { %&gt; &lt;tr&gt; &lt;th&gt;Last Name&lt;/th&gt; &lt;th&gt;First Name&lt;/th&gt; &lt;/tr&gt; &lt;% } %&gt; &lt;c:forEach var="customer" items="${customers}"&gt; &lt;tr&gt; &lt;td&gt;&lt;c:out value="${customer.lastName}"/&gt;&lt;/td&gt; &lt;td&gt;&lt;c:out value="${customer.firstName}"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;/table&gt; <br>Comments  <p>Comments are used sparingly to describe additional information or purposes of the surrounding code. Here we look at two types for JSP files: JSP and client-side comments. </p>JSP Comments  <p>JSP comments (also called server-side comments) are visible only on the server side (that is, not propagated to the client side). Pure JSP comments are preferred over JSP comments with scripting language comments, as the former is less dependent on the underlying scripting language, and will be easier to evolve into JSP 2.0-style pages. The following table illustrates this: </p><b>Line</b> <b>JSP scriptlet with scripting language comment</b> <b>Pure JSP comment</b> single &lt;% /** ... */ %&gt; &lt;% /* ... */ %&gt; &lt;% // ... %&gt; &lt;%-- ... --%&gt; multiple &lt;% /* * ... * */ %&gt; <br>&lt;%-- - ... - -- %&gt; <br>&lt;% // // ... // %&gt; <br>Client-Side Comments  <p>Client-side comments (&lt;!-- ... --&gt;) can be used to annotate the responses sent to the client with additional information about the responses. They should not contain information about the behavior and internal structure of the server application or the code to generate the responses. </p> <p>The use of client-side comments is generally discouraged, as a client / user does not need or read these kinds of comments directly in order to interpret the received responses. An exception is for authenticity and legality purposes such as the identification and copyright information as described above. Another exception is for HTML authors to use a small amount of HTML comments to embody the guidelines of the HTML document structures. For example: </p>&lt;!-- toolbar section --&gt; ... &lt;!-- left-hand side navigation bar --&gt; ... &lt;!-- main body --&gt; ... &lt;!-- footer --&gt; ... <br>Multiline Comment Block  <p>A multiline comment block, be it JSP or client-side, is decorated with the dash character "-". In the XML specification, the double-dash string "--" is not allowed within an XML comment block. Thus, for compatibility and consistency with this specification, no double-dash string is used to decorate comment lines within a multiline comment block. The following table illustrates this preference using a client-side comment block: </p><b>Preferred</b> <b>Non-XML compliant</b> &lt;!-- - line 1 - line 2 ... --&gt; <br>&lt;!-- -- line 1 -- line 2 ... --&gt; <br>JSP Declarations  <p>As per the Java code convention, declarations of variables of the same types should be on separate lines: </p><b>Not recommended</b> <b>Recommended</b> &lt;%! private int x, y; %&gt; &lt;%! private int x; %&gt; &lt;%! private int y; %&gt;  <p>JavaBeans components should not be declared and instantiated using JSP declarations but instead should use the &lt;jsp:useBean&gt; action tag. </p> <p>In general, JSP declarations for variables are discouraged as they lead to the use of the scripting language to weave business logic and Java code into a JSP page which is designed for presentation purposes, and because of the overhead of managing the scope of the variables. </p>JSP Scriptlets  <p>Where possible, avoid JSP scriptlets whenever tag libraries provide equivalent functionality. This makes pages easier to read and maintain, helps to separate business logic from presentation logic, and will make your pages easier to evolve into JSP 2.0-style pages (JSP 2.0 Specification supports but deemphasizes the use of scriptlets). In the following examples, for each data type representation of the customers, a different scriptlet must be written: </p> <p>customers as an array of Customers </p>&lt;table&gt; &lt;% for ( int i=0; i&lt;customers.length; i++ ) { %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= customers[i].getLastName() %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= customers[i].getFirstName() %&gt;&lt;/td&gt; &lt;/tr&gt; &lt;% } %&gt; &lt;/table&gt; <br> <p>customers as an Enumeration </p>&lt;table&gt; &lt;% for ( Enumeration e = customers.elements(); e.hasMoreElements(); ) { Customer customer = (Customer)e.nextElement(); %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= customer.getLastName() %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= customer.getFirstName() %&gt;&lt;/td&gt; &lt;/tr&gt; &lt;% } %&gt; &lt;/table&gt; <br> <p>However, if a common tag library is used, there is a higher flexibility in using different types of customers. For instance, in the JSP Standard Tag Library, the following segment of JSP code will support both array and Enumeration representations of customers: </p>&lt;table&gt; &lt;c:forEach var="customer" items="${customers}"&gt; &lt;tr&gt; &lt;td&gt;&lt;c:out value="${customer.lastName}"/&gt;&lt;/td&gt; &lt;td&gt;&lt;c:out value="${customer.firstName}"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/c:forEach&gt; &lt;/table&gt; <br> <p>In the spirit of adopting the model-view-controller (MVC) design pattern to reduce coupling between the presentation tier from the business logic, JSP scriptlets should not be used for writing business logic. Rather, JSP scriptlets are used if necessary to transform data (also called "value objects") returned from processing the client's requests into a proper client-ready format. Even then, this would be better done with a front controller servlet or a custom tag. For example, the following code fetches the names of customers from the database directly and displays them to a client: </p>&lt;% // NOT RECOMMENDED TO BE DONE AS A SCRIPTLET! Connection conn = null; try { // Get connection InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("customerDS"); conn = ds.getConnection(); // Get customer names Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT name FROM customer"); // Display names while ( rs.next() ) { out.println( rs.getString("name") + "&lt;br&gt;"); } } catch (SQLException e) { out.println("Could not retrieve customer names:" + e); } finally { if ( conn != null ) conn.close(); } %&gt; <br> <p>The following segment of JSP code is better as it delegates the interaction with the database to the custom tag myTags:dataSource which encapsulates and hides the dependency of the database code in its implementation: </p>&lt;myTags:dataSource name="customerDS" table="customer" columns="name" var="result" /&gt; &lt;c:forEach var="row" items="${result.rows}"&gt; &lt;c:out value="${row.name}" /&gt; &lt;br /&gt; &lt;/c:forEach&gt; <br> <p>result is a scripting variable introduced by the custom tag myTags:dataSource to hold the result of retrieving the names of the customers from the customer database. The JSP code can also be enhanced to generate different kinds of outputs (HTML, XML, WML) based on client needs dynamically, without impacting the backend code (for the dataSource tag). A better option is to delegate this to a front controller servlet which performs the data retrieval and provide the results to the JSP page through a request-scoped attribute. See the Enterprise section of Java BluePrints for an example. </p> <p>In summary:</p> <ul> <li>JSP scriptlets should ideally be non-existent in the JSP page so that the JSP page is independent of the scripting language, and business logic implementation within the JSP page is avoided.  <li>If not possible, use value objects (JavaBeans components) for carrying information to and from the server side, and use JSP scriptlets for transforming value objects to client outputs.  <li>Use custom tags (tag handlers) whenever available for processing information on the server side. </li></ul>JSP Expressions  <p>JSP Expressions should be used just as sparingly as JSP Scriptlets. To illustrate this, let's look as the following three examples which accomplish equivalent tasks: </p> <p>Example 1 (with explicit Java code): </p>&lt;%= myBean.getName() %&gt;  <p>Example 2 (with JSP tag):</p>&lt;jsp:getProperty name="myBean" property="name" /&gt;  <p>Example 3 (with JSTL tag):</p>&lt;c:out value="${myBean.name}" /&gt;  <p>Example 1 assumes that a scripting variable called myBean is declared. The other two examples assume that myBean is a scoped attribute that can be found using PageContext.findAttribute(). The second example also assumes that myBean was introduced to the page using &lt;jsp:useBean&gt;. </p> <p>Of the three examples, the JSTL tag example is preferred. It is almost as short as the JSP expression, it is just as easy to read and easier to maintain, and it does not rely on Java scriptlets (which would require the web developer to be familiar with the language and the API calls). Furthermore, it makes the page easier to evolve into JSP 2.0-style programming, where the equivalent can be accomplished by simply typing ${myBean.name} in template text. Whichever choice is adopted, it should be agreed on amongst web developers and consistent across all produced JSP pages in the same project. &nbsp;It should be noted that the JSTL example is actually slightly different in that it gets the value of myBean from the page context instead of from a local Java scripting variable. </p> <p>Finally, JSP expressions have preference over equivalent JSP scriptlets which rely on the syntax of the underlying scripting language. For instance, </p>&lt;%= x %&gt;  <p>is preferred over </p>&lt;% out.print( x ); %&gt; White Space  <p>White space further enhances indentation by beautifying the JSP code to reduce comprehension and maintenance effort. In particular, blank lines and spaces should be inserted at various locations in a JSP file where necessary. </p>Blank Lines  <p>Blank lines are used sparingly to improve the legibility of &lt;strike&gt;the&lt;/strike&gt;a JSP page, provided that they do not produce unwanted effects on the outputs. For the example below, a blank line inserted between two JSP expressions inside an HTML &lt;PRE&gt; block call causes an extra line inserted in the HTML output to be visible in the client's browser. However, if the blank line is not inside a &lt;PRE&gt; block, the effect is not visible in the browser's output. </p><b>JSP statements</b> <b>HTML output to client</b> &lt;pre&gt; &lt;%= customer.getFirstName() %&gt; &lt;%= customer.getLastName() %&gt; &lt;/pre&gt; Joe Block &lt;pre&gt; &lt;%= customer.getFirstName() %&gt; &lt;%= customer.getLastName() %&gt; &lt;/pre&gt; <br>Joe Block &lt;%= customer.getFirstName() %&gt; &lt;%= customer.getLastName() %&gt; Joe Block Blank Spaces  <p>A white space character (shown as &nbsp;) should be inserted between a JSP tag and its body. For instance, the following </p>&lt;%=&nbsp;customer.getName()&nbsp;%&gt;  <p>is preferred over </p>&lt;%=customer.getName()%&gt;  <p>There should also be space characters separating JSP comment tags and comments: </p>&lt;%-- -&nbsp;a multi-line comment broken into pieces, each of which -&nbsp;occupying a single line. --%&gt; &lt;%--&nbsp;a short comment&nbsp;--%&gt; <br>Naming Conventions  <p>Applying naming conventions makes your web component elements easier to identify, classify and coordinate in projects. In this section, we will look at these conventions specific to JSP technology. </p>JSP Names  <p>A JSP (file) name should always begin with a lower-case letter. The name may consist of multiple words, in which case the words are placed immediately adjacent and each word commences with an upper-case letter. A JSP name can be just a simple noun or a short sentence. A verb-only JSP name should be avoided, as it does not convey sufficient information to developers. For example: </p>perform.jsp  <p>is not as clear as </p>performLogin.jsp  <p>In the case of a verb being part of a JSP name, the present tense form should be used, since an action by way of backend processing is implied: </p>showAccountDetails.jsp  <p>is preferred over </p>showingAccountDetails.jsp Tag Names  <p>The naming conventions for tag handlers and associated classes are shown below: </p><b>Description</b> <b>Class Name</b> XXX tag extra info (extending from javax.servlet.jsp.tagext.TagExtraInfo) XXXTEI XXX tag library validator (extending from javax.servlet.jsp.tagext.TagLibraryValidator) XXXTLV XXX tag handler interface (extending from javax.servlet.jsp.tagext.Tag/IterationTag/BodyTag) XXXTag XXX tag handler implementation XXXTag  <p>In addition, tag names must not violate the naming conventions of class and interface as specified in the relevant code convention for Java technology. </p> <p>To further distinguish a tag-relevant class from other classes, a package suffix, tags, or taglib can be applied to the package name of the class. For example: </p>com.mycorp.myapp.tags.XXXTag Tag Prefix Names  <p>A tag prefix should be a short yet meaningful noun in title case, and the first character in lower-case. A tag prefix should not contain non-alphabetic characters. Here are some examples: </p><b>Example</b> <b>OK?</b> mytaglib no myTagLib yes MyTagLib no MyTagLib1 no My_Tag_Lib no My$Tag$Lib no JSP Pages in XML Syntax  <p>JSP provides two distinct syntaxes: a "standard syntax" for writing JSP pages and an "XML syntax" for writing JSP pages as an XML document. JSP pages that are written using the standard syntax are referred to as "JSP pages." JSP pages that are written using the XML syntax are referred to as "JSP documents". This article primarily addresses JSP pages, but many of the concepts can be applied to JSP documents as well. Use of JSP documents is expected to increase as XML becomes more prevalent, and to address this the JSP 2.0 specification will introduce a much friendlier XML syntax. </p> <p>It should be noted that the XML <i>syntax</i> used to author JSP pages is distinct from and is often confused with the XML <i>view</i> of a JSP page. The page author uses either the standard or the XML <i>syntax</i> to author a JSP page. The container then translates the JSP page into its XML <i>view</i>, which is exposed to Tag Library Validators. </p>JSP Document Structure  <p>JSP documents have the following basic structure: </p>&lt;? xml version="1.0" ?&gt; &lt;!-- - Author(s): - Date: - Copyright Notice: - @(#) - Description: --&gt; &lt;jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:prefix1="URI-for-taglib1" xmlns:prefix2="URI-for-taglib2" version="1.2"&gt; JSP Document ... &lt;/jsp:root&gt; <br> <p>The first line is an optional XML Prolog that defines the page as an XML document. After the optional prolog comes the comments for the document. The element &lt;jsp:root&gt; defines this as a JSP document and must appear as the root element. The jsp namespace must be imported, and all tag libraries must be imported using this root element. The version attribute is required and specifies which version of JSP Specification is being used. The actual content of the JSP document appears as subelements of the &lt;jsp:root&gt; element. Standard XML indentation rules should be applied consistently across the document, using 4 spaces as a single indentation unit. </p> <p>A JSP document must be a well-formed XML document, so some elements, such as &lt;% %&gt; must be replaced by their XML equivalent, such as &lt;jsp:scriptlet /&gt;. See the JSP Specification for details. </p>XML Comments  <p>The JSP Specification is unclear about whether XML-style comments are stripped on output, so to be safe if a comment is intended to reach the client, it should be enclosed in a &lt;jsp:text&gt; node, as follows: </p>... &lt;jsp:text&gt;&lt;![CDATA[ &lt;!-- - Multiline comment - to be sent to client. --&gt; ]]&gt;&lt;/jsp:text&gt; ... <br>Java Code in JSP Documents  <p>When writing Java code inside declarations, scriptlets, and expressions, a CDATA element should be used only when necessary to ensure your code does not break the document structure. </p>... &lt;jsp:scriptlet&gt; for( int level = 0; level &amp;lt; 3; level++ ) { &lt;/jsp:scriptlet&gt; &lt;tr&gt; &lt;td&gt; &lt;jsp:expression&gt;&lt;![CDATA[ "&lt;h" + level + "&gt;Text&lt;/h" + level + "&gt;" ]]&gt;&lt;/jsp:expression&gt; &lt;/td&gt; &lt;/tr&gt; &lt;jsp:scriptlet&gt; } &lt;/jsp:scriptlet&gt; ... <br> <p>Unlike those in the standard syntax, XML indentation rules should be followed regardless of the contents of an element. </p>Programming Practices  <p>In general, avoid writing Java code (declarations, scriptlets and expressions) in your JSP pages, for the following reasons: </p> <ul> <li>Syntax errors in Java code in a JSP page are not detected until the page is deployed. Syntax errors in tag libraries and servlets, on the other hand, are detected prior to deployment.  <li>Java code in JSP pages is harder to debug.  <li>Java code in JSP pages is harder to maintain, especially for page authors who may not be Java experts.  <li>It is generally accepted practice not to mix complex business logic with presentation logic. JSP pages are primarily intended for presentation logic.  <li>Code containing Java code, HTML and other scripting instructions can be hard to read.  <li>The JSP 2.0 Specification is deemphasizing scriptlets in favor of a much simpler expression language. It will be easier to evolve your JSP pages to JSP 2.0-style programming if Java code is not used in your pages. </li></ul> <p>See the Enterprise section of Java BluePrints for more guidelines and details. </p>JavaBeans Component Initialization  <p>JSP technology provides a convenient element to initialize all PropertyDescriptor-identified properties of a JavaBeans component. For instance: </p>&lt;jsp:setProperty name="bankClient" property="*"/&gt;  <p>However, this should be used with caution. First, if the bean has a property, say, amount, and there is no such parameter (amount) in the current ServletRequest object or the parameter value is "", nothing is done: the JSP&nbsp;page does not even use null to set that particular property of the bean. So, whatever value is already assigned to amount in the bankClient bean is unaffected. Second, non-elementary properties that do not have PropertyEditors defined may not be implicitly initialized from a String value of the ServletRequest object and explicit conversion may be needed. Third, malicious users can add additional request parameters and set unintended properties of the bean, if the application is not carefully designed. </p> <p>If you still prefer to use property="*" in the jsp:setProperty tag for the purpose of producing neater code, then we recommend that you add a comment preceding the jsp:setProperty tag about parameters expected to be present in the ServletRequest object to initialize the bean. So, in the following example, from the comment we know that both firstName and lastName are required to initialize the bankClient bean: </p>&lt;%-- - requires firstName and lastName from the ServletRequest --%&gt; &lt;jsp:setProperty name="bankClient" property="*" /&gt; JSP Implicit Objects  <p>Direct use of JSP implicit objects to gain references to these objects rather than API calls is preferred. So, instead of using </p>getServletConfig().getServletContext().getInitParameter("param")  <p>to access the initialization parameter as provided by the ServletContext instance, one can make use of the readily available implicit object: </p>application.getInitParameter("param")  <p>In the case that only the value of an initialization parameter is outputted, it would be even better to use a JSTL tag to access the initialization parameter: </p>&lt;c:out value="${initParam['param']}" /&gt; Quoting  <p>The uniform use of quoting is adopted. Quotations should be bound by two double-quote characters " instead of two apostrophe characters ' . </p><b>Non-uniform quoting</b> <b>Preferred quoting</b> &lt;%@ page import=<b>'</b>javabeans.*<b>'</b>%&gt;<br>&lt;%@ page import="java.util.*" %&gt;<br>&lt;%@ page import="javabeans.*" %&gt;<br>&lt;%@ page import="java.util.*" %&gt;<br> <p>An exception is when apostrophes are needed, for example when double-quote characters are required within the scripting language: </p>&lt;jsp:include page='&lt;%= getFoodMenuBar("Monday") %&gt;' /&gt; Using Custom Tags  <p>If a custom tag does not have a body content, the content should be declared explicitly with empty (rather than defaulting to the word "JSP") like this in the tag library descriptor: </p>&lt;tag&gt; &lt;name&gt;hello&lt;/name&gt; &lt;tag-class&gt;com.mycorp.util.taglib.HelloTagSupport&lt;/tag-class&gt; &lt;body-content&gt;empty&lt;/body-content&gt; ... &lt;/tag&gt; <br> <p>This tells the JSP container that the body content must be empty rather than containing any JSP syntax to be parsed. The effect is to eliminate unnecessarily allocation of resources for parsing of empty body contents. </p> <p>Empty tags should be in short XML elements, rather than using opening-closing XML element pairs to improve readability. So, </p>&lt;myTag:hello /&gt;  <p>is preferred over </p>&lt;myTag:hello&gt;&lt;/myTag:hello&gt; Use of TagExtraInfo and TagLibraryValidator  <p>Sometimes, the valid ways to use a tag library cannot be expressed using the TLD alone. Then, a TagExtraInfo class or a TagLibraryValidator class should be written and registered in the TLD so that errors in tag library can be caught at translation time. </p>Use of JavaScript Technology  <p>JavaScript technology should be independent of particular features of browser types in order for the scripts to run properly. </p> <p>Where it makes sense, it is a good idea to keep JavaScript code in individual files separate from JSP bodies, and use a statement like the following to import the JavaScript code into the JSP bodies: </p>&lt;script language=javascript src="/js/main.js"&gt;  <p>This improves the chance for the JavaScript code to be reused, maintains the consistent behavior of the JavaScript code across multiple JSP pages, and reduces the complexity of JSP pages. </p>Cascading Style Sheets  <p>Use cascading style sheets to centralize control of common characteristics of headings, tables, and so on. This improves the consistency of presentation to the users and reduces maintenance effort and the code size of the JSP pages. So, instead of embedding the style information in the HTML tags like the one below: </p>&lt;H1&gt;&lt;FONT color="blue"&gt;Chapter 1&lt;/FONT&gt;&lt;/H1&gt; ... &lt;H1&gt;&lt;FONT color="blue"&gt;Chapter 2&lt;/FONT&gt;&lt;/H1&gt; ...  <p>Define the style information in a single style sheet myJspStyle.css which contains: </p>H1 { color: blue }<br> <p>And apply the style sheet to the JSP page: </p>&lt;link rel="stylesheet" href="css/myJspStyle.css" type="text/css"&gt; ... &lt;H1&gt;Chapter 1&lt;/H1&gt; ... &lt;H1&gt;Chapter 2&lt;/H1&gt; ... <br>Use of Composite View Patterns  <p>When a JSP page requires a certain and complex structure which may also repeat in other JSP pages, one way to handle this is to break it up into pieces, using the Composite View pattern (the Patterns section of Java Blueprints). For instance, a JSP page sometimes has the following logical layout in its presentation structure: </p>header menu bar main body footnote footer  <p>In this manner, this composite JSP page can be divided into different modules, each realized as a separate JSP fragment. Constituent JSP fragments can then be placed in appropriate locations in the composite JSP page, using translation-time or request-time include JSP tags. In general, when static include directives are used to include a page that would not be requested by itself, remember to use the .jspf extension and place the file in the /WEB-INF/jspf/ directory of the Web application archive (war). For example: </p>&lt;%@ include file="/WEB-INF/jspf/header.jspf" %&gt; ... &lt;%@ include file="/WEB-INF/jspf/menuBar.jspf" %&gt; ... &lt;jsp:include page="&lt;%= currentBody %&gt;" /&gt; ... &lt;%@ include file="/WEB-INF/jspf/footnote.jspf" %&gt; ... &lt;%@ include file="/WEB-INF/jspf/footer.jspf" %&gt; ... <br>Other Recommendations  <p>In this article, we presented a set of recommended code conventions to produce JSP code and web component artifacts that are more maintainable and consistent. There are many other best practices if you choose to pursue this subject further. For instance, the JSP 1.2 specification has recommendations for: </p> <ul> <li>Defining New Implicit Objects  <li>Accessing Vendor-Specific information  <li>Customizing a Tag Library </li></ul> <p>In addition, Java BluePrints offers best practices on a broader scale, such as the use of Model-View-Controller pattern (found in the Patterns section). </p> <p>We're interested in your input on the conventions presented in this article and we'd like you to share what other recommendations you might have for JSP coding conventions. Please send your feedback to <a href="mailto:jsp-codeconv-comments@sun.com">jsp-codeconv-comments@sun.com</a>. </p> <p>Below, we present the source code to a full web application that demonstrates the code conventions presented above. You can download the a WAR file for this application <a href="http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/licensed-codeconv-final.war">here</a>. </p>Code Examples  <p>An example web application is presented here to demonstrate the conventions as outlined in this document. It consists of the following source code files and directory structures bundled in a .war file: </p>/index.jsp /WEB-INF/classes/codeconv/GetResultsTag.class /WEB-INF/jspf/footer.jspf /WEB-INF/lib/jstl.jar /WEB-INF/lib/standard.jar /WEB-INF/tld/lotterylib.tld /WEB-INF/web.xml <br> <p>The index.jsp page uses a custom tag library (as identified by lotterylib.tld) to look up fake lottery results for every day of the current month, up to and including the current day. Then, it uses JSTL to do text formatting and looping to produce the results in HTML. </p> <p>The example requires JSP 1.2 and JSTL 1.0 technologies. </p> <ul> <li><a href="http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/source_index.txt" target="_blank">Source Listing for /index.jsp</a>  <li><a href="http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/source_getresults.java" target="_blank">Source Listing for /WEB-INF/classes/codeconv/GetResultsTag.java</a>  <li><a href="http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/source_footer.txt" target="_blank">Source Listing for /WEB-INF/jspf/footer.jspf</a>  <li><a href="http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/source_lotterylib.html" target="_blank">Source Listing for /WEB-INF/tld/lotterylib.tld</a>  <li><a href="http://java.sun.com/developer/technicalArticles/javaserverpages/code_convention/source_web.html" target="_blank">Source Listing for /WEB-INF/web.xml</a> </li></ul>Acknowledgments  <p>Acknowledgments are given to Gregory Murray (Java BluePrints Team), Damian Fauth (Sun Java Center) and Kate Morris (Sun Java Center) who provided invaluable comments on earlier drafts of this document. </p>References  <ol> <li><a name="1"></a><a href="http://java.sun.com/docs/codeconv/" target="_blank">Code Conventions for the Java Programming Language</a>.  <li><a name="2"></a><a href="http://www.javaworld.com/javaworld/jw-11-2001/jw-1130-jsp.html" target="_blank">JSP best practices</a>.  <li><a name="3"></a><a href="http://java.oreilly.com/news/jsptips_1100.html" target="_blank">Hans's Top Ten JSP Tips</a>.  <li><a name="4"></a><a href="http://java.sun.com/products/jsp/download.html" target="_blank">JavaServer Pages Specification version 1.2</a>.  <li><a name="5"></a><a href="http://java.sun.com/blueprints/corej2eepatterns/" target="_blank">Alur D., Crupi J., Malks D., <i>Core J2EE Patterns: Best Practices and Design Strategies</i></a>, Sun Microsystems Press, Prentice Hall Inc., 2001.  <li><a name="6"></a><a href="http://java.sun.com/blueprints/code/namingconventions.html" target="_blank">Naming Conventions for Enterprise Applications</a>.  <li><a name="7"></a><a href="http://java.sun.com/products/jsp/jstl/index.jsp" target="_blank">JavaServer Pages Standard Tag Library</a>.  <li><a name="8"></a><a href="http://java.sun.com/blueprints/patterns/references.html" target="_blank">Gamma E., Helm R., Johnson R., Vlissides J., <i>Design Patterns: Elements of Reusable Software</i></a>, Addison-Wesley, 1995.  <li><a name="9"></a><a href="http://java.sun.com/j2ee/javaserverfaces/" target="_blank">JavaServer Faces Technology</a>.  <li><a name="10"></a><a href="http://java.sun.com/reference/blueprints/" target="_blank">Java BluePrints</a>.  <li><a name="11"></a><a href="http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/index.html" target="_blank">Designing Enterprise Applications with the J2EE Platform, 2nd ed.</a>. </li></ol><img src ="http://www.blogjava.net/beansoft/aggbug/147391.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-09-22 13:37 <a href="http://www.blogjava.net/beansoft/archive/2007/09/22/147391.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>YUI-Ext 的新站点: http://www.extjs.com/</title><link>http://www.blogjava.net/beansoft/archive/2007/09/04/142733.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 04 Sep 2007 12:13:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/09/04/142733.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/142733.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/09/04/142733.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/142733.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/142733.html</trackback:ping><description><![CDATA[<p><a href="http://www.extjs.com/">http://www.extjs.com/</a> 可以看到他们做的越来越漂亮了, 但是很不幸的是对商业场合使用, 要收费..</p> <p><a href="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/YUIExthttpwww.extjs.com_11C3B/image.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="587" alt="image" src="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/YUIExthttpwww.extjs.com_11C3B/image_thumb.png" width="960" border="0"></a></p><img src ="http://www.blogjava.net/beansoft/aggbug/142733.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-09-04 20:13 <a href="http://www.blogjava.net/beansoft/archive/2007/09/04/142733.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>河南话讲解 MyEclipse 5.5 + Tomcat Servlet 开发入门视频</title><link>http://www.blogjava.net/beansoft/archive/2007/08/31/141845.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Fri, 31 Aug 2007 14:32:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/08/31/141845.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/141845.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/08/31/141845.html#Feedback</comments><slash:comments>17</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/141845.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/141845.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 请认准正版河南话讲解, 谨防假冒.  观看之前强烈建议您把音量调低, 以免打扰他人. &nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/08/31/141845.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/141845.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-08-31 22:32 <a href="http://www.blogjava.net/beansoft/archive/2007/08/31/141845.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Tomcat 入门视频: 下载, 运行, 第一个 HelloWorld</title><link>http://www.blogjava.net/beansoft/archive/2007/08/28/140353.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 28 Aug 2007 03:07:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/08/28/140353.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/140353.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/08/28/140353.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/140353.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/140353.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 供第一次使用Tomcat的朋友们参考.&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/08/28/140353.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/140353.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-08-28 11:07 <a href="http://www.blogjava.net/beansoft/archive/2007/08/28/140353.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JSP 生成随机验证码图片(经典老代码)</title><link>http://www.blogjava.net/beansoft/archive/2007/08/03/134334.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Fri, 03 Aug 2007 13:47:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/08/03/134334.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/134334.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/08/03/134334.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/134334.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/134334.html</trackback:ping><description><![CDATA[<p><a href="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/JSP_131BC/20060212%5B4%5D.jpg" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="80" src="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/JSP_131BC/20060212_thumb%5B2%5D.jpg" width="240" border="0"></a> </p> <p>&nbsp;</p> <p>&lt;%@ page contentType="image/jpeg" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*" %&gt;<br>&lt;%!<br>Color getRandColor(int fc,int bc){//给定范围获得随机颜色<br>Random random = new Random();<br>if(fc&gt;255) fc=255;<br>if(bc&gt;255) bc=255;<br>int r=fc+random.nextInt(bc-fc);<br>int g=fc+random.nextInt(bc-fc);<br>int b=fc+random.nextInt(bc-fc);<br>return new Color(r,g,b);<br>}<br>%&gt;<br>&lt;%<br>//设置页面不缓存<br>response.setHeader("Pragma","No-cache");<br>response.setHeader("Cache-Control","no-cache");<br>response.setDateHeader("Expires", 0);  <p>// 在内存中创建图象<br>int width=60, height=20;<br>BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);  <p>// 获取图形上下文<br>Graphics g = image.getGraphics();  <p>//生成随机类<br>Random random = new Random();  <p>// 设定背景色<br>g.setColor(getRandColor(200,250));<br>g.fillRect(0, 0, width, height);  <p>//设定字体<br>g.setFont(new Font("Times New Roman",Font.PLAIN,18));  <p>//画边框<br>//g.setColor(new Color());<br>//g.drawRect(0,0,width-1,height-1);  <p>// 随机产生155条干扰线，使图象中的认证码不易被其它程序探测到<br>g.setColor(getRandColor(160,200));<br>for (int i=0;i&lt;155;i++)<br>{<br>int x = random.nextInt(width);<br>int y = random.nextInt(height);<br>int xl = random.nextInt(12);<br>int yl = random.nextInt(12);<br>g.drawLine(x,y,x+xl,y+yl);<br>}  <p>// 取随机产生的认证码(4位数字)<br>String sRand=""<br>for (int i=0;i&lt;4;i++){<br>String rand=String.valueOf(random.nextInt(10));<br>sRand+=rand;<br>// 将认证码显示到图象中<br>g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110)));//调用函数出来的颜色相同，可能是因为种子太接近，所以只能直接生成<br>g.drawString(rand,13*i+6,16);<br>}  <p>// 将认证码存入SESSION<br>session.setAttribute("rand",sRand);  <p>// 图象生效<br>g.dispose();  <p>out.clear();<br>request.setAttribute("gzip", "false");  <p>// 输出图象到页面<br>ImageIO.write(image, "JPEG", response.getOutputStream());<br>return;<br>%&gt;</p><img src ="http://www.blogjava.net/beansoft/aggbug/134334.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-08-03 21:47 <a href="http://www.blogjava.net/beansoft/archive/2007/08/03/134334.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在 Linux 上配置并运行 Tomcat 服务器(入门整理)(视频)</title><link>http://www.blogjava.net/beansoft/archive/2007/07/24/132052.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 24 Jul 2007 07:11:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/07/24/132052.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/132052.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/07/24/132052.html#Feedback</comments><slash:comments>8</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/132052.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/132052.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Linux 下配置运行 Tomcat 的操作视频, 非 root 用户下的&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/07/24/132052.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/132052.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-07-24 15:11 <a href="http://www.blogjava.net/beansoft/archive/2007/07/24/132052.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>公布另一个 QQ 群: 19055258 Java EE 乐园</title><link>http://www.blogjava.net/beansoft/archive/2007/06/28/126826.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Thu, 28 Jun 2007 07:21:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/06/28/126826.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/126826.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/06/28/126826.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/126826.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/126826.html</trackback:ping><description><![CDATA[公布另一个 QQ 群: 19055258 Java EE 乐园, 专供有志于 Java EE 学习, 研究, 培训的朋友们交流.<br>不过最近上 QQ 的时间有些限制了... 唉, 郁闷中.<br>   <img src ="http://www.blogjava.net/beansoft/aggbug/126826.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-06-28 15:21 <a href="http://www.blogjava.net/beansoft/archive/2007/06/28/126826.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CSS 介绍 PPT</title><link>http://www.blogjava.net/beansoft/archive/2007/05/30/120842.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Wed, 30 May 2007 03:04:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/05/30/120842.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/120842.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/05/30/120842.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/120842.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/120842.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 前一阵子给一位美工做了相关的培训, 主要集中在 CSS 的各种用法上. 网速太慢了, 素材以后有机会再放.&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/05/30/120842.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/120842.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-05-30 11:04 <a href="http://www.blogjava.net/beansoft/archive/2007/05/30/120842.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JavaScript 实现的简繁转换功能(收集整理)</title><link>http://www.blogjava.net/beansoft/archive/2007/05/14/117267.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Mon, 14 May 2007 02:30:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/05/14/117267.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/117267.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/05/14/117267.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/117267.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/117267.html</trackback:ping><description><![CDATA[<p></p> <p>//简繁转换功能  <p>// 将指定元素中的文本转换为简体<br>function bodytojt(x)<br>{<br>var bodys=document.getElementById(x);<br>bodys.innerHTML=Simplized(bodys.innerHTML);<br>}  <p>// 将指定元素中的文本转换为繁体<br>function bodytoft(x)<br>{<br>var bodys=document.getElementById(x);<br>bodys.innerHTML=Traditionalized(bodys.innerHTML);<br>}  <p>// 简体字典表<br>function JTPYStr()<br>{<br>return '皑蔼碍爱隘翱袄奥懊澳捌靶把耙坝霸罢摆败稗扳颁办绊帮梆绑镑谤褒剥薄雹堡饱宝报鲍辈贝钡狈备惫绷笔碧蓖蔽毕毙闭敝弊壁臂避陛鞭边编贬变辨辩辫鳖憋别瘪濒滨宾摈饼拨钵勃铂箔驳卜补埠簿部怖擦参蚕残惭惨灿苍舱仓沧厕侧册测层诧搀掺蝉馋谗缠铲产阐颤昌猖场尝长偿肠厂敞畅钞车撤掣彻澈郴尘陈衬撑称惩澄诚骋痴迟驰耻齿炽冲虫崇宠抽酬畴踌筹绸瞅丑橱厨躇锄雏础储矗搐触处揣传疮闯创锤纯蠢戳绰疵茨磁雌辞慈瓷词赐聪葱囱从丛凑粗醋簇促蹿篡窜摧瘁粹淬磋撮搓措挫错搭达傣戴带贷担单郸掸胆氮但惮淡诞弹蛋当挡党荡档捣蹈岛祷导盗蹬灯邓滴迪敌涤翟递缔颠掂滇碘点靛垫电惦奠淀殿钓调跌爹碟蝶迭谍叠钉顶锭订东董懂动栋冻斗犊独读堵睹赌镀锻断缎堆兑队对墩吨蹲敦顿囤钝盾遁掇哆夺垛鹅额讹娥恶扼遏鄂饿恩儿尔饵洱贰发罚阀珐藩矾钒烦范贩饭访纺飞废沸费纷坟奋愤粪丰枫蜂峰锋风疯烽逢冯缝讽凤肤孵辐抚辅赋复傅腹负富讣妇缚咐噶嘎该改概钙盖溉干赶感秆敢赣冈刚钢纲岗篙皋糕搞镐搁鸽胳疙阁隔铬个给耕羹埂耿梗龚宫巩贡钩沟构购够箍蛊顾剐关观管馆惯贯广瑰规硅归龟闺轨诡柜跪贵刽辊滚棍锅郭国裹过哈骸骇韩汉阂涸赫褐鹤贺嘿横轰鸿红后壶葫护沪户哗华画划话槐徊怀淮坏欢环桓还缓换唤痪豢焕涣黄磺蝗簧谎挥辉徽恢蛔毁悔慧惠晦贿秽会烩汇讳诲绘荤浑豁伙获霍货祸击机畸稽积箕饥激讥鸡姬绩缉极棘辑级挤几脊蓟冀剂悸济计记既际继纪枷夹荚颊贾钾假稼价驾嫁歼监坚笺间艰缄茧检柬碱硷拣捡简俭剪减荐槛鉴践贱见键舰剑饯渐溅涧浆疆蒋桨奖讲酱蕉椒礁焦胶浇骄娇搅铰矫侥脚饺缴绞剿教酵轿较窖揭秸阶截节茎惊粳经警景颈静境敬镜径痉靖竟竞净纠厩救旧驹举据锯惧剧捐鹃绢撅攫杰捷睫竭洁结戒藉芥诫届紧锦仅谨进靳晋烬浸尽劲荆兢觉决诀绝钧军峻俊竣浚郡骏开揩凯慨堪勘坎砍康慷糠磕颗壳咳课垦恳抠库裤夸块侩宽矿旷况亏岿窥葵奎魁傀馈愧溃坤扩廓阔喇蜡腊莱来赖蓝婪栏拦篮阑兰澜谰揽览懒缆烂滥廊捞劳烙涝勒乐镭垒擂肋类泪楞冷厘梨犁黎篱狸离漓理里鲤礼莉荔丽厉励砾历傈痢粒沥隶璃哩俩联莲连镰廉怜涟帘敛脸链恋炼练粮凉两辆量谅撩聊僚疗燎寥辽潦撂镣猎霖临邻鳞淋凛赁拎菱零龄铃凌灵陵岭领馏刘龙聋咙笼窿隆垄拢陇楼娄搂篓漏陋芦卢颅庐炉掳卤虏鲁赂禄录陆戮驴吕铝侣旅履屡缕虑率滤绿峦挛孪滦乱抡轮伦仑沦纶论萝螺罗逻锣箩骡裸落洛骆络妈玛码蚂马骂嘛吗埋买麦卖迈脉瞒馒蛮满蔓谩猫锚铆贸么霉没媒镁门闷们萌蒙檬盟锰猛梦谜弥秘觅绵冕勉娩缅瞄藐渺庙蔑灭悯闽螟鸣铭谬摸摹蘑谋亩姆钠纳难囊挠脑恼闹淖呢馁腻溺蔫撵捻娘酿鸟捏聂孽啮镊镍涅柠狞凝宁拧泞钮纽脓浓农疟挪懦糯诺哦欧鸥殴藕呕偶沤攀潘盘磐盼畔庞中国昆山博爱天下耪赔喷抨鹏骗飘频贫聘苹萍凭瓶评屏坡泼颇扑铺朴谱脐齐骑岂启契砌气弃讫掐牵扦钎铅迁签谦乾黔钱钳潜遣浅谴堑嵌歉枪呛腔羌墙蔷强抢橇锹桥乔侨鞘撬翘峭窍窃钦亲轻氢倾卿顷请庆琼穷趋区躯驱渠取娶龋趣颧权醛痊劝缺炔瘸却鹊让饶扰绕惹热韧认纫荣绒揉褥软锐闰润弱撒洒萨腮鳃塞赛伞桑嗓丧搔骚扫涩杀纱傻啥煞筛晒闪陕擅赡缮墒伤赏梢捎稍烧绍奢赊蛇赦摄慑涉设砷绅审婶肾渗声绳胜圣师狮湿诗尸时蚀实识驶势释饰视试寿瘦兽蔬枢输书赎孰熟薯暑曙署蜀黍鼠属术树竖数漱帅双谁税吮瞬顺舜说硕烁丝嗣饲耸怂颂讼诵搜艘擞嗽苏诉肃酸蒜虽绥髓碎岁孙损笋蓑梭唆缩琐索锁獭挞蹋抬泰酞摊贪瘫滩坛檀痰潭谭谈毯袒碳探叹汤糖烫涛滔绦腾疼誊锑题蹄啼体替嚏惕涕剃屉条眺贴铁帖厅听烃铜统头图涂团颓腿蜕褪退臀拖脱鸵驮驼椭洼袜豌弯湾顽万网韦违桅围唯惟为潍维苇萎伟伪纬谓慰卫温闻纹吻稳紊问嗡翁瓮挝蜗涡窝斡握呜钨乌诬无芜吴坞雾务误锡牺稀膝犀檄袭习媳铣戏细虾辖峡侠狭厦锨鲜纤咸贤衔舷闲显险现献县腺馅羡宪陷限线厢镶乡详响项萧霄销晓啸楔些歇蝎鞋协挟携胁谐写械卸蟹懈泄泻谢锌衅兴汹锈袖绣墟戌需虚嘘须徐许蓄绪续轩悬选癣眩绚靴薛学勋询寻驯训讯逊压鸦鸭哑亚讶焉咽阉烟淹盐严颜阎艳厌砚雁唁彦谚验鸯杨扬佯疡阳痒养样漾邀腰瑶摇尧遥窑谣姚药椰噎爷页掖业叶腋夜液壹医揖铱颐夷遗仪疑彝蚁艺亿臆逸肄疫裔毅忆义诣议谊译异翼翌绎荫殷阴银饮樱婴鹰应缨莹萤营荧蝇颖硬哟拥佣臃痈庸雍踊蛹咏涌优忧邮铀犹游釉诱淤盂虞愚舆逾鱼愉渝渔隅娱与屿禹语吁峪御狱誉预豫驭鸳渊辕园员圆猿源缘远苑愿怨院约越跃钥岳粤悦阅云郧匀陨运蕴酝晕韵砸杂灾载攒暂赞赃脏葬遭糟凿藻枣灶燥责择则泽贼赠扎札轧铡闸诈斋债寨瞻毡盏斩辗崭展蘸栈战站湛绽张涨帐账胀赵蛰辙锗蔗这斟甄砧臻贞针侦诊震振镇阵蒸挣睁狰帧郑证织职植殖执纸挚掷帜质钟终种肿众洲诌粥轴皱宙昼骤猪诸诛烛煮瞩嘱贮铸筑驻拽专砖转撰赚篆桩庄装妆撞壮状锥赘坠缀谆著浊兹资滓渍鬃棕踪宗综总纵邹揍诅组钻纂致钟么为只凶准启板里雳余链泄';<br>}  <p>// 繁体字典表<br>function FTPYStr()<br>{<br>return '皚藹礙愛隘翺襖奧懊澳捌靶把耙壩霸罷擺敗稗扳頒辦絆幫梆綁鎊謗褒剝薄雹堡飽寶報鮑輩貝鋇狽備憊繃筆碧蓖蔽畢斃閉敝弊壁臂避陛鞭邊編貶變辨辯辮鼈憋別癟瀕濱賓擯餅撥缽勃鉑箔駁蔔補埠簿部怖擦參蠶殘慚慘燦蒼艙倉滄廁側冊測層詫攙摻蟬饞讒纏鏟産闡顫昌猖場嘗長償腸廠敞暢鈔車撤掣徹澈郴塵陳襯撐稱懲澄誠騁癡遲馳恥齒熾沖蟲崇寵抽酬疇躊籌綢瞅醜櫥廚躇鋤雛礎儲矗搐觸處揣傳瘡闖創錘純蠢戳綽疵茨磁雌辭慈瓷詞賜聰蔥囪從叢湊粗醋簇促躥篡竄摧瘁粹淬磋撮搓措挫錯搭達傣戴帶貸擔單鄲撣膽氮但憚淡誕彈蛋當擋黨蕩檔搗蹈島禱導盜蹬燈鄧滴迪敵滌翟遞締顛掂滇碘點靛墊電惦奠澱殿釣調跌爹碟蝶叠諜疊釘頂錠訂東董懂動棟凍鬥犢獨讀堵睹賭鍍鍛斷緞堆兌隊對墩噸蹲敦頓囤鈍盾遁掇哆奪垛鵝額訛娥惡扼遏鄂餓恩兒爾餌洱貳發罰閥琺藩礬釩煩範販飯訪紡飛廢沸費紛墳奮憤糞豐楓蜂峰鋒風瘋烽逢馮縫諷鳳膚孵輻撫輔賦複傅腹負富訃婦縛咐噶嘎該改概鈣蓋溉幹趕感稈敢贛岡剛鋼綱崗篙臯糕搞鎬擱鴿胳疙閣隔鉻個給耕羹埂耿梗龔宮鞏貢鈎溝構購夠箍蠱顧剮關觀管館慣貫廣瑰規矽歸龜閨軌詭櫃跪貴劊輥滾棍鍋郭國裹過哈骸駭韓漢閡涸赫褐鶴賀嘿橫轟鴻紅後壺葫護滬戶嘩華畫劃話槐徊懷淮壞歡環桓還緩換喚瘓豢煥渙黃磺蝗簧謊揮輝徽恢蛔毀悔慧惠晦賄穢會燴彙諱誨繪葷渾豁夥獲霍貨禍擊機畸稽積箕饑激譏雞姬績緝極棘輯級擠幾脊薊冀劑悸濟計記既際繼紀枷夾莢頰賈鉀假稼價駕嫁殲監堅箋間艱緘繭檢柬堿鹼揀撿簡儉剪減薦檻鑒踐賤見鍵艦劍餞漸濺澗漿疆蔣槳獎講醬蕉椒礁焦膠澆驕嬌攪鉸矯僥腳餃繳絞剿教酵轎較窖揭稭階截節莖驚粳經警景頸靜境敬鏡徑痙靖竟競淨糾廄救舊駒舉據鋸懼劇捐鵑絹撅攫傑捷睫竭潔結戒藉芥誡屆緊錦僅謹進靳晉燼浸盡勁荊兢覺決訣絕鈞軍峻俊竣浚郡駿開揩凱慨堪勘坎砍康慷糠磕顆殼咳課墾懇摳庫褲誇塊儈寬礦曠況虧巋窺葵奎魁傀饋愧潰坤擴廓闊喇蠟臘萊來賴藍婪欄攔籃闌蘭瀾讕攬覽懶纜爛濫廊撈勞烙澇勒樂鐳壘擂肋類淚楞冷厘梨犁黎籬狸離漓理裏鯉禮莉荔麗厲勵礫曆傈痢粒瀝隸璃哩倆聯蓮連鐮廉憐漣簾斂臉鏈戀煉練糧涼兩輛量諒撩聊僚療燎寥遼潦撂鐐獵霖臨鄰鱗淋凜賃拎菱零齡鈴淩靈陵嶺領餾劉龍聾嚨籠窿隆壟攏隴樓婁摟簍漏陋蘆盧顱廬爐擄鹵虜魯賂祿錄陸戮驢呂鋁侶旅履屢縷慮率濾綠巒攣孿灤亂掄輪倫侖淪綸論蘿螺羅邏鑼籮騾裸落洛駱絡媽瑪碼螞馬罵嘛嗎埋買麥賣邁脈瞞饅蠻滿蔓謾貓錨鉚貿麽黴沒媒鎂門悶們萌蒙檬盟錳猛夢謎彌秘覓綿冕勉娩緬瞄藐渺廟蔑滅憫閩螟鳴銘謬摸摹蘑謀畝姆鈉納難囊撓腦惱鬧淖呢餒膩溺蔫攆撚娘釀鳥捏聶孽齧鑷鎳涅檸獰凝甯擰濘鈕紐膿濃農瘧挪懦糯諾哦歐鷗毆藕嘔偶漚攀潘盤磐盼畔龐中國昆山博愛天下耪賠噴抨鵬騙飄頻貧聘蘋萍憑瓶評屏坡潑頗撲鋪樸譜臍齊騎豈啓契砌氣棄訖掐牽扡釺鉛遷簽謙乾黔錢鉗潛遣淺譴塹嵌歉槍嗆腔羌牆薔強搶橇鍬橋喬僑鞘撬翹峭竅竊欽親輕氫傾卿頃請慶瓊窮趨區軀驅渠取娶齲趣顴權醛痊勸缺炔瘸卻鵲讓饒擾繞惹熱韌認紉榮絨揉褥軟銳閏潤弱撒灑薩腮鰓塞賽傘桑嗓喪搔騷掃澀殺紗傻啥煞篩曬閃陝擅贍繕墒傷賞梢捎稍燒紹奢賒蛇赦攝懾涉設砷紳審嬸腎滲聲繩勝聖師獅濕詩屍時蝕實識駛勢釋飾視試壽瘦獸蔬樞輸書贖孰熟薯暑曙署蜀黍鼠屬術樹豎數漱帥雙誰稅吮瞬順舜說碩爍絲嗣飼聳慫頌訟誦搜艘擻嗽蘇訴肅酸蒜雖綏髓碎歲孫損筍蓑梭唆縮瑣索鎖獺撻蹋擡泰酞攤貪癱灘壇檀痰潭譚談毯袒碳探歎湯糖燙濤滔縧騰疼謄銻題蹄啼體替嚏惕涕剃屜條眺貼鐵帖廳聽烴銅統頭圖塗團頹腿蛻褪退臀拖脫鴕馱駝橢窪襪豌彎灣頑萬網韋違桅圍唯惟爲濰維葦萎偉僞緯謂慰衛溫聞紋吻穩紊問嗡翁甕撾蝸渦窩斡握嗚鎢烏誣無蕪吳塢霧務誤錫犧稀膝犀檄襲習媳銑戲細蝦轄峽俠狹廈鍁鮮纖鹹賢銜舷閑顯險現獻縣腺餡羨憲陷限線廂鑲鄉詳響項蕭霄銷曉嘯楔些歇蠍鞋協挾攜脅諧寫械卸蟹懈泄瀉謝鋅釁興洶鏽袖繡墟戌需虛噓須徐許蓄緒續軒懸選癬眩絢靴薛學勳詢尋馴訓訊遜壓鴉鴨啞亞訝焉咽閹煙淹鹽嚴顔閻豔厭硯雁唁彥諺驗鴦楊揚佯瘍陽癢養樣漾邀腰瑤搖堯遙窯謠姚藥椰噎爺頁掖業葉腋夜液壹醫揖銥頤夷遺儀疑彜蟻藝億臆逸肄疫裔毅憶義詣議誼譯異翼翌繹蔭殷陰銀飲櫻嬰鷹應纓瑩螢營熒蠅穎硬喲擁傭臃癰庸雍踴蛹詠湧優憂郵鈾猶遊釉誘淤盂虞愚輿逾魚愉渝漁隅娛與嶼禹語籲峪禦獄譽預豫馭鴛淵轅園員圓猿源緣遠苑願怨院約越躍鑰嶽粵悅閱雲鄖勻隕運蘊醞暈韻砸雜災載攢暫贊贓髒葬遭糟鑿藻棗竈燥責擇則澤賊贈紮劄軋鍘閘詐齋債寨瞻氈盞斬輾嶄展蘸棧戰站湛綻張漲帳賬脹趙蟄轍鍺蔗這斟甄砧臻貞針偵診震振鎮陣蒸掙睜猙幀鄭證織職植殖執紙摯擲幟質鍾終種腫衆洲謅粥軸皺宙晝驟豬諸誅燭煮矚囑貯鑄築駐拽專磚轉撰賺篆樁莊裝妝撞壯狀錐贅墜綴諄著濁茲資滓漬鬃棕蹤宗綜總縱鄒揍詛組鑽纂緻鐘麼為隻兇準啟闆裡靂餘鍊洩';<br>}  <p>// 转换字符串为繁体<br>function Traditionalized(cc)<br>{<br>var str='';<br>var oldstat=""+window.status;<br>for(var i=0;i&lt;cc.length;i++)<br>{<br>if((i%1000)==0)window.status="Working..."+Math.round(i*100/cc.length,2)+"%"<br>if(JTPYStr().indexOf(cc.charAt(i))!=-1)<br>str+=FTPYStr().charAt(JTPYStr().indexOf(cc.charAt(i)));<br>else<br>str+=cc.charAt(i);<br>}<br>window.status="100% OK!"<br>setTimeout("window.status='"+oldstat+"'",1000);<br>return str;<br>}  <p>// 转换字符串为简体<br>function Simplized(cc)<br>{<br>var str='';<br>var oldstat=""+window.status;<br>for(var i=0;i&lt;cc.length;i++)<br>{<br>if((i%1000)==0)window.status="Working..."+Math.round(i*100/cc.length,2)+"%"<br>if(FTPYStr().indexOf(cc.charAt(i))!=-1)<br>str+=JTPYStr().charAt(FTPYStr().indexOf(cc.charAt(i)));<br>else<br>str+=cc.charAt(i);<br>}<br>window.status="100% OK!"<br>setTimeout("window.status='"+oldstat+"'",1000);<br>return str;<br>}</p><img src ="http://www.blogjava.net/beansoft/aggbug/117267.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-05-14 10:30 <a href="http://www.blogjava.net/beansoft/archive/2007/05/14/117267.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>体重系数计算BMI的网页</title><link>http://www.blogjava.net/beansoft/archive/2007/05/09/116202.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Wed, 09 May 2007 07:34:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/05/09/116202.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/116202.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/05/09/116202.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/116202.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/116202.html</trackback:ping><description><![CDATA[<p>原创: αβγ 修改: me</p> <p><a href="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/BMI_DA5E/image%7B0%7D%5B3%5D.png" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="366" src="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/BMI_DA5E/image%7B0%7D_thumb%5B1%5D.png" width="345" border="0"></a> </p> <blockquote> <p>&nbsp;</p> <p>&lt;form id="form1" name="form1" method="post" action=""&gt;<br>&lt;p&gt;&amp;nbsp;&lt;/p&gt;<br>&lt;p&gt;<br>&lt;label&gt;请输入你的体重：<br>&lt;input name="weight" type="text" size="10" value=70 /&gt;<br>&lt;/label&gt;<br>（kg）&lt;/p&gt;<br>&lt;p&gt;<br>&lt;label&gt;<br>请输入你的身高：<br>&lt;input name="height" type="text" size="10" value=1.67 /&gt;<br>&lt;/label&gt;<br>（m）&lt;/p&gt;<br>&lt;p&gt;<br>&lt;label&gt;<br>您的体重指数 BMI==weight /(height^2)：<br>&lt;input name="bmi" type="text" size="10" /&gt;<br>&lt;/label&gt;<br>&lt;/p&gt; <br>&lt;p&gt;<br>&lt;label&gt;<br>&lt;input type="button" name="Submit" value="测试指标" onclick="test()" /&gt;<br>&lt;/label&gt;<br>&lt;label&gt;<br>&lt;input type="reset" name="Submit2" value="重置" /&gt;<br>&lt;/label&gt;<br>&lt;/p&gt;<br>&lt;/form&gt;<br>&lt;script language="javascript"&gt;<br>function test()<br>{<br>if(!isNaN(document.form1.weight.value)&amp;&amp;!isNaN(document.form1.height.value))<br>{<br>var bmi = <br>document.form1.weight.value/(document.form1.height.value*document.form1.height.value);<br>document.form1.bmi.value = bmi;<br>if(isNaN(bmi)) {<br>alert('请检查输入是否正确！');<br>return;<br>}<br>if(bmi&gt;24.9)<br>{<br>alert('你偏胖了！');<br>}else if(bmi&lt;18.5)<br>{<br>alert('你偏瘦了！');<br>}else <br>{<br>alert('你体重恰当好，不胖不瘦！');<br>}<br>}else<br>{<br>alert('请检查输入是否正确！');<br>}  <p>}  <p>&lt;/script&gt; </p></blockquote><img src ="http://www.blogjava.net/beansoft/aggbug/116202.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-05-09 15:34 <a href="http://www.blogjava.net/beansoft/archive/2007/05/09/116202.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>判断事件是不是发生在某组件中的 JS 函数</title><link>http://www.blogjava.net/beansoft/archive/2007/04/24/113255.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 24 Apr 2007 08:56:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/04/24/113255.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/113255.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/04/24/113255.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/113255.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/113255.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 在实现某些功能, 例如只在某 DIV 上面弹出右键菜单的时候, 这个函数可以用一下(忘了从哪里看到以及改造的..抱歉), 仅供参考用, 用一些 JS 组件库应该可以更方便的实现&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/04/24/113255.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/113255.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-04-24 16:56 <a href="http://www.blogjava.net/beansoft/archive/2007/04/24/113255.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>视频:使用 Netbeans 5.5可视化开发 JSF 的简单注册流程</title><link>http://www.blogjava.net/beansoft/archive/2007/04/24/113110.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 24 Apr 2007 02:39:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/04/24/113110.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/113110.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/04/24/113110.html#Feedback</comments><slash:comments>14</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/113110.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/113110.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 影片时间: 05:32, 实际操作时间: 约 2 分钟&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/04/24/113110.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/113110.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-04-24 10:39 <a href="http://www.blogjava.net/beansoft/archive/2007/04/24/113110.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>善用 Google: JavaScript 复制对象</title><link>http://www.blogjava.net/beansoft/archive/2007/03/27/106675.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 27 Mar 2007 07:20:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/03/27/106675.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/106675.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/03/27/106675.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/106675.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/106675.html</trackback:ping><description><![CDATA[<p></p> <p>飛雪(leo)(***) 15:07:42<br>贏在執行(leo)(***) 15:05:48<br>&lt;TmpCar&gt;<br>&lt;babs&gt;1&lt;/babs&gt;<br>&lt;bfuelelecset&gt;1&lt;/bfuelelecset&gt;<br>&lt;scareconomyrange&gt;123&lt;/scareconomyrange&gt;<br>&lt;scaricno&gt;1&lt;/scaricno&gt;<br>&lt;scarid&gt;123&lt;/scarid&gt;<br>&lt;scarlevel&gt;1&lt;/scarlevel&gt;<br>&lt;/TmpCar&gt;<br>我把这个转　成一个对象， <br>贏在執行(leo)(***) 15:07:52<br>比如：我现在有两个Ｖar 变量，a,b等。<br>比如：a有以下字段：<br>babs，bfuelelecset，scareconomyrange，scaricno，scarid，scarlevel<br>b：有以下字段：<br>babs，bfuelelecset，scareconomyrange，scaricno，scarid，name,keyno<br>我现在要把b的字与Ａ的字段一样的，将其值ＣＯＰＹ到Ａ中要怎么做 <br>BeanSoft(***) 15:08:16<br>Java 还是脚本? <br>BeanSoft(***) 15:08:26<br>Java可以用 clone() <br>飛雪(leo)(***) 15:08:35<br>ＪＳ <br>BeanSoft(***) 15:08:36<br>脚本貌似也有类似的机制 <br>飛雪(leo)(***) 15:08:50<br>？ <br>$$简单爱-莹() 15:08:55<br>怎么好象XML 那是JS啊 <br>BeanSoft(***) 15:08:59<br>for in 循环可以遍历所有属性 <br>飛雪(leo)(***) 15:09:20<br>recToRec:function(oldRec,newRec)<br>{<br>var typename;<br>if(typeof oldRec=="undefined"||typeof oldRec=="undefined")<br>return oldRec;<br>for (var p in oldRec)<br>{<br>typename=typeof(newRec[p]);<br>if("object"==typename)<br>{<br>if (newRec) <br>}<br>}<br>} <br>飛雪(leo)(***) 15:09:26<br>我只有写到这里， <br>飛雪(leo)(***) 15:09:31<br>接下去不知道怎么写 <br>飛雪(leo)(***) 15:09:46<br>typename=typeof(newRec[p]);<br>if("object"==typename)<br>这个是错的，只能得到值　<br>飛雪(leo)(***) 15:10:47<br>BeanSoft等兄弟们，出来帮忙一下 <br>BeanSoft(***) 15:12:48<br>JavaScript 复制对象 <br>BeanSoft(***) 15:12:54<br>Google 搜索, 有结果.. <br>飛雪(leo)(***) 15:13:29<br>好的，谢谢　 <br>BeanSoft(***) 15:13:54<br>第一个就是,带代码的..呵呵,其实你大部分时候去找 Google 就有答案 </p><img src ="http://www.blogjava.net/beansoft/aggbug/106675.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-03-27 15:20 <a href="http://www.blogjava.net/beansoft/archive/2007/03/27/106675.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个带 checkbox 的 JS 树组件</title><link>http://www.blogjava.net/beansoft/archive/2007/03/26/106342.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Mon, 26 Mar 2007 02:55:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/03/26/106342.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/106342.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/03/26/106342.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/106342.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/106342.html</trackback:ping><description><![CDATA[<p>基于 AJAX Java 群的集体讨论</p> <p><a href="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/checkboxJS_990B/jstree%5B1%5D.jpg" atomicselection="true"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="240" src="http://www.blogjava.net/images/blogjava_net/beansoft/WindowsLiveWriter/checkboxJS_990B/jstree.jpg" width="181" border="0"></a> </p> <p>1. 用 <a title="http://www.java2s.com/Code/JavaScript/GUI-Components/Checkboxtreenodecheckeduncheckedgetthecheckeditems.htm " href="http://www.java2s.com/Code/JavaScript/GUI-Components/Checkboxtreenodecheckeduncheckedgetthecheckeditems.htm ">http://www.java2s.com/Code/JavaScript/GUI-Components/Checkboxtreenodecheckeduncheckedgetthecheckeditems.htm </a></p> <p>2. 用 YUI(Yahoo UI Library)</p> <p>感谢: 一再 咖啡屋的鼠标 Amigo</p><img src ="http://www.blogjava.net/beansoft/aggbug/106342.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-03-26 10:55 <a href="http://www.blogjava.net/beansoft/archive/2007/03/26/106342.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AJAX 的小问题: 为啥是 Msxml2.XMLHTTP, 不能改变名字嘛?</title><link>http://www.blogjava.net/beansoft/archive/2007/03/20/104948.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 20 Mar 2007 06:02:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/03/20/104948.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/104948.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/03/20/104948.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/104948.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/104948.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 今天有人询问,这个问题很典型,我刚学的时候也遇到过,仅仅代表个人理解.&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/03/20/104948.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/104948.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-03-20 14:02 <a href="http://www.blogjava.net/beansoft/archive/2007/03/20/104948.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在线视频(英文):Professional Ajax Development with the Spring Framework</title><link>http://www.blogjava.net/beansoft/archive/2007/03/16/104324.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Fri, 16 Mar 2007 10:10:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/03/16/104324.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/104324.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/03/16/104324.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/104324.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/104324.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: http://event.on24.com/eventRegistration/EventLobbyServlet?target=lobby.jsp&amp;eventid=32366&amp;sessionid=1&amp;key=B52EF34435CF9AE046E200229B9B685A&amp;eventuserid=9915510 演讲英文: &nbsp; Male Speaker:...&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/03/16/104324.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/104324.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-03-16 18:10 <a href="http://www.blogjava.net/beansoft/archive/2007/03/16/104324.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MapEasy 的北京地图 demo(本机运行)</title><link>http://www.blogjava.net/beansoft/archive/2007/02/06/98306.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 06 Feb 2007 06:41:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/02/06/98306.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/98306.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/02/06/98306.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/98306.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/98306.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: mapapi0.4alpha_beijing_demo.zip 1131KB 下载后本机运行, 只有一级缩放. 图片切片大小: 500x500 每片&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/02/06/98306.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/98306.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-02-06 14:41 <a href="http://www.blogjava.net/beansoft/archive/2007/02/06/98306.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>表格拖动, 排序, 固定表头3合一的纯 JS 表格组件</title><link>http://www.blogjava.net/beansoft/archive/2007/02/03/97766.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Sat, 03 Feb 2007 09:47:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/02/03/97766.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/97766.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/02/03/97766.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/97766.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/97766.html</trackback:ping><description><![CDATA[<p>今天看到了这位朋友的文章: <a href="http://www.blogjava.net/zhy-enda/archive/2006/05/29/48759.html">表格拖动（改进加原创）</a>&nbsp;, 写的很不错, 试了一下无法在 FireFox 下运行, 想起来已经是 Google 雇员的 Emil A Eklund 好像已经写过了一个使用非常简单的类似组件, 兼容 IE 和 FireFox, 找到了它, 给大家推荐一下:</p> <p><a title="http://webfx.eae.net/dhtml/collist/columnlist.html" href="http://webfx.eae.net/dhtml/collist/columnlist.html">http://webfx.eae.net/dhtml/collist/columnlist.html</a></p> <p>在线演示:</p> <p><a href="http://webfx.eae.net/dhtml/collist/demo.html">Demo</a></p> <p>这些英文写的很浅显, 随便看看用起来就 OK 了.</p> <p>还看到同志们关于 Firefox 中没有定义 event 对象讨论的热火朝天, 但是 Emil 兄弟早就做了一些这方面的工作, 我需要的就是拿来用, 请浏览:</p> <p><a title="http://webfx.eae.net/dhtml/ieemu/" href="http://webfx.eae.net/dhtml/ieemu/">http://webfx.eae.net/dhtml/ieemu/</a>&nbsp;FF 下的 IE API 模拟.</p> <p>&nbsp;</p> <p>&nbsp;</p> <h4>Introduction</h4> <p>When it comes to DHTML Mozilla might be less powerful than IE4 but when it comes to JavaScript it just kicks ass. The first time a saw a setter being used with a prototype of the built-in HTMLElement constructor I was just blown away. One of my first thought at that time was that this was exactly what I needed to start emulating the IE DHTML Object Model for Mozilla. <p>The goal of this article is to emulate a lot of IE behaviors to work in Mozilla, both to make old IE specific scripts work in Mozilla but also to make it easier to create new scripts that work in both IE5 and Mozilla. The article is actually going to be a series of smaller articles, each one concentrating on a small part of the emulation.</p><img src ="http://www.blogjava.net/beansoft/aggbug/97766.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-02-03 17:47 <a href="http://www.blogjava.net/beansoft/archive/2007/02/03/97766.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JSP 文件下载的相对完整代码(解决中文问题和Weblogic报错)</title><link>http://www.blogjava.net/beansoft/archive/2007/02/01/97294.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Thu, 01 Feb 2007 07:42:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/02/01/97294.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/97294.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/02/01/97294.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/97294.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/97294.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/02/01/97294.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/97294.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-02-01 15:42 <a href="http://www.blogjava.net/beansoft/archive/2007/02/01/97294.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AJAX IM - PHP 的 AJAX 聊天工具(可运行于Resin3下)</title><link>http://www.blogjava.net/beansoft/archive/2007/01/23/95600.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 23 Jan 2007 12:24:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/01/23/95600.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/95600.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/01/23/95600.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/95600.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/95600.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: ajaxim_v30.zip 297KB<br>国外的人用 PHP 编写的, 可以运行在 Resin 3 下. 官方站点: http://www.unwieldy.net/ajaxim/ . 这文件是原封不动下载下来的. 缺点: 不支持汉字和特殊字符的发送, 添加好友后第二次无法登录(也许是我 Resin 下跑的 bug?).&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/01/23/95600.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/95600.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-01-23 20:24 <a href="http://www.blogjava.net/beansoft/archive/2007/01/23/95600.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个基于文件的 Cache Filter(含源码)</title><link>http://www.blogjava.net/beansoft/archive/2007/01/23/95483.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Tue, 23 Jan 2007 03:04:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/01/23/95483.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/95483.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/01/23/95483.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/95483.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/95483.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 这个过滤器可以预先将 JSP 文件解析的结果缓存到文件中, 这样第一次读取的时候需要 JSP 服务器的解析, 第二次以后就可以从文件读取了. &nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/01/23/95483.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/95483.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-01-23 11:04 <a href="http://www.blogjava.net/beansoft/archive/2007/01/23/95483.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JS日期选择器</title><link>http://www.blogjava.net/beansoft/archive/2007/01/18/94578.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Thu, 18 Jan 2007 02:43:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/01/18/94578.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/94578.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/01/18/94578.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/94578.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/94578.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 这是2003年时候参加工作不久从网上找的一个东西, 用来提交表单的时候选择日期范围, 可以设置多个. 原作者未知, 我稍有改动, 就是加入了两个图片.&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/01/18/94578.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/94578.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-01-18 10:43 <a href="http://www.blogjava.net/beansoft/archive/2007/01/18/94578.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Lightbox,灯笼?</title><link>http://www.blogjava.net/beansoft/archive/2007/01/15/94027.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Mon, 15 Jan 2007 12:15:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/01/15/94027.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/94027.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/01/15/94027.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/94027.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/94027.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: Lightbox,灯笼?<br><br>2007-01-15<br><br>其实这不算一个 AJAX 的内容, 不过原始站点的是: Lightbox JS v2.0 http://www.huddletogether.com/projects/lightbox2/ 详情您可以自己去看, 是加载图片的.&nbsp;&nbsp;<a href='http://www.blogjava.net/beansoft/archive/2007/01/15/94027.html'>阅读全文</a><img src ="http://www.blogjava.net/beansoft/aggbug/94027.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-01-15 20:15 <a href="http://www.blogjava.net/beansoft/archive/2007/01/15/94027.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>推荐一个国内的AJAX Demo 站点: http://www.tangtang8.com/ahax/</title><link>http://www.blogjava.net/beansoft/archive/2007/01/05/91990.html</link><dc:creator>BeanSoft</dc:creator><author>BeanSoft</author><pubDate>Fri, 05 Jan 2007 06:28:00 GMT</pubDate><guid>http://www.blogjava.net/beansoft/archive/2007/01/05/91990.html</guid><wfw:comment>http://www.blogjava.net/beansoft/comments/91990.html</wfw:comment><comments>http://www.blogjava.net/beansoft/archive/2007/01/05/91990.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/beansoft/comments/commentRss/91990.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/beansoft/services/trackbacks/91990.html</trackback:ping><description><![CDATA[例子比较实用, 文件也比较小, 虽然后台是 PHP 的, 但是比较易懂, 便于修改.<br /><br /><div class="menu" id="menus"><a href="http://www.tangtang8.com/ahax/bingo.rar">下载 V 0.1.5 (4K,2006.11.17)</a>  |    <a href="http://www.tangtang8.com/post/f.php?bar=ajax" target="_blank">社区</a>    |    <a href="http://www.tangtang8.com/ahax/feedback.php"></a></div><fieldset id="DEMO"><legend>常用DEMO</legend><p><a href="http://www.tangtang8.com/ahax/phpdemo/demo1_getnewslist.htm" target="_blank">获取新闻列表</a> | <a href="http://www.tangtang8.com/ahax/phpdemo/demo2_login.htm" target="_blank">登录</a> | <a href="http://www.tangtang8.com/ahax/phpdemo/demo3_postmsg.htm" target="_blank">提交信息</a> | <a href="http://www.tangtang8.com/ahax/phpdemo/demo4_json.htm" target="_blank">读取JSON</a> | <a href="http://www.tangtang8.com/ahax/phpdemo/demo5_pages.html" target="_blank">分页列表(bingo+json)</a> | <a href="http://www.tangtang8.com/ahax/phpdemo/demo6_selects.htm" target="_blank">SELECT无限联动</a> | TREE | 选取查询 | 像册(无限播放) | <a href="http://www.tangtang8.com/ahax/phpdemo/demo10_langtsp.html" target="_blank">多语言切换</a> | <a href="http://www.tangtang8.com/ahax/phpdemo/demo12_inputtips.html" target="_blank">查询下拉提示</a> | <a href="http://www.tangtang8.com/ahax/phpdemo/demo13_tagsBall.html" target="_blank">标签浮动提示(仿网易新闻显示)</a></p><p align="right"><a href="http://www.tangtang8.com/post/s.php?kz=4812&amp;bar=ajax" target="_blank"></a></p></fieldset><div id="notice">原<strong>AHAX</strong>改名为<strong>BINGO</strong>，相关内容也有局部调整，请下载最新的版本，另外AJAXCALL和AJAXFORM两个函授全部改为大写，请注意！</div><div id="ajaxcall"><div class="titles">AJAXCALL</div><p><input onclick="test1()" type="button" value="测试一" name="Submit" /><span id="testspan1"></span><br />测试一是用GET请求并返回一个HTML文档(当前时间)<br /><input onclick="test2()" type="button" value="测试二" name="Submit2" /><br />测试二是用POST请求并返回一个XML，并获取TAG RETCODE的值(-200) </p><p><strong>语法：</strong><span class="STYLE14">AJAXCALL(url,handleResponse,param)</span>; 将url返回的数据交给handleResponse(doc)处理<br /><strong>参数：</strong>url：请求的地址；handleResponse：回调函数，doc 为AJAX返回的文档；param：附加参数（isCache：是否需要缓存，默认不缓存；isXML：是否返回XML文档，默认HTML；method：发送方式，默认GET）<br /><strong>例子：<br /></strong><span class="STYLE11">AJAXCALL</span><span class="STYLE5">("</span><span class="STYLE9">gaogao.xml</span><span class="STYLE5">","</span><span class="STYLE9">yoyo2</span><span class="STYLE5">","</span><span class="STYLE9">method=POST ,isXML=true ,isCache=false</span><span class="STYLE5">");</span><br /><span class="STYLE7">A<span class="STYLE11">JAXCALL</span>l</span><span class="STYLE5">("</span><span class="STYLE9">getnews?pid=23412</span><span class="STYLE5">","</span><span class="STYLE9">shownews</span><span class="STYLE5">");</span><br /><strong>备注：</strong><br />如果POST数据，请将数据编码后加在URL后，例如：<br /><span class="STYLE7">A<span class="STYLE11">JAXCALL</span></span><span class="STYLE5">("<span class="STYLE9">gaogao.php?name=</span>"+</span><span class="STYLE7">$U</span><span class="STYLE5">('</span><span class="STYLE9">哟哟</span><span class="STYLE5">')+"</span><span class="STYLE9">&amp;sex</span><span class="STYLE3"><span class="STYLE2">=</span><span class="STYLE5">"+</span><span class="STYLE7">$U</span><span class="STYLE5">('</span><span class="STYLE9">male</span><span class="STYLE5">'),"</span></span><span class="STYLE9">yoyo2</span><span class="STYLE5">","</span><span class="STYLE9">method=POST</span><span class="STYLE5">")</span></p></div><hr style="COLOR: rgb(255,255,255)" width="85%" size="1" /><div id="ajaxform"><div class="titles">AJAXFORM</div><form id="form1" name="form1" onsubmit="test3('form1');return false;" action="ahaxtest2.php" method="post"><label>用户名 <input id="user" value="测试一下" name="user" /></label><label>密码 <input id="passwd" type="password" value="123456" name="passwd" /></label><input id="sub" type="submit" value="测试三" name="sub" /></form><p><strong>语法：</strong><span class="STYLE14">AJAXFORM(formID,handleResponse,param)</span>; 将表单数据用AJAX POST出去<br /><strong>参数：</strong> formID：表单的ID；handleResponse：回调函数，doc 为AJAX返回文档；param：附加参数（isXML：是否返回XML文档，默认HTML；与AjaxCall不同，AJAXForm只有isXML一个附加参数）<br /><strong>例子：</strong><br /><span class="STYLE3">&lt;form id=</span><span class="STYLE5">"form1"</span><span class="STYLE3"> name=</span><span class="STYLE5">"form1"</span><span class="STYLE3"> method=</span><span class="STYLE5">"post"</span><span class="STYLE3"> action=</span><span class="STYLE5">"ahaxtest2.php"</span><span class="STYLE3"> onsubmit=</span><span class="STYLE5">"test3('form1');return false;"</span><span class="STYLE3">&gt;<br />......................<br /></span><span class="STYLE7">function</span><span class="STYLE12">test3</span><span class="STYLE3"><span class="STYLE13">(</span></span><span class="STYLE12">postform</span><span class="STYLE13">){</span><span class="STYLE3"><br /></span><span class="STYLE12">    AJAXFORM</span><span class="STYLE13">(</span><span class="STYLE12">postform</span><span class="STYLE13">,"</span><span class="STYLE9">yoyo3</span><span class="STYLE13">");<br />}</span><br /><strong>备注：</strong>数据会被escape编码，提交处理页面提供了PHP解码程序</p></div><hr style="COLOR: rgb(255,255,255)" width="85%" size="1" /><div id="extra"><div class="titles">附加功能</div><p><span class="STYLE7">$('div')</span> 等同于 document.getElementById('div')</p><p><span class="STYLE7">$F('div') </span>等同于 document.getElementById('div').value</p><p><span class="STYLE7">getTagValue(XMLDoc ,Tag )</span> 获取XML文档指定TAG的第一次出现的值</p><p><span class="STYLE7">$U(str)</span> 等同于encodeURIComponent(escape(str)</p></div><img src ="http://www.blogjava.net/beansoft/aggbug/91990.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/beansoft/" target="_blank">BeanSoft</a> 2007-01-05 14:28 <a href="http://www.blogjava.net/beansoft/archive/2007/01/05/91990.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>