﻿<?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-每日一得-随笔分类-web技术</title><link>http://www.blogjava.net/alex/category/8018.html</link><description>不求多得,只求一得
about java,hibernate,spring,design,database,Ror,ruby,快速开发&lt;br/&gt;
最近关心的内容:Jboss Seam框架，JSF,EJB3 &lt;br/&gt;
本站的官方站点是:&lt;a href="www.foxlog.org"&gt;www.foxlog.org&lt;/a&gt;
</description><language>zh-cn</language><lastBuildDate>Sat, 01 Sep 2007 05:43:10 GMT</lastBuildDate><pubDate>Sat, 01 Sep 2007 05:43:10 GMT</pubDate><ttl>60</ttl><item><title>java框架库：选一款适合你的武器行走江湖</title><link>http://www.blogjava.net/alex/archive/2007/09/01/141902.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Sat, 01 Sep 2007 04:42:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2007/09/01/141902.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/141902.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2007/09/01/141902.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/141902.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/141902.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 很多东西是拿来被利用的，被 Fuck的，不是让你消磨时间的.&nbsp;&nbsp;<a href='http://www.blogjava.net/alex/archive/2007/09/01/141902.html'>阅读全文</a><img src ="http://www.blogjava.net/alex/aggbug/141902.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2007-09-01 12:42 <a href="http://www.blogjava.net/alex/archive/2007/09/01/141902.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>WEB开发流程(步骤)</title><link>http://www.blogjava.net/alex/archive/2007/06/13/123899.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Wed, 13 Jun 2007 08:43:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2007/06/13/123899.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/123899.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2007/06/13/123899.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/123899.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/123899.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/alex/archive/2007/06/13/123899.html'>阅读全文</a><img src ="http://www.blogjava.net/alex/aggbug/123899.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2007-06-13 16:43 <a href="http://www.blogjava.net/alex/archive/2007/06/13/123899.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[zt]Response.ContentType 详细列表</title><link>http://www.blogjava.net/alex/archive/2007/03/29/107125.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Thu, 29 Mar 2007 01:25:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2007/03/29/107125.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/107125.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2007/03/29/107125.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/107125.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/107125.html</trackback:ping><description><![CDATA[key words: contentType,meta<br /><br />come from <a href="http://warran.blueidea.com/archives/2007/4507.shtml">here</a><br /><br /><br /><table cellspacing="0" cellpadding="0" width="100%" border="0"><tbody><tr><td><p><a href="http://bbs.blueidea.com/thread-2729935-1-1.html"></a> </p></td></tr></tbody></table><p>在经典同时看到两个关于ContentType的问题</p><p><a href="http://bbs.blueidea.com/thread-2729935-1-1.html">http://bbs.blueidea.com/thread-2729935-1-1.html</a></p><p><a href="http://bbs.blueidea.com/thread-2729945-1-1.html">http://bbs.blueidea.com/thread-2729945-1-1.html</a></p><p>所以查了下资料,copy了一份详细的ContentType的列表</p><p> </p><p>不同的ContentType 会影响客户端所看到的效果.</p><p>默认的ContentType为 text/html  也就是网页格式.</p><p>代码如:</p><p>&lt;% response.ContentType =<b>"text/html"</b> %&gt;  <br />&lt;!--＃i nclude virtual="/<a href="http://www.asptutorial.info/sscript/ContentType.html" target="new">ContentType.html</a>" --&gt;</p><p>显示的为网页,而</p><p>&lt;% response.ContentType =<b>"text/plain"</b> %&gt;  <br />&lt;!--＃i nclude virtual="/sscript/<a href="http://www.asptutorial.info/sscript/ContentType.html">ContentType.html</a>" --&gt;</p><p>则会显示html原代码.</p><p>以下为一些常用的 ContentType</p><p></p><table border="1"><tbody><tr><td bgcolor="#d9d9ff" colspan="2">GIF images</td></tr><tr><td valign="top">&lt;% response.ContentType ="image/gif" %&gt;  <br />&lt;!--＃i nclude virtual="/myimage.gif" --&gt;</td></tr><tr><td bgcolor="#d9d9ff" colspan="2">JPEG images</td></tr><tr><td>&lt;% response.ContentType ="image/jpeg" %&gt;  <br />&lt;!--＃i nclude virtual="/myimage.jpeg" --&gt;</td></tr><tr><td bgcolor="#d9d9ff" colspan="2">TIFF images</td></tr><tr><td valign="top">&lt;% response.ContentType ="image/tiff" %&gt;  <br />&lt;!--＃i nclude virtual="/myimage.tiff" --&gt;</td></tr><tr><td bgcolor="#d9d9ff" colspan="2">MICROSOFT WORD document</td></tr><tr><td valign="top">&lt;% response.ContentType ="application/msword" %&gt;  <br />&lt;!--＃i nclude virtual="/myfile.doc" --&gt;</td></tr><tr><td bgcolor="#d9d9ff" colspan="2">RTF document</td></tr><tr><td>&lt;% response.ContentType ="application/rtf" %&gt;  <br />&lt;!--＃i nclude virtual="/myfile.rtf" --&gt;</td></tr><tr><td bgcolor="#d9d9ff" colspan="2">MICROSOFT EXCEL document</td></tr><tr><td valign="top">&lt;% response.ContentType ="application/x-excel" %&gt;  <br />&lt;!--＃i nclude virtual="/myfile.xls" --&gt;</td></tr><tr><td bgcolor="#d9d9ff" colspan="2">MICROSOFT POWERPOINT document</td></tr><tr><td>&lt;% response.ContentType ="application/ms-powerpoint" %&gt;  <br />&lt;!--＃i nclude virtual="/myfile.pff" --&gt;</td></tr><tr><td bgcolor="#d9d9ff" colspan="2">PDF document</td></tr><tr><td>&lt;% response.ContentType ="application/pdf" %&gt;  <br />&lt;!--＃i nclude virtual="/myfile.pdf" --&gt;</td></tr><tr><td bgcolor="#d9d9ff" colspan="2">ZIP document</td></tr><tr><td>&lt;% response.ContentType ="application/zip" %&gt;  <br />&lt;!--＃i nclude virtual="/myfile.zip" --&gt;</td></tr></tbody></table><p> </p><p>下面是更详细的ContentType</p><p></p><table><tbody><tr><td>application/andrew-inset</td><td>ez </td></tr><tr><td>application/mac-binhex40</td><td>hqx </td></tr><tr><td>application/mac-compactpro</td><td>cpt </td></tr><tr><td>application/mathml+xml</td><td>mathml </td></tr><tr><td>application/msword</td><td>doc </td></tr><tr><td>application/octet-stream</td><td>bin dms lha lzh exe class so dll </td></tr><tr><td>application/oda</td><td>oda </td></tr><tr><td>application/ogg</td><td>ogg </td></tr><tr><td>application/pdf</td><td>pdf </td></tr><tr><td>application/postscript</td><td>ai eps ps </td></tr><tr><td>application/rdf+xml</td><td>rdf </td></tr><tr><td>application/smil</td><td>smi smil </td></tr><tr><td>application/srgs</td><td>gram </td></tr><tr><td>application/srgs+xml</td><td>grxml </td></tr><tr><td>application/vnd.mif</td><td>mif </td></tr><tr><td>application/vnd.mozilla.xul+xml</td><td>xul </td></tr><tr><td>application/vnd.ms-excel</td><td>xls </td></tr><tr><td>application/vnd.ms-powerpoint</td><td>ppt </td></tr><tr><td>application/vnd.wap.wbxml</td><td>wbxml </td></tr><tr><td>application/vnd.wap.wmlc</td><td>.wmlc wmlc </td></tr><tr><td>application/vnd.wap.wmlscriptc</td><td>.wmlsc wmlsc </td></tr><tr><td>application/voicexml+xml</td><td>vxml </td></tr><tr><td>application/x-bcpio</td><td>bcpio </td></tr><tr><td>application/x-cdlink</td><td>vcd </td></tr><tr><td>application/x-chess-pgn</td><td>pgn </td></tr><tr><td>application/x-cpio</td><td>cpio </td></tr><tr><td>application/x-csh</td><td>csh </td></tr><tr><td>application/x-director</td><td>dcr dir dxr </td></tr><tr><td>application/x-dvi</td><td>dvi </td></tr><tr><td>application/x-futuresplash</td><td>spl </td></tr><tr><td>application/x-gtar</td><td>gtar </td></tr><tr><td>application/x-hdf</td><td>hdf </td></tr><tr><td>application/x-httpd-php</td><td>.php .php4 .php3 .phtml </td></tr><tr><td>application/x-httpd-php-source</td><td>.phps </td></tr><tr><td>application/x-javascript</td><td>js </td></tr><tr><td>application/x-koan</td><td>skp skd skt skm </td></tr><tr><td>application/x-latex</td><td>latex </td></tr><tr><td>application/x-netcdf</td><td>nc cdf </td></tr><tr><td>application/x-pkcs7-crl</td><td>.crl </td></tr><tr><td>application/x-sh</td><td>sh </td></tr><tr><td>application/x-shar</td><td>shar </td></tr><tr><td>application/x-shockwave-flash</td><td>swf </td></tr><tr><td>application/x-stuffit</td><td>sit </td></tr><tr><td>application/x-sv4cpio</td><td>sv4cpio </td></tr><tr><td>application/x-sv4crc</td><td>sv4crc </td></tr><tr><td>application/x-tar</td><td>.tgz tar </td></tr><tr><td>application/x-tcl</td><td>tcl </td></tr><tr><td>application/x-tex</td><td>tex </td></tr><tr><td>application/x-texinfo</td><td>texinfo texi </td></tr><tr><td>application/x-troff</td><td>t tr roff </td></tr><tr><td>application/x-troff-man</td><td>man </td></tr><tr><td>application/x-troff-me</td><td>me </td></tr><tr><td>application/x-troff-ms</td><td>ms </td></tr><tr><td>application/x-ustar</td><td>ustar </td></tr><tr><td>application/x-wais-source</td><td>src </td></tr><tr><td>application/x-x509-ca-cert</td><td>.crt </td></tr><tr><td>application/xhtml+xml</td><td>xhtml xht </td></tr><tr><td>application/xml</td><td>xml xsl </td></tr><tr><td>application/xml-dtd</td><td>dtd </td></tr><tr><td>application/xslt+xml</td><td>xslt </td></tr><tr><td>application/zip</td><td>zip </td></tr><tr><td>audio/basic</td><td>au snd </td></tr><tr><td>audio/midi</td><td>mid midi kar </td></tr><tr><td>audio/mpeg</td><td>mpga mp2 mp3 </td></tr><tr><td>audio/x-aiff</td><td>aif aiff aifc </td></tr><tr><td>audio/x-mpegurl</td><td>m3u </td></tr><tr><td>audio/x-pn-realaudio</td><td>ram rm </td></tr><tr><td>audio/x-pn-realaudio-plugin</td><td>rpm </td></tr><tr><td>audio/x-realaudio</td><td>ra </td></tr><tr><td>audio/x-wav</td><td>wav </td></tr><tr><td>chemical/x-pdb</td><td>pdb </td></tr><tr><td>chemical/x-xyz</td><td>xyz </td></tr><tr><td>image/bmp</td><td>bmp </td></tr><tr><td>image/cgm</td><td>cgm </td></tr><tr><td>image/gif</td><td>gif </td></tr><tr><td>image/ief</td><td>ief </td></tr><tr><td>image/jpeg</td><td>jpeg jpg jpe </td></tr><tr><td>image/png</td><td>png </td></tr><tr><td>image/svg+xml</td><td>svg </td></tr><tr><td>image/tiff</td><td>tiff tif </td></tr><tr><td>image/vnd.djvu</td><td>djvu djv </td></tr><tr><td>image/vnd.wap.wbmp</td><td>.wbmp wbmp </td></tr><tr><td>image/x-cmu-raster</td><td>ras </td></tr><tr><td>image/x-icon</td><td>ico </td></tr><tr><td>image/x-portable-anymap</td><td>pnm </td></tr><tr><td>image/x-portable-bitmap</td><td>pbm </td></tr><tr><td>image/x-portable-graymap</td><td>pgm </td></tr><tr><td>image/x-portable-pixmap</td><td>ppm </td></tr><tr><td>image/x-rgb</td><td>rgb </td></tr><tr><td>image/x-xbitmap</td><td>xbm </td></tr><tr><td>image/x-xpixmap</td><td>xpm </td></tr><tr><td>image/x-xwindowdump</td><td>xwd </td></tr><tr><td>model/iges</td><td>igs iges </td></tr><tr><td>model/mesh</td><td>msh mesh silo </td></tr><tr><td>model/vrml</td><td>wrl vrml </td></tr><tr><td>text/calendar</td><td>ics ifb </td></tr><tr><td>text/css</td><td>css </td></tr><tr><td>text/html</td><td>.shtml html htm </td></tr><tr><td>text/plain</td><td>asc txt </td></tr><tr><td>text/richtext</td><td>rtx </td></tr><tr><td>text/rtf</td><td>rtf </td></tr><tr><td>text/sgml</td><td>sgml sgm </td></tr><tr><td>text/tab-separated-values</td><td>tsv </td></tr><tr><td>text/vnd.wap.wml</td><td>.wml wml </td></tr><tr><td>text/vnd.wap.wmlscript</td><td>.wmls wmls </td></tr><tr><td>text/x-setext</td><td>etx </td></tr><tr><td>video/mpeg</td><td>mpeg mpg mpe </td></tr><tr><td>video/quicktime</td><td>qt mov </td></tr><tr><td>video/vnd.mpegurl</td><td>mxu </td></tr><tr><td>video/x-msvideo</td><td>avi </td></tr><tr><td>video/x-sgi-movie</td><td>movie </td></tr><tr><td>x-conference/x-cooltalk</td><td>ice</td></tr></tbody></table><img src ="http://www.blogjava.net/alex/aggbug/107125.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2007-03-29 09:25 <a href="http://www.blogjava.net/alex/archive/2007/03/29/107125.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[zt]用JSP实现上传文件的两种方法</title><link>http://www.blogjava.net/alex/archive/2007/03/26/106538.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Mon, 26 Mar 2007 14:18:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2007/03/26/106538.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/106538.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2007/03/26/106538.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/106538.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/106538.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/alex/archive/2007/03/26/106538.html'>阅读全文</a><img src ="http://www.blogjava.net/alex/aggbug/106538.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2007-03-26 22:18 <a href="http://www.blogjava.net/alex/archive/2007/03/26/106538.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jsp防盗链</title><link>http://www.blogjava.net/alex/archive/2007/03/13/103458.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Tue, 13 Mar 2007 02:01:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2007/03/13/103458.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/103458.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2007/03/13/103458.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/103458.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/103458.html</trackback:ping><description><![CDATA[key words : jsp防盗链 header<br /><br />最近碰到盗链的问题，即复制一个url地址，在另一个地方也能访问。<br /><br />index.jsp页面<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Simple jsp page</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Place your content here<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  here is index jsp<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    get header info<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">a </span><span style="COLOR: #ff0000">href</span><span style="COLOR: #0000ff">="a.jsp"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">a.jsp</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">a</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div><br />a.jsp页面<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Simple jsp page</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Place your content here<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  here is a. jsp<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    get header info<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">request.getHeader(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Referer</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">)</span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img id="Codehighlighter1_163_265_Open_Image" onclick="this.style.display='none'; Codehighlighter1_163_265_Open_Text.style.display='none'; Codehighlighter1_163_265_Closed_Image.style.display='inline'; Codehighlighter1_163_265_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_163_265_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_163_265_Closed_Text.style.display='none'; Codehighlighter1_163_265_Open_Image.style.display='inline'; Codehighlighter1_163_265_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />  </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_163_265_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_163_265_Open_Text"><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">null</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">==</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> request.getHeader(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Referer</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">) || request.getHeader(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Referer</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">).indexOf(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">yourdomain.com</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">) </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">&lt;</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">0</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">){</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />     做人要厚道<br /><img id="Codehighlighter1_283_288_Open_Image" onclick="this.style.display='none'; Codehighlighter1_283_288_Open_Text.style.display='none'; Codehighlighter1_283_288_Closed_Image.style.display='inline'; Codehighlighter1_283_288_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_283_288_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_283_288_Closed_Text.style.display='none'; Codehighlighter1_283_288_Open_Image.style.display='inline'; Codehighlighter1_283_288_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />  </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span id="Codehighlighter1_283_288_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_283_288_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">}</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">else</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">{</span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  合法访问<br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">}</span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />  </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div><br /><br />即从内部访问可以，直接粘贴地址在另一个浏览器里访问禁止<img src ="http://www.blogjava.net/alex/aggbug/103458.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2007-03-13 10:01 <a href="http://www.blogjava.net/alex/archive/2007/03/13/103458.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[讨论]上传文件放在哪里比较合适?</title><link>http://www.blogjava.net/alex/archive/2007/01/31/96831.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Wed, 31 Jan 2007 01:06:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2007/01/31/96831.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/96831.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2007/01/31/96831.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/96831.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/96831.html</trackback:ping><description><![CDATA[key words: 上传文件<br><br><em><font color=#800080>目里面有上传文件的需求,我想了一下不外乎下面两种处理方法: </font></em>
<p><em><font color=#800080>1. 在数据库表中建立一个blob字段存放用户上传文件. <br>2. 在服务器上建立一个文件夹保存用户上传文件,数据库表中只存放该文<wbr>件的url地址.</wbr></font></em></p>
<p><em><font color=#800080>我本人现在比较倾向于第2种方案, 主要原因是担心方案1的效率（我用的是mysql数据库）。 但是处理过程中除了维护数据库中表的字段还要维护上传的文件<wbr>,稍微麻烦一点。</wbr></font></em></p>
<p><em><font color=#800080>大家在项目里面又是怎么做呢？ 给我点建议！谢谢</font></em></p>
<br>讨论内容见: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.javaeye.com/topic/18515?page=1" target=_blank>javaeye</a><br><br>robin更建议第二种方案，放在数据库中主要的问题是 AppServer吃不消，开销比较大.<br><br>上面是摘录，不过我们这里用的是Oracle9i AS,在Oracle的协作套间里一般文档或者上传的文件都是保存在数据库里，还把这个特性作为Oracle 与别的协作套件之间不同的卖点。<br><br>大家以为如何? 我直觉是Oracle的DB和oc4j的AppServer对付这个似乎没有开销上的担心，但是没有实际检测过。 <br><br>换句话说，文件的管理是放在文件夹里方便还是数据库里方便? 有点为难 <br><br>update (2007-5-13):<br><span style="COLOR: #0000ff">还有一种方案结合了数据库和IO，我认为比较可行，就是文件存在数据库，但是下载的时候第一次从数据库下载，然后第一次这个文件保存在一个临时文件夹下面，以后每次下载的时候总是先检查此临时文件夹，如果已经存在则直接下载，如果没有则从数据库重复这个动作。当然，保存在临时文件夹下的文件的命名需要唯一，这个应该没有问题。</span>
<img src ="http://www.blogjava.net/alex/aggbug/96831.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2007-01-31 09:06 <a href="http://www.blogjava.net/alex/archive/2007/01/31/96831.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>web快速开发相关技术和产品</title><link>http://www.blogjava.net/alex/archive/2007/01/20/95088.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Sat, 20 Jan 2007 14:56:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2007/01/20/95088.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/95088.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2007/01/20/95088.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/95088.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/95088.html</trackback:ping><description><![CDATA[key words : web快速开发<br /><br />web快速开发是一个值得期待的东西，最早我接触过<span style="FONT-WEIGHT: bold">codecharge</span>,是一个商业软件，功能据说很强大，我试用过，支持php<wbr>,asp,jsp等多语言，但是感觉对java的支持不是很顺手<wbr>，接着就是asp,这个好也不好，原因就不说了，因为我对java<wbr>关注。<br /><br />2. 接着就是<span style="FONT-WEIGHT: bold">dorado</span> ,刚看到的，感觉也不错,有asp的风格，不过更适合j2ee的环<wbr>境 ,<a href="http://61.151.239.187/dorado5/main.jsp" target="_blank">这里</a>是他们的在线演示demo,有兴趣的可以看一下<br /><br />3. 最后，刚google了一下，Oracle也有一个基于Oracl<wbr>e数据库的快速开发产品  : <span style="FONT-WEIGHT: bold">APEX</span>,基于浏览器做DB 开发,原来的名字叫做HTML DB,名字很直观，据说Oracle的metalink就是用这个实现的，应该功能不赖。<br /><br />4.对了，再补充一个现在很热的，Ror,听说javaeye的网站要重新用ruby1.2开发，试用过一点，感觉确实令人震惊，值得关注。<br /><br />java的技术其实是看着很热闹，比较大的东西也不少，但是真正关注web这一块的其实不多，无论是struts还是webwork,离我们所说的真正的“快速开发”的距离很远，而以上一些工具的出现也许会逐步改善j2ee在这一领域的现状。<br /><br />我之所以对这个目前有点兴趣，确实有一种强烈的反差在折磨着我，因为我相信在j2ee的web开发里确实存在本来要开发1周多的工作量很可能用一个好的工具几个小时就搞定了，这是一件多么荒唐搞笑的事情？如果dorado在它的产品中真的能做到这样那我们的java开发那么坑吃坑吃的折腾个什么劲啊? 也许真的有奇迹，我宁愿相信有这样的奇迹。<br /><br />大家有什么好的想法可以讨论一下。<br /></wbr></wbr></wbr></wbr></wbr><img src ="http://www.blogjava.net/alex/aggbug/95088.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2007-01-20 22:56 <a href="http://www.blogjava.net/alex/archive/2007/01/20/95088.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[zt]注册com组件</title><link>http://www.blogjava.net/alex/archive/2006/12/20/89046.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Wed, 20 Dec 2006 07:13:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/12/20/89046.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/89046.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/12/20/89046.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/89046.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/89046.html</trackback:ping><description><![CDATA[key words: dll,ocx,注册控件<br /><br />最近项目中用到了收银，需要在顾显上显示金额.<br /><br /><br />1.将.dll、.ocx等考到system32下。<br />2.用命令注册regsvr32.exe  .dll。(eg:regsvr32.exe  OWC11.dll)<br />3.在注册表中查看：利用名称或与其唯一对应的clsid("clsid:0002E55D-0000-0000-C000-   000000000046")可查找到相关信息<img src ="http://www.blogjava.net/alex/aggbug/89046.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-12-20 15:13 <a href="http://www.blogjava.net/alex/archive/2006/12/20/89046.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>workshop studio震撼你的开发效率 [bea world2006 归来,谈感受，发牢骚]</title><link>http://www.blogjava.net/alex/archive/2006/12/20/89003.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Wed, 20 Dec 2006 03:39:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/12/20/89003.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/89003.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/12/20/89003.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/89003.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/89003.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: key words: bea world2006  ,workshop studio, 快速开发<br><br>bea world 2006 北京已经过去好几天了，早就想记录一下一直忙  :)<br>&nbsp;&nbsp;<a href='http://www.blogjava.net/alex/archive/2006/12/20/89003.html'>阅读全文</a><img src ="http://www.blogjava.net/alex/aggbug/89003.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-12-20 11:39 <a href="http://www.blogjava.net/alex/archive/2006/12/20/89003.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jstl标签注意问题</title><link>http://www.blogjava.net/alex/archive/2006/12/11/86986.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Mon, 11 Dec 2006 11:21:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/12/11/86986.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/86986.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/12/11/86986.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/86986.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/86986.html</trackback:ping><description><![CDATA[key words: jsp,jstl,1.0,1.1,fn函数<br /><br />原来一直用struts,最近项目里有人用jstl,我也就顺便拿来用，感觉还是不错。<br /><br />过程中碰到一些小的问题总结如下:<br /><br />一。版本问题<br />jstl存在1.0和1.1的差异问题，用EL建议需要在1.1的版本下，1.1的URI的标志为: <br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 0);">@ taglib uri</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">http://java.sun.com/jsp/jstl/core</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> prefix</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">c</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 0);">@ taglib uri</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">http://java.sun.com/jsp/jstl/functions</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> prefix</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">fn</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">%&gt;</span></div><br />注意，1.0版本没有/jsp/.<br /><br />如果用的1.0会出现如下异常<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">org.apache.jasper.JasperException: </span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">left_tree.jsp(</span><span style="color: rgb(0, 0, 0);">100</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">24</span><span style="color: rgb(0, 0, 0);">) According to TLD or attribute directive in tag file, attribute items does not accept any expressions<br />    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:</span><span style="color: rgb(0, 0, 0);">510</span><span style="color: rgb(0, 0, 0);">)<br />    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:</span><span style="color: rgb(0, 0, 0);">375</span><span style="color: rgb(0, 0, 0);">)<br />    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:</span><span style="color: rgb(0, 0, 0);">314</span><span style="color: rgb(0, 0, 0);">)<br />    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:</span><span style="color: rgb(0, 0, 0);">264</span><span style="color: rgb(0, 0, 0);">)<br />    javax.servlet.http.HttpServlet.service(HttpServlet.java:</span><span style="color: rgb(0, 0, 0);">802</span><span style="color: rgb(0, 0, 0);">)<br />    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:</span><span style="color: rgb(0, 0, 0);">75</span><span style="color: rgb(0, 0, 0);">)<br />    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:</span><span style="color: rgb(0, 0, 0);">77</span><span style="color: rgb(0, 0, 0);">)<br />    com.wellsoon.zfzw.webapp.common.VabAccessFilter.doFilter(VabAccessFilter.java:</span><span style="color: rgb(0, 0, 0);">43</span><span style="color: rgb(0, 0, 0);">)<br /><br /><br />root cause <br /><br /></span></div><br /><br />二。打开ＥＬ<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 0);">@ page contentType</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">text/html;charset=gb2312</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> language</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">java</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> isELIgnored</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">false</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">%&gt;</span></div><br />前提是容器支持２．０，即使支持默认也未必打开，最安全的方式就是显示打开 <span style="color: rgb(0, 0, 0);">isELIgnored</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">false</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);"><br /><br />三.fn的用法<br />对于Vo里的一个List作length的计算或判断很方便<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">table </span><span style="color: rgb(255, 0, 0);">width</span><span style="color: rgb(0, 0, 255);">="160"</span><span style="color: rgb(255, 0, 0);"> border</span><span style="color: rgb(0, 0, 255);">="0"</span><span style="color: rgb(255, 0, 0);"> cellspacing</span><span style="color: rgb(0, 0, 255);">="0"</span><span style="color: rgb(255, 0, 0);"> cellpadding</span><span style="color: rgb(0, 0, 255);">="4"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                        </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">c:forEach </span><span style="color: rgb(255, 0, 0);">items</span><span style="color: rgb(0, 0, 255);">="${menuInfos}"</span><span style="color: rgb(255, 0, 0);"> var</span><span style="color: rgb(0, 0, 255);">="m"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">c:if </span><span style="color: rgb(255, 0, 0);">test</span><span style="color: rgb(0, 0, 255);">="${fn:length(m.subMenus)&gt;0}"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                          </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">language</span><span style="color: rgb(0, 0, 255);">="JavaScript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />                                      </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> tObj </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> treeClass(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">A1</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">)<br />                                      tObj.start();<br />                                     tObj.m_start(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&lt;c:out value=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">${m.menuModule}</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">/&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">,</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">0</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br />                                    </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&lt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">c:forEach items</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">${m.subMenus}</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">sub</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />                                      tObj.add_Sub(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&lt;c:out value=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">${sub.menuName}</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">/&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">,</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&lt;%=path%&gt;<br />&lt;c:out value=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">${sub.url}</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">/&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">,</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">mymain</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br />                                    </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&lt;/</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">c:forEach</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />                                     tObj.m_end();<br />                                      tObj.end();<br />                                      tObj.print();<br />                                 </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                            </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                            </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">c:if</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                        </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">c:forEach</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br />                    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">table</span><span style="color: rgb(0, 0, 255);">&gt;</span></div> <br />四.tld的声明可以在web.xml作显式声明也可以用http作直接URL声明<br />推荐用本地的方式.<br /><br /></span><img src ="http://www.blogjava.net/alex/aggbug/86986.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-12-11 19:21 <a href="http://www.blogjava.net/alex/archive/2006/12/11/86986.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决response.sendRedirect("mypage.jsp")的问题</title><link>http://www.blogjava.net/alex/archive/2006/10/31/78244.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Tue, 31 Oct 2006 04:32:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/10/31/78244.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/78244.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/10/31/78244.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/78244.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/78244.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/alex/archive/2006/10/31/78244.html'>阅读全文</a><img src ="http://www.blogjava.net/alex/aggbug/78244.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-10-31 12:32 <a href="http://www.blogjava.net/alex/archive/2006/10/31/78244.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用js实现打印和导出为Excel</title><link>http://www.blogjava.net/alex/archive/2006/10/21/76526.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Sat, 21 Oct 2006 04:19:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/10/21/76526.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/76526.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/10/21/76526.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/76526.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/76526.html</trackback:ping><description><![CDATA[打印可以用控件实现，保存为excel也可以用POI实现，不过如果仅仅是对当前页面的指定区域作打印或者Excel导出可以用js实现，还是挺简单的.<br /><br />保存为Excel:<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> saveAsExcel(HeadName, DivName) {<br />            </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> s </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&lt;center&gt;</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> HeadName </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&lt;/center&gt;</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">\r\n</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />            s </span><span style="color: rgb(0, 0, 0);">+=</span><span style="color: rgb(0, 0, 0);"> DivName.innerHTML;<br />            </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> xlsWindow </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> window.open(</span><span style="color: rgb(0, 0, 0);">""</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">_blank</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">width=1,height=1,scrollbars=no,toolbar=no</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />            xlsWindow.document.write(s);<br />            xlsWindow.document.close();<br />            xlsWindow.document.execCommand('Saveas', </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">, '</span><span style="color: rgb(0, 0, 0);">%</span><span style="color: rgb(0, 0, 0);">homeDrive</span><span style="color: rgb(0, 0, 0);">%</span><span style="color: rgb(0, 0, 0);">\\Data.xls')<br />            xlsWindow.close();<br />        }</span></div><br /><br />打印当前页面:<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> PrintDataSoure(HeadName1,HeadName2,HeadName3,DivName,TailName1) {<br />  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> oldBody</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">document.body.innerHTML;<br />  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> Div1</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">DivName.innerHTML;<br />  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> css </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> '</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">style type</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">text/css</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> media</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">all</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  'p { line</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">height: </span><span style="color: rgb(0, 0, 0);">120</span><span style="color: rgb(0, 0, 0);">%</span><span style="color: rgb(0, 0, 0);">}' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  '.fhead {   font</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">size: 9pt; text</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">decoration: none; color: 104A7B}' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  '.ftitle { line</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">height: </span><span style="color: rgb(0, 0, 0);">120</span><span style="color: rgb(0, 0, 0);">%</span><span style="color: rgb(0, 0, 0);">; font</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">size: 18px; color: #</span><span style="color: rgb(0, 0, 0);">000000</span><span style="color: rgb(0, 0, 0);">}' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  'td { font</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">size: 10px; color: #</span><span style="color: rgb(0, 0, 0);">000000</span><span style="color: rgb(0, 0, 0);">}' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  '</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">style</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' ;<br /><br />  </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> body </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">table width</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">640</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> border</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> cellspacing</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> cellpadding</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">5</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">tr</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> ' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">td class</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">fbody</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">b</span><span style="color: rgb(0, 0, 0);">&gt;&lt;</span><span style="color: rgb(0, 0, 0);">div align</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">center</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">font size</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> class</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">fhead</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> HeadName1 </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> '</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">div</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">font</span><span style="color: rgb(0, 0, 0);">&gt;&lt;/</span><span style="color: rgb(0, 0, 0);">b</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">b</span><span style="color: rgb(0, 0, 0);">&gt;&lt;</span><span style="color: rgb(0, 0, 0);">div align</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">center</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">font size</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> class</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">fhead</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> HeadName2 </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> '     ' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> HeadName3 </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">div</span><span style="color: rgb(0, 0, 0);">&gt;&lt;/</span><span style="color: rgb(0, 0, 0);">font</span><span style="color: rgb(0, 0, 0);">&gt;&lt;/</span><span style="color: rgb(0, 0, 0);">b</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">td</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">tr</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">tr</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> ' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">td class</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">fbody</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">div align</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">center</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> class</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">ftitle</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> Div1 </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> '</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">div</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">b</span><span style="color: rgb(0, 0, 0);">&gt;&lt;</span><span style="color: rgb(0, 0, 0);">div align</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">right</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">font size</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> class</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">fhead</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> '      </span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">div</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">font</span><span style="color: rgb(0, 0, 0);">&gt;&lt;/</span><span style="color: rgb(0, 0, 0);">b</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">b</span><span style="color: rgb(0, 0, 0);">&gt;&lt;</span><span style="color: rgb(0, 0, 0);">div align</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">right</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">font size</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">+1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> class</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">fhead</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> TailName1 </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> '</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">div</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">font</span><span style="color: rgb(0, 0, 0);">&gt;&lt;/</span><span style="color: rgb(0, 0, 0);">b</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">td</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  ' </span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">tr</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"><br />  '</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">table</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">';<br />document.body.innerHTML </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> '</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">center</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> css </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> body </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">OBJECT classid</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">CLSID:8856F961-340A-11D0-A96B-00C04FD705A2</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> height</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);"> id</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">wb name</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">wb width</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">&gt;&lt;/</span><span style="color: rgb(0, 0, 0);">OBJECT</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">center</span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);">';<br />wb.execwb(</span><span style="color: rgb(0, 0, 0);">6</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">6</span><span style="color: rgb(0, 0, 0);">);<br />document.body.innerHTML</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">oldBody;<br />}</span></div><br /><br /><br /><br /><img src ="http://www.blogjava.net/alex/aggbug/76526.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-10-21 12:19 <a href="http://www.blogjava.net/alex/archive/2006/10/21/76526.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[zt]关于Cookie跨域操作遇到的问题及解决方法</title><link>http://www.blogjava.net/alex/archive/2006/09/18/70380.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Mon, 18 Sep 2006 12:59:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/09/18/70380.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/70380.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/09/18/70380.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/70380.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/70380.html</trackback:ping><description><![CDATA[
		<span style="font-weight: bold;">注:关于跨域登陆cookie的问题在网上搜索了一下，没看到有java下的示例，这个asp的也可以参照一下，有空再在java下测一下.<br /><br />key words:单点登陆 SSO 跨域cookie<br /><br /><br /></span>摘要：<b>当你有一个Cookie组（或叫Cookie字典）使用Domain属性指定域名之后，当你在对该组的成员进行修改或新增的时候，一定要在操
作之后加上Resonse.Cookies(CookieName).Domain属性。如果没有必要，请不要修改已设置Domain的Cookie组.</b><br />关键字：<br />正文：<br />    Cookie跨域操作看来是个简单的问题,因为只要指定Domain属性为指定网站的根域名就可以了.但是笔者在实际使用过程中却遇到了一些问题，的确值得注意. <p'> 　　环境介绍</p'><p'> 　　cookie在www主域名下创建，并写入Domain属性，如：(为方便调试以下代码皆为asp代码)</p'><p'> 　　Write.asp</p'><p'> &lt;%<br />Response.Cookies(CookieName)("UserName") = "SunBird"<br />Response.Cookies(CookieName)("Password") = "xyz1234"<br />Response.Cookies(CookieName).Domain = "xxxx.com"<br />%&gt;</p'><p'> 　　上面文件放在www主域名下，同时在同目录下放置一个读取cookie的Read.asp</p'><p'> 　　Read.asp</p'><p'> &lt;%<br />Response.Write Request.Cookies(CookieName)("UserName")<br />Response.Write Request.Cookies(CookieName)("Password")<br />%&gt;</p'><p'> 　　再放一个Read.asp文件到另外一个子域名站点里，代码同上。最后我们再做一个清除cookie的Clear.asp放在主域名下</p'><p'> 　　Clear.asp</p'><p'> &lt;%<br />Response.Cookies(CookieName)("UserName") = ""<br />Response.Cookies(CookieName)("Password") = ""<br />Response.Cookies(CookieName).Domain = "xxxx.com"<br />%&gt;</p'><p'>
　　现在可以通过下面的执行顺序来测试，Write.asp--&gt;主域名的Read.asp--&gt;子域名的Read.asp 所有
Read.asp页面都可以读取到Write.asp创建的cookie的值，然后再运行Clear.asp进行清除，一切都Ok，看上去没有什么问题。</p'><p'> 　　但是把这种方法运用到实际的站点时却出现问题了。</p'><p'> 　　问题描述：</p'><p'>
　　第一次登录一切ok，所有子域名都可以访问到主域名存储的cookie，但是，一旦退出之后，子域名的cookie被清除了，但是主域名的
cookie仍然保留着，强行清除主域名的cookie之后，无论怎样登录主域名下都无法保存cookie了，除非关掉浏览器重新打开。</p'><p'> 　　经过多次尝试之后，无意中发现问题所在，以下是测试经过。</p'><p'> 　　创建一个Write2.asp的页面放在主域名下</p'><p'> &lt;%<br />Response.Cookies(CookieName)("TEST_COOKIE") = "TEST_COOKIE"<br />%&gt;</p'><p'> 　　第一步：关闭浏览器后，按以下顺序执行，Write.asp--&gt;主域名的Read.asp--&gt;子域名的Read.asp 到这里所有Read.asp读取正常。</p'><p'> 　　第二步：Clear.asp--&gt;主域名的Read.asp--&gt;子域名的Read.asp 到这里清除操作是成功的。</p'><p'> 　　第三步：Write.asp--&gt; Write2.asp --&gt; 主域名Read.asp --&gt; 子域名Read.asp 到这里两个Read.asp都可以读取到cookie的值。</p'><p'> 　　第四步：重新执行第二步，发现主域名Read.asp仍然输出了值，而子域名下的Read.asp的值已经被清空了。</p'><p'> 　　根据以上测试总结以下几点再跨域使用cookie时需要注意的地方</p'><p'> 　　1、当你有一个Cookie组（或叫Cookie字典）使用Domain属性指定域名之后，当你在对该组的成员进行修改或新增的时候，一定要在操作之后加上Resonse.Cookies(CookieName).Domain属性。</p'> 　　2、如果没有必要，请不要修改已设置Domain的Cookie组，直接使用Response.Cookies("CookieText") = CookieValue 来创建一个新的Cookie。<br /><img src ="http://www.blogjava.net/alex/aggbug/70380.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-09-18 20:59 <a href="http://www.blogjava.net/alex/archive/2006/09/18/70380.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[zt]Struts国际化处理</title><link>http://www.blogjava.net/alex/archive/2006/09/05/67905.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Tue, 05 Sep 2006 14:22:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/09/05/67905.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/67905.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/09/05/67905.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/67905.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/67905.html</trackback:ping><description><![CDATA[key words:struts国际化 <br /><br /><p>一、Struts的国际化<br />    Struts是一种支持国际化的MVC的Web 
Framework。可是如何来使用struts国际化是一个问题。下面我们来探讨一下，如何实现Struts的国际化。Web程式的国际化涉及到3个层面的东西。第一、jsp部分的输入/输出；第二、应用处理程序的国际化；第三、DB的国际化问题。这里主要探讨的是jsp部分的输入/输出问题。</p><p>二、静态部分的国际化<br />   
Struts的jsp页面静态内容（包括静态文字，静态图片）国际化问题，是通过资源文件来实现的。要实现国际化，需要做如下几项工作：1、定义web.xml的动ActionServlet的参数；2、定义资源文件；3、定义JSP页面的字符集合；4、在JSP页面获取资源文件里面的内容。<br />1、定义web.xml的动ActionServlet的参数<br /></p><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">action</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">servlet-class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">org.apache.struts.action.ActionServlet</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet-class</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">   <br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">init-param</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">param-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">config</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">param-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">param-value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">/WEB-INF/struts-config.xml</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">param-value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">init-param</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">init-param</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">param-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">application</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">param-name</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">param-value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">ApplicationResources</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">param-value</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 0);">&lt;!--</span><span style="color: rgb(0, 128, 0);"> 默认资源文件名 </span><span style="color: rgb(0, 128, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">init-param</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />  </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">load-on-startup</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">load-on-startup</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">servlet</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br /><p>2、定义资源文件<br />在/WEB-INF/classes下面添加UTF-8资源束文件。每一个资源文件是“键－值”对的集合。在JSP页面里面可以通过键来找到相应的数据值。本例子的文件名是ApplicationResources，所以相应的资源文件束是(包括e文，简体中文，繁体中文)<br />ApplicationResources.properties 
: 
默认资源文件。当在其他资源文件里面找不到某个资源的时候，就使用该资源文件里面的定义。<br /><font color="#ff0000">ApplicationResources_zh_CN.properties：简体中文资源文件。<br />ApplicationResources_zh_TW.properties：繁体中文资源文件。</font><br />资源文件的格式为：默认资源文件名_国别_语言.properties。其中每个文件都是通过<font color="#660000">%JAVA_HONE%/BIN/native2ascii.exe</font>工具转换而来。你也可以使用其他工具来处理得到(<a href="http://java.sun.com/products/jilkit/">http://java.sun.com/products/jilkit/</a> 
有一个工具Internationalization Java Internationalization and Localization Toolkit 
可以处理)。下面是一个例子,我们显示如何使用%JAVA_HONE%/BIN/native2ascii.exe命令来定义资源束文件。<br />2.1 
准备文件<br />//ApplicationResources.properties 
；默认资源文件，通常里面的内容是英文的。<br />label.username=USERNAME :<br />label.password=PASSWORD 
:</p><p>//ApplicationResources_zh_CN.bak 
；简体中文的资源文件。里面的内容是中文的。它需要工具将其中的内容处理成UTF-8<br />label.username=用户名 
:<br />label.password=密  码 :</p><p>//ApplicationResources_zh_TW.bak : 
繁体中文的资源文件。里面的内容是中文的。它需要工具将其中的内容处理成UTF-8,下面的内容是繁体码。<br />label.username=ノめ?W 
:<br />label.password=ノめ?W :</p><p>2.2 准备完成以后，使用如下的命令创建UTF-8资源文件束<br /><font color="#ff0000">native2ascii -encoding gb2312 
ApplicationResources_zh_CN.bak 
ApplicationResources_zh_CN.properties</font><br />native2ascii -encoding big5 Applica 
tionResources_zh_TW.bak ApplicationResources_zh_TW.properties</p><p>3、定义JSP页面的字符集合<br />定义JSP页面的语言为UTF-8。在每个JSP页面，必须有如下的内容（如果使用的模板技术，则只是需要在模板页面添加，其他使用该模板的页面无需添加）<br />&lt;%@ 
page contentType="text/html;charset=UTF-8"%&gt;</p><p>4、在JSP页面获取资源文件里面的内容。<br />在JSP里面需要显示静态内容的地方使用&lt;bean:message /&gt;strus的bean 
tag包里面的message标签。例如下面的页面</p><p>&lt;table&gt;<br />  &lt;tr&gt;<br />    &lt;td align="right"&gt;&lt;bean:message 
key="label.username" /&gt;&lt;/td&gt;    <br />  &lt;/tr&gt;<br />  
&lt;tr&gt;<br />    &lt;td align="right"&gt;&lt;bean:message key="label.password" 
/&gt;&lt;/td&gt;<br />  &lt;/tr&gt;<br />&lt;/table&gt;</p><p>好了，在这个页面显示的时候，如果客户的IE的语言集合是zh_CN的话，就会显示<br />用户名：<br />口  令：</p><p>如果是客户的IE的语言是zh_TW的话，就会显示<br />用户名：<br />用户名：</p><p>可以在IE的工具-&gt;Internet选项-&gt;语言的地方，来选择，定义IE的语言。</p><p>三、表单的数据的处理。<br /><b>对于表单数据的处理，我们是通过添加一个Filter来实现的。所有提交的请求，都需要做字符处理。然后在web.xml里面定义该Filter。这样我们就不需要在程序里面做任何的字符处理。</b><br />3.1 
定义Filter。下面是一个例子。<br />package com.webapps.commons;</p><p>import java.io.*;<br />import javax.servlet.*;</p><p>public class CharsetEncodingFilter implements Filter{<br />  private 
FilterConfig config = null;<br />  private String defaultEncode = "UTF-8";</p><p>  public void init(FilterConfig config) throws ServletException {<br />    
this.config = config;<br />    
if(config.getInitParameter("Charset")!=null){<br />        
defaultEncode=config.getInitParameter("Charset");<br />    }<br />  }</p><p>  public void destroy() {<br />    this.config = null;<br />  }</p><p>  public void doFilter(ServletRequest request, ServletResponse 
response,<br />                       FilterChain chain) throws IOException, 
ServletException {<br />    ServletRequest srequest=request;<br />    
srequest.setCharacterEncoding(defaultEncode);<br />    
chain.doFilter(srequest,response);<br />  }<br />}</p><p>3.2 在web.xml里面声明使用该Filter<br />&lt;filter&gt;<br />  &lt;filter-name&gt;Character 
Encoding&lt;/filter-name&gt;<br />  
&lt;filter-class&gt;com.webapps.commons.CharsetEncodingFilter&lt;/filter-class&gt;<br />&lt;/filter&gt;<br />&lt;filter-mapping&gt;<br />  
&lt;filter-name&gt;Character Encoding&lt;/filter-name&gt;<br />  
&lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br />&lt;/filter-mapping&gt;</p><p>四、扩展<br />待续的是应用程序部分的国际化问题，和DB的国际化问题。</p><br /><img src ="http://www.blogjava.net/alex/aggbug/67905.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-09-05 22:22 <a href="http://www.blogjava.net/alex/archive/2006/09/05/67905.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[zt]经典正则表达式</title><link>http://www.blogjava.net/alex/archive/2006/08/29/66440.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Tue, 29 Aug 2006 07:02:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/08/29/66440.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/66440.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/08/29/66440.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/66440.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/66440.html</trackback:ping><description><![CDATA[
		<h1 align="center">
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">key words：正则表达式  模式匹配 javascript</font>
				</font>
		</h1>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">摘要：收集一些常用的正则表达式。</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">正则表达式用于字符串处理，表单验证等场合，实用高效，但用到时总是不太把握，以致往往要上网查一番。我将一些常用的表达式收藏在这里，作备忘之用。本贴随时会更新。</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font style="color: rgb(0, 0, 0);" color="#800080">匹配中文字符的正则表达式： [\u4e00-\u9fa5]</font>
						</font>
				</font>
		</p>
		<font face="宋体" size="3">
				<font style="color: rgb(0, 0, 0);" color="#414141">
						<font color="#000080">
								<span style="color: rgb(0, 0, 0);">
										<p>
												<font color="#000080">匹配双字节字符(包括汉字在内)：[^\x00-\xff]</font>
										</p>
										<p>
												<font color="#000080">应用：计算字符串的长度（一个双字节字符长度计2，ASCII字符计1）</font>
										</p>
										<p>
												<font color="#000080">String.prototype.len=function(){return this.replace([^\x00-\xff]/g,"aa").length;}</font>
										</p>
										<p>
												<font style="color: rgb(0, 0, 0);" color="#800080">匹配空行的正则表达式：\n[\s| ]*\r</font>
										</p>
										<p>
												<font color="#000080">匹配HTML标记的正则表达式：/&lt;(.*)&gt;.*&lt;\/\1&gt;|&lt;(.*) \/&gt;/</font>
												<font color="#000000">
												</font>
										</p>
										<font color="#000080">
										</font>
										<p>
												<font color="#000080">
														<font color="#800080">匹配首尾空格的正则表达式：(^\s*)|(\s*$)</font>
												</font>
										</p>
										<p>
												<font color="#000080">
														<font color="#800080">应用：javascript中没有像vbscript那样的trim函数，我们就可以利用这个表达式来实现，如下：</font>
												</font>
										</p>
										<p>
												<font color="#000080">
														<font color="#800080">String.prototype.trim = function()<br /></font>
												</font>
										</p>
								</span>
								<font color="#800080">{<br />    return this.replace(/(^\s*)|(\s*$)/g, "");<br />}</font>
						</font>
				</font>
		</font>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font color="#000080">
										<font color="#000080">利用正则表达式分解和转换IP地址：</font>
								</font>
						</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font color="#000080">
										<font color="#000080">下面是利用正则表达式匹配IP地址，并将IP地址转换成对应数值的javascript程序：</font>
								</font>
						</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font color="#000080">
										<font color="#000080">function IP2V(ip)<br />{<br /> re=/(\d+)\.(\d+)\.(\d+)\.(\d+)/g  //匹配IP地址的正则表达式<br />if(re.test(ip))<br />{<br />return RegExp.$1*Math.pow(255,3))+RegExp.$2*Math.pow(255,2))+RegExp.$3*255+RegExp.$4*1<br />}<br />else<br />{<br /> throw new Error("Not a valid IP address!")<br />}<br />}</font>
								</font>
						</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font color="#000080">
										<font color="#000080">不过上面的程序如果不用正则表达式，而直接用split函数来分解可能更简单，程序如下：</font>
								</font>
						</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font color="#000080">
										<font color="#000080">var ip="10.100.20.168"<br />ip=ip.split(".")<br />alert("IP值是："+(ip[0]*255*255*255+ip[1]*255*255+ip[2]*255+ip[3]*1))</font>
								</font>
						</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font color="#000080">
										<font color="#800080">匹配Email地址的正则表达式：\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*</font>
								</font>
						</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font color="#000080">
										<font color="#000080">匹配网址URL的正则表达式：http://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?</font>
								</font>
						</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font color="#000080">
										<font color="#000080">得用正则表达式从URL地址中提取文件名的javascript程序，如下结果为page1</font>
								</font>
						</font>
				</font>
		</p>
		<p>
				<font face="宋体" size="3">
						<font style="color: rgb(0, 0, 0);" color="#414141">
								<font color="#000080">
										<font color="#800080">
												<font color="#000080">s="http://www.9499.net/page1.htm"<br />s=s.replace(/(.*\/){0,}([^\.]+).*/ig,"$2")<br />alert(s)</font>
										</font>
								</font>
						</font>
				</font>
		</p>
		<font face="宋体" size="3">
				<font style="color: rgb(0, 0, 0);" color="#414141">
						<font color="#000080">
								<font color="#800080">
										<span style="color: rgb(0, 0, 0);">
												<p>
														<font color="#800080">利用正则表达式限制网页表单里的文本框输入内容：</font>
												</p>
												<p>
														<font color="#800080">用正则表达式限制只能输入中文：onkeyup="value=value.replace(/[^
\u4E00-\u9FA5]/g,'')"
onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))"</font>
												</p>
												<p>
														<font color="#800080">用正则表达式限制只能输入全角字符：</font>
														<font color="#800080"> onkeyup="value=value.replace(/[^\uFF00-\uFFFF]/g,'')"
onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\uFF00-\uFFFF]/g,''))"</font>
												</p>
												<p>
														<font color="#800080">用正则表达式限制只能输入数字：onkeyup="value=value.replace(/[^
\d]/g,'')
"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"</font>
												</p>
												<p>
														<font color="#800080">用正则表达式限制只能输入数字和英文：onkeyup="value=value.replace
(/[\W]/g,'')
"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"<br /><br />"^\\d+$"　　//非负整数（正整数 + 0）<br />"^[0-9]*[1-9][0-9]*$"　　//正整数 <br />"^((-\\d+)|(0+))$"　　//非正整数（负整数 + 0） <br />"^-[0-9]*[1-9][0-9]*$"　　//负整数 <br />"^-?\\d+$"　　　　//整数 <br />"^\\d+(\\.\\d+)?$"　　//非负浮点数（正浮点数 + 0） <br />"^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$"　　//正浮点数 <br />"^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$"　　//非正浮点数（负浮点数 + 0） <br />"^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$"　　//负浮点数 <br />"^(-?\\d+)(\\.\\d+)?$"　　//浮点数 <br />"^[A-Za-z]+$"　　//由26个英文字母组成的字符串 <br />"^[A-Z]+$"　　//由26个英文字母的大写组成的字符串 <br />"^[a-z]+$"　　//由26个英文字母的小写组成的字符串 <br />"^[A-Za-z0-9]+$"　　//由数字和26个英文字母组成的字符串 <br />"^\\w+$"　　//由数字、26个英文字母或者下划线组成的字符串 <br />"^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$"　　　　//email地址 <br />"^[a-zA-z]+://(\\w+(-\\w+)*)(\\.(\\w+(-\\w+)*))*(\\?\\S*)?$"　　//url<br /><br />"^[A-Za-z0-9_]*$"</font>
												</p>
										</span>
								</font>
						</font>
				</font>
		</font>
<img src ="http://www.blogjava.net/alex/aggbug/66440.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-08-29 15:02 <a href="http://www.blogjava.net/alex/archive/2006/08/29/66440.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[zt]深入浅出之正则表达式</title><link>http://www.blogjava.net/alex/archive/2006/08/28/66316.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Mon, 28 Aug 2006 15:21:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/08/28/66316.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/66316.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/08/28/66316.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/66316.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/66316.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: key words:正则表达式																																																																										深入浅出之正则表达式（一）																		前言：				       半年前我对正则表达式产生了兴趣，在网上查找过...&nbsp;&nbsp;<a href='http://www.blogjava.net/alex/archive/2006/08/28/66316.html'>阅读全文</a><img src ="http://www.blogjava.net/alex/aggbug/66316.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-08-28 23:21 <a href="http://www.blogjava.net/alex/archive/2006/08/28/66316.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[zt]解放web程序员的输入验证</title><link>http://www.blogjava.net/alex/archive/2006/08/28/66299.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Mon, 28 Aug 2006 14:20:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/08/28/66299.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/66299.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/08/28/66299.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/66299.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/66299.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 本程序最初是由wanghr100(灰豆宝宝.net)的checkForm基础上进行修改的，增加了很多功能,如下： 						对非ie的支持 				增加了内置表达式和内置提示 				增加了显示方式（弹出式和页面显示式） 				增加了显示一条和显示全部 				进行了封装（CLASS_CHECK） 				支持外接函数或表达式（应用在密码一致） ...&nbsp;&nbsp;<a href='http://www.blogjava.net/alex/archive/2006/08/28/66299.html'>阅读全文</a><img src ="http://www.blogjava.net/alex/aggbug/66299.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-08-28 22:20 <a href="http://www.blogjava.net/alex/archive/2006/08/28/66299.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>js:window.opener问题</title><link>http://www.blogjava.net/alex/archive/2006/08/23/65225.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Wed, 23 Aug 2006 02:54:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/08/23/65225.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/65225.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/08/23/65225.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/65225.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/65225.html</trackback:ping><description><![CDATA[在应用中有这样一个情况，<br />在A窗口中打开B窗口，在B窗口中操作完以后关闭B窗口，同时自动刷新A窗口<br /><br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> closeWin(){<br />        hasClosed </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br />        window.opener.location</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">javascript:reloadPage();</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />        window.close();<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> window.onbeforeunload(){<br />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">hasClosed){<br />            window.opener.location</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">javascript:reloadPage();</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />        }<br />    }<br /><br /></span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">script</span><span style="color: rgb(0, 0, 0);">&gt;</span></div><br />上面的代码在关闭B窗口的时候会提示错误，说缺少Object,正确的代码如下：<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> closeWin(){<br />        hasClosed </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br />        window.opener.location</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">javascript:reloadPage();</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />        <font color="#ff6600">window.opener</font></span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />        window.close();<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> window.onbeforeunload(){<br />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">hasClosed){//如果已经执行了closeWin方法，则不执行本方法<br />            window.opener.location</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">javascript:reloadPage();</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />        }<br />    }<br /><br /></span><span style="color: rgb(0, 0, 0);">&lt;/</span><span style="color: rgb(0, 0, 0);">script</span><span style="color: rgb(0, 0, 0);">&gt;</span></div><br />reloadPage方法如下:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> reloadPage() {<br />        history.go(</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">);<br />        document.execCommand(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">refresh</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)<br />        document.location </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> document.location;<br />        document.location.reload();<br />    }</span></div><br />PS:由于需要支持正常关闭和强制关闭窗口时能捕捉到事件，用了全局变量hasClosed<br /><br />==============================================<br /><br />补充，在父窗口是frame的时候在刷新父窗口的时候会出现问题:<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">The page cannot be refreshed without resending the information<img src="http://www.blogjava.net/images/dot.gif" />.</span></div><br />后修改如下: <br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">window.opener.parent.document.frames.item('mainFrame').location.href </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> window.opener.location.href;</span></div><br />不需要执行自带的reload()方法,注意，不要再画蛇添足加上这一句:<br /><br /><span style="color: rgb(0, 0, 0);"><strike>window.opener.parent.document.frames.item('mainFrame').location.reload();<br /><br /></strike>========================================================================================<strike><br /></strike>最后，为了同时支持刷新普通父窗口和frame父窗口，代码如下:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> closeWin() {<br />        hasClosed </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;<br />    </span><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> frame){</span><span style="color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br />        window.opener.parent.document.frames.item('mainFrame').location.href </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> window.opener.location.href;<br />    </span><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br />        window.opener.location </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">javascript:reloadPage();</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />    </span><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br />        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">window.opener.top.mainFrame.location="javascript:reloadPage();";</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">self.opener.frames.mainFrame.location.reload(true);</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">        window.opener </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />        window.close();<br />    }<br />    </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> window.onbeforeunload(){<br />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">hasClosed) {<br />        </span><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> frame){</span><span style="color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br />            window.opener.parent.document.frames.item('mainFrame').location.href </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> window.opener.location.href;<br />        </span><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br />            window.opener.location </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">javascript:reloadPage();</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br />        </span><span style="color: rgb(0, 0, 0);">&lt;%</span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br />            window.opener </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />        }<br />    }</span></div><br /><br /><br /></span><br /><img src ="http://www.blogjava.net/alex/aggbug/65225.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-08-23 10:54 <a href="http://www.blogjava.net/alex/archive/2006/08/23/65225.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>js：获得select的text的值</title><link>http://www.blogjava.net/alex/archive/2006/08/21/64903.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Mon, 21 Aug 2006 14:58:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/08/21/64903.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/64903.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/08/21/64903.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/64903.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/64903.html</trackback:ping><description><![CDATA[key words:select text值<br />获得select的value很容易，但是如何获得其text的内容呢，下面的代码借助了prototype.js库:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">language</span><span style="color: rgb(0, 0, 255);">="javascript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />        </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> getSelect(selectName){<br />        </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> options </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> $(selectName).getElementsByTagName('option');<br />        options </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> $A(options);<br />        </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> opt </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> options.find( </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(employee){<br />            </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">return</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> (employee.value </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">==</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> $F(selectName));<br />        });<br />        alert(opt.innerHTML);<br />        }<br />    </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">select </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="hi"</span><span style="color: rgb(255, 0, 0);"> onchange</span><span style="color: rgb(0, 0, 255);">="getSelect('hi');"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">option </span><span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">="01"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">一</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">option</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">option </span><span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">="02"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">二</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">option</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">option </span><span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">="03"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">三</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">option</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">option </span><span style="color: rgb(255, 0, 0);">value</span><span style="color: rgb(0, 0, 255);">="04"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">四</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">option</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">select</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />PS: $A : 转换成数组格式<br />    opt.innerHTML:nodeText<br /><img src ="http://www.blogjava.net/alex/aggbug/64903.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-08-21 22:58 <a href="http://www.blogjava.net/alex/archive/2006/08/21/64903.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>js : 怎样从子窗口调用父窗口的方法</title><link>http://www.blogjava.net/alex/archive/2006/08/21/64894.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Mon, 21 Aug 2006 13:55:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/08/21/64894.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/64894.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/08/21/64894.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/64894.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/64894.html</trackback:ping><description><![CDATA[key words: 在子窗口中如何调用父窗口的方法，属于"回调",直接拿到父窗口的句柄，然后直接调用方法不行，比如: <br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">parent.window.show(b)<br />window.opener.show(b)</span></div><br />都不行,正确的做法是:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">opener.location</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">javascript:show('hello')</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;</span></div><br />PS: 直接调用父窗口的对象与此不同，参考这篇: <a id="CategoryEntryList1_EntryStoryList_Entries_ctl15_TitleUrl" href="/alex/archive/2006/05/05/44674.html">用javaScript操作两个页面</a><br /><span style="font-size: 12px;"></span><br /><img src ="http://www.blogjava.net/alex/aggbug/64894.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-08-21 21:55 <a href="http://www.blogjava.net/alex/archive/2006/08/21/64894.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>js中获取radio的值</title><link>http://www.blogjava.net/alex/archive/2006/08/21/64861.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Mon, 21 Aug 2006 11:12:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/08/21/64861.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/64861.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/08/21/64861.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/64861.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/64861.html</trackback:ping><description><![CDATA[key words: radio的值 Form<br /><br />在jsp中获取radio的值很容易，直接 request.getParameter("myRadio");<br />但是在js中不行，我试验了一下，如果选择第一个没问题，但是你选第二个第三个的话就出现undefined.办法如下:<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> Foo()<br />{<br />    </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> selectedIndex </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">;<br />    </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> form1 </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> document.getElementById(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">form1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />    </span><span style="color: rgb(0, 0, 255);">var</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">;<br />    <br />    </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (i</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">form1.r.length; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">)<br />    {<br />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (form1.r[i].checked)<br />        {<br />            selectedIndex </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> i;<br />            alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">您选择项的 value 是：</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> form1.r[i].value);<br />            </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br />        }<br />    }<br />    <br />    </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (selectedIndex </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">)<br />    {<br />        alert(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">您没有选择任何项</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />    }<br />}</span></div><br /><br /><img src ="http://www.blogjava.net/alex/aggbug/64861.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-08-21 19:12 <a href="http://www.blogjava.net/alex/archive/2006/08/21/64861.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>textarea的弱智问题</title><link>http://www.blogjava.net/alex/archive/2006/08/15/63634.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Tue, 15 Aug 2006 03:08:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/08/15/63634.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/63634.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/08/15/63634.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/63634.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/63634.html</trackback:ping><description><![CDATA[key words : textarea空格问题 <br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">textarea </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="parentRemark"</span><span style="color: rgb(255, 0, 0);"> rows</span><span style="color: rgb(0, 0, 255);">="10"</span><span style="color: rgb(255, 0, 0);"> cols</span><span style="color: rgb(0, 0, 255);">="80"</span><span style="color: rgb(255, 0, 0);"> class</span><span style="color: rgb(0, 0, 255);">="editor"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">&lt;%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">rem</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">[7]==null?"":rem[7]%&gt;<br />&lt;/textarea&gt;</span></div><br />猜猜这个textarea会有什么问题?<br /><br />效果如下:<br /><br /><img src="http://www.blogjava.net/images/blogjava_net/alex/images/jiazhang.png" alt="jiazhang.png" border="0" height="250" width="736" /><br /><br />是不是很奇怪，哪来的空格啊，还以为从数据库中取出的数据有空格，检查也不是，后来才知道，原来是textarea换行惹得祸,不换行就OK了<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">textarea </span><span style="color: rgb(255, 0, 0);">name</span><span style="color: rgb(0, 0, 255);">="parentRemark"</span><span style="color: rgb(255, 0, 0);"> rows</span><span style="color: rgb(0, 0, 255);">="10"</span><span style="color: rgb(255, 0, 0);"> cols</span><span style="color: rgb(0, 0, 255);">="80"</span><span style="color: rgb(255, 0, 0);"> class</span><span style="color: rgb(0, 0, 255);">="editor"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">&lt;%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">rem</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">[7]==null?"":rem[7]%&gt;&lt;/textarea&gt;</span></div><br /><img src ="http://www.blogjava.net/alex/aggbug/63634.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-08-15 11:08 <a href="http://www.blogjava.net/alex/archive/2006/08/15/63634.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]js实现捕捉退出浏览器行为</title><link>http://www.blogjava.net/alex/archive/2006/07/20/59137.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Thu, 20 Jul 2006 02:50:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/07/20/59137.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/59137.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/07/20/59137.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/59137.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/59137.html</trackback:ping><description><![CDATA[key words:js捕捉浏览器退出 关闭浏览器 刷新浏览器<br /><br />有时在用户session管理时，需要跟踪会话状态，比如当前在线用户，如果用户非正常退出，需要知道。<br /><br />用js控制浏览器的关闭是一个辅助的手段，当然也可以设置session的有效期，不过不够及时。<br /><br />js代码如下:<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">language</span><span style="color: rgb(0, 0, 255);">="javascript"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> <br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&lt;!--</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> <br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> s</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">close</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">; <br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> window.onunload(){ <br />    </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">if</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(s</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">==</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">fresh</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">) <br />        </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">if</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(window.screenLeft</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">10000</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">){alert('¹Ø±Õ');}<br />        </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">else</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">{alert('Ë¢ÐÂ');} <br />    </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">else</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> alert('¹Ø±Õ'); <br />} <br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> window.onbeforeunload()<br />{ <br />    s</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">fresh</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">; <br />} <br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">--&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> <br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">html</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br /><img src ="http://www.blogjava.net/alex/aggbug/59137.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-07-20 10:50 <a href="http://www.blogjava.net/alex/archive/2006/07/20/59137.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>差点被遗忘的元素:cookie-用cookie记录用户的历史行为</title><link>http://www.blogjava.net/alex/archive/2006/07/05/56832.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Wed, 05 Jul 2006 09:39:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/07/05/56832.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/56832.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/07/05/56832.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/56832.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/56832.html</trackback:ping><description><![CDATA[key words: cookie 保留历史记录 登陆记录<br /><br />很多时候用session觉得挺方便的，今天突然发现自己竟然几乎没用过cookie，呵呵，有点意思。正好碰到一个登陆页面，需要用户选择站点类型，觉得每次都让用户选择有点不合理，毕竟一个用户常用的就一个，所以决定用cookie记录下这个站点，下次登陆的时候可以直接显示.<br /><br />效果如下:<br /><img src="http://www.blogjava.net/images/blogjava_net/alex/cookie/siteCookie.jpg" alt="站点cookie" title="站点cookie" border="0" height="151" width="211" /><br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * 从cookie里读取指定Name 对应的值<br />     * 如果没有返回空 null<br />     * </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> cookieName<br />     * </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> request<br />     * </span><span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> decode :编码</span><br /><span style="color: rgb(0, 128, 0);">     * </span><span style="color: rgb(128, 128, 128);">@return</span><span style="color: rgb(0, 128, 0);">  String<br />     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> String getCookieValue(String cookieName, HttpServletRequest request,String decode) {<br />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> cookieName </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> cookieName.trim().length() </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">""</span><span style="color: rgb(0, 0, 0);">;<br />        Cookie cookies[] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.getCookies();<br />        Cookie sCookie </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />        String sname </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />        String svalue </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> cookies </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> cookies.length </span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) {<br />            </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> i </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">; i </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);"> cookies.length; i</span><span style="color: rgb(0, 0, 0);">++</span><span style="color: rgb(0, 0, 0);">) {<br />                sCookie </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> cookies[i];<br />                sname </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> sCookie.getName();<br />                </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (cookieName.equals(sname)) {<br />                    </span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"> {<br />                        svalue </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> java.net.URLDecoder.decode(sCookie.getValue(),decode);<br />                    } </span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"> (UnsupportedEncodingException e) {<br />                        e.printStackTrace();  <br />                    }<br />                    </span><span style="color: rgb(0, 0, 255);">break</span><span style="color: rgb(0, 0, 0);">;<br />                }<br />            }<br />        }<br />        </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> svalue ;<br />    }<br /><br />    </span><span style="color: rgb(0, 128, 0);">/**</span><span style="color: rgb(0, 128, 0);"><br />     * 设置cookie<br />     * </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> cookieName<br />     * </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> cookieValue<br />     * </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> maxAge<br />     * </span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"> response<br /></span><span style="color: rgb(0, 128, 0);">     * </span><span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(128, 128, 128);">@param</span><span style="color: rgb(0, 128, 0);"></span><span style="color: rgb(0, 0, 0);">encode </span><span style="color: rgb(0, 128, 0);">:编码</span><br /><span style="color: rgb(0, 128, 0);">     </span><span style="color: rgb(0, 128, 0);">*/</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 255);">public</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">static</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">void</span><span style="color: rgb(0, 0, 0);"> setCookieValue(String cookieName,String cookieValue,<br /></span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> maxAge,HttpServletResponse response,String encode) {<br />        </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> cookieName </span><span style="color: rgb(0, 0, 0);">||</span><span style="color: rgb(0, 0, 0);"> cookieName.trim().length() </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> ;<br />        Cookie cookie </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />        </span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"> {<br />            cookie </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Cookie(cookieName, java.net.URLEncoder.encode(cookieValue,encode));<br />        } </span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"> (UnsupportedEncodingException e) {<br />            e.printStackTrace();<br />        }<br />        cookie.setMaxAge(maxAge);<br />        response.addCookie(cookie);<br />    }</span></div><br /><img src ="http://www.blogjava.net/alex/aggbug/56832.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-07-05 17:39 <a href="http://www.blogjava.net/alex/archive/2006/07/05/56832.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>prototype.js小记</title><link>http://www.blogjava.net/alex/archive/2006/06/18/53654.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Sun, 18 Jun 2006 14:22:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/06/18/53654.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/53654.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/06/18/53654.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/53654.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/53654.html</trackback:ping><description><![CDATA[mark下资源，有空再来慢慢研究。<br /><br /><a target="_blank" class="" title="" href="/calvin/archive/2006/06/17/53471.html">Prototype.js--Javascript编写者的小军刀</a><br /><ul><li><a href="http://wiki.script.aculo.us/scriptaculous/show/Prototype" target="_blank">script.aculo.us的wiki</a></li><li><a href="http://www.sergiopereira.com/articles/prototype.js.html" target="_blank">Developer Notes for Protype.js</a></li><li><a href="http://www.prototypedoc.com/">文档集合：http://www.prototypedoc.com/</a></li></ul><br /><br /><img src ="http://www.blogjava.net/alex/aggbug/53654.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-06-18 22:22 <a href="http://www.blogjava.net/alex/archive/2006/06/18/53654.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>利用css实现表格的隔行换色</title><link>http://www.blogjava.net/alex/archive/2006/06/15/53057.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Thu, 15 Jun 2006 10:14:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/06/15/53057.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/53057.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/06/15/53057.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/53057.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/53057.html</trackback:ping><description><![CDATA[key words: css  隔行换色　控制表格　　交替颜色<br /><br />最近用到不少css的东西，发现用css是可以省不少麻烦，特别更改效果。<br /><br />google了一篇　<a target="_blank" class="" title="" href="http://www.arting365.com/htmldata/2005_01/95/97/article_1923_1.html"><font class="headertitle"><span id="ctq">利用CSS控制表格的交替颜色</span></font></a><br /><br />下面是实现的代码:<br /><br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">style </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/css"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(128, 0, 0);"><br />&lt;!--<br />tr </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">{</span><span style="background-color: rgb(245, 245, 245); color: rgb(255, 0, 0);">background-color</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">:</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">expression((this.sectionRowIndex==0)?"":<br />(this.sectionRowIndex%2==0)?"red":"blue")</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">}</span><span style="background-color: rgb(245, 245, 245); color: rgb(128, 0, 0);"><br />--&gt;<br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">style</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">HEAD</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">table</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第1行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第1行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第2行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第2行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第3行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第3行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第4行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第4行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第5行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第5行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">table</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span></div><br />关键就是这一句:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">tr {background-color:expression((this.sectionRowIndex==0)?"":<br />(this.sectionRowIndex%2==0)?"red":"blue")}</span></div><br /><br />对于td的控制如下:<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">style </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/css"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(128, 0, 0);"><br />&lt;!--<br />tr </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">{</span><span style="background-color: rgb(245, 245, 245); color: rgb(255, 0, 0);">background-color</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">:</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">expression((this.sectionRowIndex%2==0)?"red":"blue")</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">}</span><span style="background-color: rgb(245, 245, 245); color: rgb(128, 0, 0);"><br />td </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">{</span><span style="background-color: rgb(245, 245, 245); color: rgb(255, 0, 0);">background-color</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">:</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">expression((this.cellIndex%2==0)?"":((this.parentElement.sectionRowIndex%2==0)?"green":"yellow"))</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">}</span><span style="background-color: rgb(245, 245, 245); color: rgb(128, 0, 0);"><br />--&gt;<br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">style</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">HEAD</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">table</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第1行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第1行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第1行</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);"> /td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第1行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第1行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第2行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第2行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第2行</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);"> /td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第2行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第2行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第3行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第3行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第3行</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);"> /td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第3行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第3行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第4行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第4行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第4行</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);"> /td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第4行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第4行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第5行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第5行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第5行</span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);"> /td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第5行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">第5行</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">table</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span></div><br />即<span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">cellIndex　<br /><br />另:和数组一样，第一行从0开始<br /><br /><br /><br />但愿对你有用.  :)<br /><br /><br /><br /></span><img src ="http://www.blogjava.net/alex/aggbug/53057.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-06-15 18:14 <a href="http://www.blogjava.net/alex/archive/2006/06/15/53057.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jsp实现文件下载与中文文件名乱码问题解决</title><link>http://www.blogjava.net/alex/archive/2006/06/14/52855.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Wed, 14 Jun 2006 14:48:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/06/14/52855.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/52855.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/06/14/52855.html#Feedback</comments><slash:comments>13</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/52855.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/52855.html</trackback:ping><description><![CDATA[key words: jsp文件下载 中文乱码 文件名乱码 <br /><br />文件上传参看: <a href="/alex/archive/2006/05/22/47528.html">这里</a><br /><br />碰到文件乱码，google了一下，发现<a href="http://duduwolf.360doc.com/showWeb/0/0/17613.aspx">这篇文章</a>还不赖<br /><br />摘录如下:<br /><br /><br />之前,写过一个Download.jsp文件,可以解决下载文件乱码问题(诸如:DOC,XSL文件等等).<br />后来发现,遇到中文名的文件的时候,文件下载将会报错~~~~<br />今天,通过改写原Download.jsp文件已经彻底解决了这个问题~<br />现在,把一整套的文件上传下载的方法给贴出来~~~以便大家借鉴!~!~!~!~!  <br />作者:古埃及法老<br /><br /><strong><em>download.jsp文件</em></strong><br />---------------------------------------------------------<br /><font style="background-color: rgb(0, 0, 0);" color="#330000"></font><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">&lt;%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />  java.io.BufferedInputStream bis</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">null</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br />  java.io.BufferedOutputStream  bos</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">null</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br />try{<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">String</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> filename</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">request.getParameter(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">filename</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br />             filename</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">String</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(filename.getBytes(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">iso8859-1</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">),</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">gb2312</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br /> response.setContentType(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">application/x-msdownload</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br /> response.setHeader(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">Content-disposition</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">,</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">attachment; filename=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">+</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">String</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(filename.getBytes(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">gb2312</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">),</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">iso8859-1</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">));<br /> bis </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> java.io.BufferedInputStream(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> java.io.FileInputStream(config.getServletContext().getRealPath(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">files/</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">+</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> filename)));<br /> bos</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> java.io.BufferedOutputStream(response.getOutputStream()); <br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">byte</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">[] buff </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">byte</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">[</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">2048</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">];<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">int</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> bytesRead;<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">while</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">-</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">1</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> !</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> (bytesRead </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> bis.read(buff, </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">0</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">, buff.length))) {<br />  bos.write(buff,</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">0</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">,bytesRead);<br /> }<br />}<br />catch(Exception e){<br /> e.printStackTrace();<br />}<br />finally {<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">if</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> (bis !</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">null</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">)bis.close();<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">if</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> (bos !</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">null</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">)bos.close();<br />}<br /></span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"> </span></div><br /><br />注意，关键就是<span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">setHeader里的</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">filename需要重新编码,格式是ISO-8859-1就ＯＫ了<br /><br />以下是我自己项目中用到的代码片断，供参考:<br /><br />list.jsp: 显示附件名称的页面<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">td </span><span style="color: rgb(255, 0, 0);">height</span><span style="color: rgb(0, 0, 255);">="25"</span><span style="color: rgb(255, 0, 0);"> class</span><span style="color: rgb(0, 0, 255);">="tdcor"</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">附</span><span style="color: rgb(255, 0, 0);">&amp;nbsp;&amp;nbsp;</span><span style="color: rgb(0, 0, 0);">件</span><span style="color: rgb(255, 0, 0);">&amp;nbsp;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">td </span><span style="color: rgb(255, 0, 0);">colspan</span><span style="color: rgb(0, 0, 255);">="3"</span><span style="color: rgb(255, 0, 0);"> height</span><span style="color: rgb(0, 0, 255);">=50</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">&lt;%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />                    </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">if</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> (</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">null</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> !</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> publish.getAttatchFilename() </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&amp;&amp;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />publish.getAttatchFilename().length() </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">&gt;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">0</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">) {<br />                </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">a </span><span style="color: rgb(255, 0, 0);">href</span><span style="color: rgb(0, 0, 255);">="publish_do.jsp?method=download&amp;fileName=<br />&lt;%=URLEncoder.encode(publish.getAttatchFilename(),"</span><span style="color: rgb(255, 0, 0);">GBK")%</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);">"&gt;</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);"><br />&lt;%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">URLDecoder.decode(publish.getAttatchFilename(),</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">GBK</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">)</span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">a</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br />                </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">&lt;%</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />                    }<br />                </span><span style="background-color: rgb(255, 255, 0); color: rgb(0, 0, 0);">%&gt;</span><span style="color: rgb(0, 0, 0);"><br />            </span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">td</span><span style="color: rgb(0, 0, 255);">&gt;</span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">tr</span><span style="color: rgb(0, 0, 255);">&gt;</span></div><br />download.jsp:下载页面<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> method </span><span style="color: rgb(0, 0, 0);">&amp;&amp;</span><span style="color: rgb(0, 0, 0);"> method.equals(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">download</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)) {</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">下载附件</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);"><br />        String fileName </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.getParameter(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">fileName</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);</span><span style="color: rgb(0, 0, 0);"></span><span style="color: rgb(0, 0, 0);"><br />        File file </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> File(Constants.PUBLISH_FILE_PATH </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> URLDecoder.decode(fileName,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">GBK</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />        response.reset();<br />        response.setContentType(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">application/octet-stream; charset=GBK</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">);<br />        response.addHeader(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">Content-Disposition</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">attachment; filename=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> CourseDetailBusiness.transfer(URLDecoder.decode(fileName,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">GBK</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">),</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">GBK</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">ISO-8859-1</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">));<br />        response.setContentLength((</span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);">) file.length());<br /><br />        </span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">[] buffer </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">byte</span><span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">4096</span><span style="color: rgb(0, 0, 0);">];<br />        BufferedOutputStream output </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br />        BufferedInputStream input </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">;<br /><br />        </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> 写缓冲区：</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">try</span><span style="color: rgb(0, 0, 0);"> {<br />            output </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> BufferedOutputStream(response.getOutputStream());<br />            input </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> BufferedInputStream(</span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> FileInputStream(file));<br /><br />            </span><span style="color: rgb(0, 0, 255);">int</span><span style="color: rgb(0, 0, 0);"> n </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br />            </span><span style="color: rgb(0, 0, 255);">while</span><span style="color: rgb(0, 0, 0);"> ((n </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> input.read(buffer, </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(0, 0, 0);">4096</span><span style="color: rgb(0, 0, 0);">)) </span><span style="color: rgb(0, 0, 0);">&gt;</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">) {<br />                output.write(buffer, </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">, n);<br />            }<br />            response.flushBuffer();<br />        }<br />        </span><span style="color: rgb(0, 0, 255);">catch</span><span style="color: rgb(0, 0, 0);"> (Exception e) {<br />        } </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> maybe user cancelled download</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">        </span><span style="color: rgb(0, 0, 255);">finally</span><span style="color: rgb(0, 0, 0);"> {<br />            </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (input </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">) input.close();<br />            </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (output </span><span style="color: rgb(0, 0, 0);">!=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">null</span><span style="color: rgb(0, 0, 0);">) output.close();<br />        }</span></div><br /><br />说明:<br />１。文件名在数据库中保存的编码为URLEncode<br />2.在list.jsp显示的时候多了一次encode,不知为什么，不encode一次还不行，实际上是第二次编码了<br /><br /><br /></span><img src ="http://www.blogjava.net/alex/aggbug/52855.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-06-14 22:48 <a href="http://www.blogjava.net/alex/archive/2006/06/14/52855.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>神奇的javaScript实现的无需服务器支持的WIKI</title><link>http://www.blogjava.net/alex/archive/2006/06/11/52004.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Sun, 11 Jun 2006 07:38:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/06/11/52004.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/52004.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/06/11/52004.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/52004.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/52004.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: key words: wiki tiddlyWiki 客户端wiki 今天的主角是 tiddlywiki这个玩意真不错，N多时候其实说实在的，用服务器并不方便，能有一个放在我自己笔记本硬盘里的wiki，那是多么幸福的事啊  :)今天真的有这样的wiki,纯粹用javaScript + css + html实现的wiki,功能强大，可配置性好，你只需要在里面增加某个标题的内容，就可以实现样式，功能，...&nbsp;&nbsp;<a href='http://www.blogjava.net/alex/archive/2006/06/11/52004.html'>阅读全文</a><img src ="http://www.blogjava.net/alex/aggbug/52004.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-06-11 15:38 <a href="http://www.blogjava.net/alex/archive/2006/06/11/52004.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]CSS入门</title><link>http://www.blogjava.net/alex/archive/2006/06/05/50425.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Mon, 05 Jun 2006 01:53:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/06/05/50425.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/50425.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/06/05/50425.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/50425.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/50425.html</trackback:ping><description><![CDATA[
		<p>key words:  css</p>
		<br />转自:<a href="http://www.blueidea.com/tech/site/2004/1928.asp">http://www.blueidea.com/tech/site/2004/1928.asp</a><br /><br /><p>在了解XHTML代码规范后，我们就要进行CSS布局。首先先介绍一些CSS的入门知识。如果你已经很熟悉了，可以跳过这一节，直接进入下一节。</p><p>CSS是Cascading Style Sheets(层叠样式表)的缩写。是一种对web文档添加样式的简单机制，属于表现层的布局语言。</p><h3>1.基本语法规范</h3><p>分析一个典型CSS的语句：</p><span class="code"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0);">p </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);">COLOR</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);">#FF0000</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">BACKGROUND</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);">#FFFFFF</span><span style="color: rgb(0, 0, 0);">}</span></div><br /></span><ul><li>其中"p"我们称为"选择器"(selectors)，指明我们要给"p"定义样式；</li><li>样式声明写在一对大括号"{}"中；</li><li>COLOR和BACKGROUND称为"属性"(property)，不同属性之间用分号";"分隔；</li><li>"#FF0000"和"#FFFFFF"是属性的值(value)。</li></ul><h3>2.颜色值</h3><p>颜色值可以用RGB值写，例如：<span class="code">color : rgb(255,0,0)</span>，也可以用十六进制写，就象上面例子<span class="code">color:#FF0000</span>。如果十六进制值是成对重复的可以简写，效果一样。例如:#FF0000可以写成#F00。但如果不重复就不可以简写，例如#FC1A1B必须写满六位。</p><h3>3.定义字体</h3><p>web标准推荐如下字体定义方法：</p><span class="code"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0);">body </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);"> font-family </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> "Lucida Grande", Verdana, Lucida, Arial, Helvetica, 宋体,sans-serif</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">}</span></div><br /></span><ul><li>字体按照所列出的顺序选用。如果用户的计算机含有Lucida Grande字体，文档将被指定为Lucida Grande。没有的话，就被指定为Verdana字体，如果也没有Verdana，就指定为Lucida字体，依此类推，；</li><li>Lucida Grande字体适合Mac OS X；</li><li>Verdana字体适合所有的Windows系统；</li><li>Lucida适合UNIX用户</li><li>"宋体"适合中文简体用户;</li><li>如果所列出的字体都不能用，则默认的sans-serif字体能保证调用;</li></ul><h3>4.群选择器</h3><p>当几个元素样式属性一样时，可以共同调用一个声明，元素之间用逗号分隔，：<span class="code"><br /></span></p><p><span class="code"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0);">p, td, li </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);"> font-size </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> 12px </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">}</span></div><br /></span></p><h3>5.派生选择器</h3><p>可以使用派生选择器给一个元素里的子元素定义样式，例如这样：</p><span class="code"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0);">li strong </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);"> font-style </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> italic</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);"> font-weight </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> normal；</span><span style="color: rgb(0, 0, 0);">}</span></div></span><p>就是给li下面的子元素strong定义一个斜体不加粗的样式。</p><h3>6.id选择器</h3><p>用CSS布局主要用层"div"来实现，而div的样式通过"id选择器"来定义。例如我们首先定义一个层</p><span class="code">&lt;div id="menubar"&gt;&lt;/div&gt;</span><p>然后在样式表里这样定义：</p><span class="code"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0);">#menubar </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);">MARGIN</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> 0px</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">BACKGROUND</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> #FEFEFE</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">COLOR</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> #666</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 0, 0);">}</span></div><br /></span><p>其中"menubar"是你自己定义的id名称。注意在前面加"#"号。</p><p>id选择器也同样支持派生，例如：</p><span class="code"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0);">#menubar p </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);"> text-align </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> right</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);"> margin-top </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> 10px</span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">}</span></div><br /></span><p>这个方法主要用来定义层和那些比较复杂，有多个派生的元素。</p><h3>6.类别选择器</h3><p>在CSS里用一个点开头表示类别选择器定义，例如：</p><span class="code"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0);">.14px </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);">color </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> #f60 </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">font-size</span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);">14px </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 0, 0);">}</span></div><br /></span><p>在页面中，用class="类别名"的方法调用：</p><span class="code">&lt;span class="14px"&gt;14px大小的字体&lt;/span&gt;</span><p>这个方法比较简单灵活，可以随时根据页面需要新建和删除。</p><h3>7.定义链接的样式</h3><p>CSS中用四个伪类来定义链接的样式，分别是：a:link、a:visited、a:hover和a : active，例如：</p><span class="code"><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(128, 0, 0);">a:link</span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);">font-weight </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> bold </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">text-decoration </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> none </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">color </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> #c00 </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(128, 0, 0);"><br />a:visited </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);">font-weight </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> bold </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">text-decoration </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> none </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">color </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> #c30 </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(128, 0, 0);"><br />a:hover </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);">font-weight </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> bold </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">text-decoration </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> underline </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">color </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> #f60 </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 0, 0);">}</span><span style="color: rgb(128, 0, 0);"><br />a:active </span><span style="color: rgb(0, 0, 0);">{</span><span style="color: rgb(255, 0, 0);">font-weight </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> bold </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">text-decoration </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> none </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(255, 0, 0);">color </span><span style="color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 0, 255);"> #90 </span><span style="color: rgb(0, 0, 0);">;</span><span style="color: rgb(0, 0, 0);">}</span></div><br /></span><p>以上语句分别定义了"链接、已访问过的链接、鼠标停在上方时、点下鼠标时"的样式。注意，必须按以上顺序写，否则显示可能和你预想的不一样。记住它们的顺序是“LVHA”。</p><p>呵呵，看了这么多，有点头晕吧，实际上CSS的语法规范还有很多，这里列的只是一些常用的，毕竟我们是循序渐进，不可能一口吃成胖子:)</p><img src ="http://www.blogjava.net/alex/aggbug/50425.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-06-05 09:53 <a href="http://www.blogjava.net/alex/archive/2006/06/05/50425.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>整理：web打印</title><link>http://www.blogjava.net/alex/archive/2006/05/26/48424.html</link><dc:creator>Alex</dc:creator><author>Alex</author><pubDate>Fri, 26 May 2006 15:08:00 GMT</pubDate><guid>http://www.blogjava.net/alex/archive/2006/05/26/48424.html</guid><wfw:comment>http://www.blogjava.net/alex/comments/48424.html</wfw:comment><comments>http://www.blogjava.net/alex/archive/2006/05/26/48424.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/alex/comments/commentRss/48424.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/alex/services/trackbacks/48424.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: key words: IE打印 web打印 页面打印 最近又碰到了页面打印，顺便记录一下，本来下午写完了，可惜最近blogjava最近总是出现问题，提交居然失败，只好再来一次.Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function SaveD...&nbsp;&nbsp;<a href='http://www.blogjava.net/alex/archive/2006/05/26/48424.html'>阅读全文</a><img src ="http://www.blogjava.net/alex/aggbug/48424.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/alex/" target="_blank">Alex</a> 2006-05-26 23:08 <a href="http://www.blogjava.net/alex/archive/2006/05/26/48424.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>