﻿<?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-bob-文章分类-others</title><link>http://www.blogjava.net/keweibo/category/25074.html</link><description>一专  Java 多能  C#,Delphi,Powerbuilder ... </description><language>zh-cn</language><lastBuildDate>Thu, 28 Mar 2013 06:50:21 GMT</lastBuildDate><pubDate>Thu, 28 Mar 2013 06:50:21 GMT</pubDate><ttl>60</ttl><item><title>VC：nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12..."错误! （转）</title><link>http://www.blogjava.net/keweibo/articles/396482.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Fri, 15 Mar 2013 07:04:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/396482.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/396482.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/396482.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/396482.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/396482.html</trackback:ping><description><![CDATA[<div>朋友编写一个dll,编译时总出现</div>
<div>"nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12..."错误!</div>
<div>后发现是,<span style="color: red"><strong>其创建dll时选择的时不使用MFC,而后来工程中又添加了与MFC相关的东西</strong></span>.才引起上述问题.</div>
<div>采用如下步骤解决此问题:</div>
<div>1.将工程设置中改为"动态使用MFC"</div>
<div>2.<strong>到C++设置页中,看到Preprocessor Definitions编辑框中同时存在_USRDLL和_AFXDLL, 删除_USRDLL即可</strong>.<br /><br />转自：<a href="http://blog.csdn.net/train_z/article/details/3118754">http://blog.csdn.net/train_z/article/details/3118754</a><br /><br />确认解决了问题，但步骤1，我使用的是&#8220;静态MFC&#8221;</div><img src ="http://www.blogjava.net/keweibo/aggbug/396482.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2013-03-15 15:04 <a href="http://www.blogjava.net/keweibo/articles/396482.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>VC: “LoadLibraryW”: 不能将参数 1 从“const char *”转换为“LPCWSTR”</title><link>http://www.blogjava.net/keweibo/articles/396408.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Wed, 13 Mar 2013 10:59:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/396408.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/396408.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/396408.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/396408.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/396408.html</trackback:ping><description><![CDATA[<p>动态调用DLL<br />通过<br />LoadLibrary<br />GetProcAddress<br />FreeLibrary实现。</p>
<p>原因&nbsp;：工程只支持UNICODE字符</p>
<p>解决方法：</p>
<p><strong style="color: red">工程属性-&gt;配置属性&#8211;&gt;常规&#8212;&gt;字符集&#8212;-&gt;使用多字节符字符集</strong></p>
<p>&nbsp;</p><img src ="http://www.blogjava.net/keweibo/aggbug/396408.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2013-03-13 18:59 <a href="http://www.blogjava.net/keweibo/articles/396408.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>日記過濾器</title><link>http://www.blogjava.net/keweibo/articles/306766.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Mon, 21 Dec 2009 02:35:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/306766.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/306766.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/306766.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/306766.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/306766.html</trackback:ping><description><![CDATA[<code><font color="#7f0055"><strong>轉自:http://www.java2s.com/CN/Code/Java/Servlets/LoggingFilter.htm<br />
import&nbsp;</strong></font><font color="#000000">java.io.*;</font><br />
<font color="#7f0055"><strong>import&nbsp;</strong></font><font color="#000000">javax.servlet.*;</font><br />
<font color="#7f0055"><strong>import&nbsp;</strong></font><font color="#000000">javax.servlet.http.*;</font><br />
<br />
<font color="#7f0055"><strong>public&nbsp;final&nbsp;class&nbsp;</strong></font><font color="#000000">LoggingFilter&nbsp;</font><font color="#7f0055"><strong>implements&nbsp;</strong></font><font color="#000000">Filter&nbsp;</font><br />
<font color="#000000">{</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><strong>private&nbsp;</strong></font><font color="#000000">FilterConfig&nbsp;filterConfig&nbsp;=&nbsp;</font><font color="#7f0055"><strong>null</strong></font><font color="#000000">;</font><br />
<br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><strong>public&nbsp;</strong></font><font color="#7f0055"><strong>void&nbsp;</strong></font><font color="#000000">doFilter</font><font color="#000000">(</font><font color="#000000">ServletRequest&nbsp;request,&nbsp;ServletResponse&nbsp;response,</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">FilterChain&nbsp;chain</font><font color="#000000">)</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><strong>throws&nbsp;</strong></font><font color="#000000">IOException,&nbsp;ServletException&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">{</font><br />
<br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><strong>long&nbsp;</strong></font><font color="#000000">start&nbsp;=&nbsp;System.currentTimeMillis</font><font color="#000000">()</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">String&nbsp;address&nbsp;=&nbsp;&nbsp;request.getRemoteAddr</font><font color="#000000">()</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">String&nbsp;file&nbsp;=&nbsp;</font><font color="#000000">((</font><font color="#000000">HttpServletRequest</font><font color="#000000">)&nbsp;</font><font color="#000000">request</font><font color="#000000">)</font><font color="#000000">.getRequestURI</font><font color="#000000">()</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">chain.doFilter</font><font color="#000000">(</font><font color="#000000">request,&nbsp;response</font><font color="#000000">)</font><font color="#000000">;</font><br />
<br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">filterConfig.getServletContext</font><font color="#000000">()</font><font color="#000000">.log</font><font color="#000000">(</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#2a00ff">"User&nbsp;access!&nbsp;"&nbsp;</font><font color="#000000">+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#2a00ff">"&nbsp;User&nbsp;IP:&nbsp;"&nbsp;</font><font color="#000000">+&nbsp;address&nbsp;+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#2a00ff">"&nbsp;Resource:&nbsp;"&nbsp;</font><font color="#000000">+&nbsp;file&nbsp;+&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#2a00ff">"&nbsp;Milliseconds&nbsp;used:&nbsp;"&nbsp;</font><font color="#000000">+&nbsp;</font><font color="#000000">(</font><font color="#000000">System.currentTimeMillis</font><font color="#000000">()&nbsp;</font><font color="#000000">-&nbsp;start</font><font color="#000000">)&nbsp;</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#000000">)</font><font color="#000000">;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><strong>public&nbsp;</strong></font><font color="#7f0055"><strong>void&nbsp;</strong></font><font color="#000000">destroy</font><font color="#000000">()&nbsp;{&nbsp;}</font><br />
<br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#7f0055"><strong>public&nbsp;</strong></font><font color="#7f0055"><strong>void&nbsp;</strong></font><font color="#000000">init</font><font color="#000000">(</font><font color="#000000">FilterConfig&nbsp;filterConfig</font><font color="#000000">)&nbsp;{</font><br />
<font color="#ffffff">&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#7f0055"><strong>this</strong></font><font color="#000000">.filterConfig&nbsp;=&nbsp;filterConfig;</font><br />
<font color="#ffffff">&nbsp;&nbsp;</font><font color="#000000">}</font><br />
<font color="#000000">}</font></code>
<img src ="http://www.blogjava.net/keweibo/aggbug/306766.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2009-12-21 10:35 <a href="http://www.blogjava.net/keweibo/articles/306766.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title> 用批处理文件删除n天前的文件(轉)</title><link>http://www.blogjava.net/keweibo/articles/296523.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Sat, 26 Sep 2009 06:14:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/296523.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/296523.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/296523.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/296523.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/296523.html</trackback:ping><description><![CDATA[<p>原文:http://blog.csdn.net/leehq/archive/2007/08/03/1723743.aspx<br />
</p>
<p>公司服务器用来备份数据的硬盘过段时间就会被备份文件占满，弄得我老是要登录到服务器去手工删除那些老的文件，有时忘记了就会导致硬盘空间不足而无法备份。<br />
因为只要保留最近几天的备份，如果可以做一个批处理让系统自动删除老备份文件就好了，但是Windows的命令行和Linux的Shell比起来功能差了很多，到底行不行我自己也不清楚。<br />
于是上网查了一下各位大虾发的帖子，再经过自己的摸索和尝试，发现只要花点功夫还是能实现这个功能的。<br />
下面来看看我的实现方法。</p>
<p>如果操作系统是 Windows Server 2003 那就好办了，因为它有一个forfiles命令能够查找满足指定条件的文件，下面是这个命令的用法。<br />
<strong>forfiles /p &lt;目标目录名&gt; /d &lt;天数&gt; /c &lt;执行的命令&gt;<br />
</strong>看看列出的三个参数都有什么用处：<br />
<strong>/p 指定了要在哪个目录里查找文件，默认是当前工作目录，注意不能在目录名后面加斜杠。<br />
/d 指定一个日期或天数，用于比较文件的最后修改日期是否符合条件。<br />
/c 对每个找到的文件执行的命令。<br />
<br />
</strong>例1.要把在C盘根目录下最后修改日期大于或等于2007年7月1日的文件复制到D盘根目录下：<br />
<strong>forfiles /p "c:" /d "2007-7-1" /c "cmd /c copy @path d:\"<br />
</strong>例2.删除在C盘backup目录下最后修改日期在10天前的文件：<br />
<strong>forfiles /p "c:\backup" /d -10 /c "cmd /c echo deleting @file ... &amp;&amp; del /f @path"</strong></p>
<p>看了上面的例子，觉得在 Windows Server 2003 下面要删除老文件很简单吧。<br />
但如果操作系统是 Windows 2000/XP 就比较麻烦，因为它们没有forfiles命令，只能靠自己写批处理来实现了。<br />
下面是我写的批处理文件内容：</p>
<span class="Code">
<p>@echo off</p>
<p>rem ******************************<br />
rem * 按时间删除文件目录的批处理 *<br />
rem ******************************</p>
<p>rem 设置临时目录的路径<br />
set tempDir=%tmp%\remove_%date:~0,10%<br />
if not exist %tempDir% md %tempDir%<br />
rem 设置处理日期的脚本文件的路径<br />
set scriptFile=%tempDir%\get_date.vbs</p>
<p>rem 获得要保留的天数<br />
set days=%~1<br />
if "%days%" == "" goto printUsage<br />
rem 获得目标目录的路径<br />
set dirPath=%~2<br />
if "%dirPath%" == "" set dirPath=.<br />
rem 获得要操作的文件形式<br />
set fileSpec=%~3<br />
if "%fileSpec%" == "" set fileSpec=*.*</p>
<p>rem 生成计算日期的脚本文件并获得删除的截止日期<br />
echo d=date()-%1 &gt; %scriptFile%<br />
echo
s=right("0000" ^&amp; year(d),4) ^&amp; "-" ^&amp; right("00" ^&amp;
month(d),2) ^&amp; "-" ^&amp; right("00" ^&amp; day(d),2) &gt;&gt;
%scriptFile%<br />
echo wscript.echo s &gt;&gt; %scriptFile%<br />
for /f %%i in ('cscript /nologo %scriptFile%') do set lastDate=%%i</p>
<p>rem 处理目标目录里的每个对象<br />
for /f "tokens=1,2,3* delims=&lt;&gt; " %%i in ('dir "%dirPath%\%fileSpec%" /a /-c /tc') do call :proc "%%i" "%%j" "%%k" "%%l"<br />
goto :done</p>
<p>rem 处理目标目录里对象的过程<br />
:proc<br />
rem 获得对象的创建日期并判断是否为有效格式<br />
set fileDate=%~1<br />
echo %fileDate% | findstr "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" &gt; nul<br />
if errorlevel 1 goto end<br />
rem 获得对象的类型<br />
set fileType=%~3<br />
if "%fileType%" == "" goto end<br />
rem 获得对象的名称<br />
set fileName=%~4<br />
if "%fileName%" == "" goto end<br />
if "%fileName%" == "." goto end<br />
if "%fileName%" == ".." goto end<br />
if "%fileName%" == "字节" goto end<br />
if "%fileName%" == "可用字节" goto end<br />
rem 判断对象日期是否小于或等于删除的截止日期<br />
if "%fileDate:~0,10%" leq "%lastDate%" (<br />
&nbsp;echo deleting "%fileName%" ...<br />
&nbsp;if "%fileType%" == "DIR" ( rd /s /q "%dirPath%\%fileName%" ) else ( del /q /f "%dirPath%\%fileName%" )<br />
)<br />
goto end</p>
<p>:error<br />
echo An error occurred during backuping.</p>
<p>:done<br />
rd /s /q %tempDir%<br />
goto end</p>
<p>:printUsage<br />
echo Usage: %0 ^&lt;Days^&gt; [Work directory] [Target file specification (can include wildcards)]<br />
goto end</p>
<p>:end</p>
</span>
<p>这个批处理的语句很多，我表达能力有限，懒得一一解释了。<br />
主要是利用Windows的脚本功能来计算要删除文件的截止日期，然后for加dir命令来提取文件的日期进行判断。</p>
<p>关于forfiles和for的详细信息，可以在Windows的帮助与支持中找到。&nbsp;</p>
<p>附:<br />
</p>
<h2><a href="http://diary.tw/tim/531">forfiles指令介紹</a></h2>
在 WINDOWS 下, 若是要將某些檔案做什麼處理的方式, 我通常使用 VBS 的 SCRIPT 來操作, 不過其實還有更方便簡捷的方法, 看到這篇文章 <a href="http://andyblog.wordpress.com/2008/06/03/windows-server%e4%b8%8b%e7%9a%84%e6%aa%94%e6%a1%88%e8%99%95%e7%90%86%e7%a8%8b%e5%bc%8fforfiles/" target="_blank">windows server下的檔案處理程式Forfiles</a> , 原來其實在 windows 下還有個這麼方便的檔案列舉工具.<br />
<br />
一般最常用的是刪除 log 檔案, 指定目錄, 並指令時間 (例如保留一週, 一週前的刪除), 就可以利用這個指令進行刪除:<br />
<br />
<span style="font-family: 'MingLiU','Serif';">forfiles /p c:\temp /s /m *.log /d -7 /c "cmd /c del @FILE"</span><br />
<br />
或是列舉出指定目錄下的檔案(非目錄)的名稱列出:<br />
<br />
<span style="font-family: 'MingLiU','Serif';">forfiles /p c:\ /c "cmd /c if @isdir==FALSE echo @FILE"</span><br />
<br />
請注意上面的 "FALSE" 要大寫!<br />
<br />
再來看看微軟的官方說明: <a href="http://technet2.microsoft.com/windowsserver/en/library/9660fea1-65c7-48cf-b466-204ba159381e1033.mspx?mfr=true" target="_blank">Forfiles</a><br />
<br />
以下列出該指令的參數說明: (利用 forfiles /? 取得)<br />
<br />
FORFILES [/P pathname] [/M searchmask] [/S]<br />
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; [/C command] [/D [+ | -] {yyyy/MM/dd | dd}]<br />
<br />
描述:<br />
&nbsp; &nbsp; 選取一個檔案 (或一組檔案)，並在檔案上<br />
&nbsp; &nbsp; 執行命令。這對批次工作很有幫助。<br />
<br />
參數清單:<br />
&nbsp; &nbsp; /P &nbsp;&nbsp; pathname &nbsp; &nbsp;&nbsp; 表示要開始搜尋的路徑。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 預設資料夾是目前的<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 目錄 (.)。<br />
<br />
&nbsp; &nbsp; /M &nbsp;&nbsp; searchmask &nbsp;&nbsp; 根據 searchmask 搜尋檔案。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 預設的 searchmask 是 '*'。<br />
<br />
&nbsp; &nbsp; /S &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 指示 forfiles 遞迴搜尋<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 子目錄。例如 "DIR /S"。<br />
<p id="more531_0" class="moreless_top"><span style="cursor: pointer;" onclick="toggleMoreLess(this, '531_0',' more.. ',' less.. '); return false;"><br />
</span></p>
<div id="content531_0" class="moreless_content" style="display: block;"> <br />
&nbsp; &nbsp; /C &nbsp;&nbsp; command &nbsp; &nbsp; &nbsp; 表示每個檔案要執行的命令。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 命令字串應該包含在雙括號<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 之間。 <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 預設的命令是 "cmd /c echo @file"。<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 下列變數可以使用於命令字串:<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @file &nbsp;&nbsp; - 傳回檔案的名稱。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @fname &nbsp; - 只傳回檔案的名稱，<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 不傳附檔名。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @ext &nbsp; &nbsp; - 只傳回檔案的<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 附檔名。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @path &nbsp;&nbsp; - 傳回檔案的完整路徑。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @relpath - 傳回檔案的相對<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 路徑。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @isdir &nbsp; - 如果檔案類型是目錄的話，<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 傳回 "TRUE"，如果是檔案<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 的話，傳回 "FALSE"。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @fsize &nbsp; - 傳回檔案的大小，<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 單位是位元組。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @fdate &nbsp; - 傳回檔案上次修改的<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 日期。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @ftime &nbsp; - 傳回檔案上次修改<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 的時間。<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 要在命令列中包含特殊字元的話，<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 請使用 0xHH 格式的十六<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 進位字元碼 (例如 0x09 代表 tab)。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 內部的 CMD.exe 命令應該<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 以 "cmd /c" 執行。<br />
<br />
&nbsp; &nbsp; /D &nbsp;&nbsp; date &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 選取檔案上次修改的時間大於、<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 等於 (+) 或小於或等於 (-)、<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 使用 "yyyy/MM/dd" 格式表示指定的日期;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 或選取檔案日期上次修改<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 的時間大於或等於 (+)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 目前的日期再加上"dd" 天、<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 小於或等於 (-) 目前的日期減去 "dd" 天。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 有效的 "dd" 可以是介於<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0 - 32768 之間的數字。<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 如果未指定，"+" 將被視為預設符號。<br />
<br />
&nbsp; &nbsp; /? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; 顯示這個說明訊息。<br />
<br />
範例:<br />
&nbsp; &nbsp; FORFILES /?<br />
&nbsp; &nbsp; FORFILES&nbsp; <br />
&nbsp; &nbsp; FORFILES /P C:\WINDOWS /S /M DNS*.* <br />
&nbsp; &nbsp; FORFILES /S /M *.txt /C "cmd /c type @file | more"<br />
&nbsp; &nbsp; FORFILES /P C:\ /S /M *.bat<br />
&nbsp; &nbsp; FORFILES /D -30 /M *.exe<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; /C "cmd /c echo @path 0x09 was changed 30 days ago"<br />
&nbsp; &nbsp; FORFILES /D 2001/01/01<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; /C "cmd /c echo @fname is new since Jan 1st 2001"<br />
&nbsp; &nbsp; FORFILES /D +2008/7/13 /C "cmd /c echo @fname is new today"<br />
&nbsp; &nbsp; FORFILES /M *.exe /D +1<br />
&nbsp; &nbsp; FORFILES /S /M *.doc /C "cmd /c echo @fsize" <br />
&nbsp; &nbsp; FORFILES /M *.txt /C "cmd /c if @isdir==FALSE notepad.exe @file"<br />
</div>
<div class="tagbox">
<!-- AddThis Bookmark Button END -->
</div>
<img src ="http://www.blogjava.net/keweibo/aggbug/296523.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2009-09-26 14:14 <a href="http://www.blogjava.net/keweibo/articles/296523.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>CSV格式.收集</title><link>http://www.blogjava.net/keweibo/articles/255417.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Thu, 19 Feb 2009 03:23:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/255417.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/255417.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/255417.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/255417.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/255417.html</trackback:ping><description><![CDATA[<span  style="font-family: simsun; "><br />
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="time" style="font-size: 10px; color: #666666; text-align: left; padding-top: 4px; padding-right: 0px; padding-bottom: 4px; padding-left: 20px; font-family: Arial, Helvetica, sans-serif; ">2007-10-18 16:16:46</td>
        </tr>
    </tbody>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0" style="table-layout: fixed; ">
    <tbody>
        <tr>
            <td class="logt" style="font-size: 12px; line-height: 18px; color: #2a2a2a; text-align: left; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; ">
            <p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; ">&#160;</p>
            <p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; "><span lang="EN-US" style="font-family: Arial; ">CSV</span><span style="font-family: 宋体; ">其实就是</span><span lang="EN-US" style="font-family: Arial; ">COMMA SEPARATED VALUE</span><span style="font-family: 宋体; ">的缩写，出现在档案总管中的档案类型是「逗号分格」，依计算机原来的设定，如果直接点选该档案，计算机将以</span><span lang="EN-US" style="font-family: Arial; ">EXCEL</span><span style="font-family: 宋体; ">的模式开启该档案。</span><span style="font-family: Arial; ">&#160;</span><span style="font-family: 宋体; ">但建议您千万不要这么做，因为</span><span lang="EN-US" style="font-family: Arial; ">CSV</span><span style="font-family: 宋体; ">档如果以</span><span lang="EN-US" style="font-family: Arial; ">EXCEL</span><span style="font-family: 宋体; ">开启，由于计算机档案数据转换的原因，会将其</span><span lang="EN-US" style="font-family: Arial; ">CRC</span><span style="font-family: 宋体; ">之数值改做科学记号方式储存，而造成档案中的</span><span lang="EN-US" style="font-family: Arial; ">CRC</span><span style="font-family: 宋体; ">值发生错误。</span><span style="font-family: Arial; ">&#160;</span><span style="font-family: 宋体; ">这也是笔者初出茅庐时所得到的惨痛经验，但如果想一窥</span><span lang="EN-US" style="font-family: Arial; ">CSV</span><span style="font-family: 宋体; ">档的真实面貌，笔者建议您</span><span style="color: red; "><span style="font-family: 宋体; "><strong>使用</strong></span><span lang="EN-US" style="font-family: Arial; "><strong>WORDPAD</strong></span><span style="font-family: 宋体; "><strong>或是记事本（</strong></span><span lang="EN-US" style="font-family: Arial; "><strong>NOTE</strong></span><span style="font-family: 宋体; "><strong>）来开启，再则先另存新档后用</strong></span><span lang="EN-US" style="font-family: Arial; "><strong>EXCEL</strong></span><span style="font-family: 宋体; "><strong>开启</strong></span></span><span style="font-family: 宋体; ">，也是方法之一。</span><span style="font-family: Arial; ">&#160;</span><span style="font-family: 宋体; ">开启后的</span><span lang="EN-US" style="font-family: Arial; ">CSV</span><span style="font-family: 宋体; ">档包含了四或五个字段（部分），由左至右分别记载着：文件名称（</span><span lang="EN-US" style="font-family: Arial; ">XXXX.JPG</span><span style="font-family: 宋体; ">）、档案大小（以</span><span lang="EN-US" style="font-family: Arial; ">BYTE</span><span style="font-family: 宋体; ">为单位）、</span><span lang="EN-US" style="font-family: Arial; ">CRC32</span><span style="font-family: 宋体; ">值（八个英文字母或数字组成）、档案路径（档案储存的子目录名称）和档案内容描述（一般来说都是明星的英文姓名甚或是专辑名称，也可能空白）。</span><span style="font-family: Arial; ">&#160;</span><span style="font-family: 宋体; ">而其中第四栏「档案路径」因为每个人储存整理图档的方式不同，所以本栏通常不存在，而一般有含有「档案路径」这栏的</span><span lang="EN-US" style="font-family: Arial; ">CSV</span><span style="font-family: 宋体; ">档，又称为</span><span lang="EN-US" style="font-family: Arial; ">ECSV</span><span style="font-family: 宋体; ">档案</span><span lang="EN-US" style="font-family: Arial; "><o:p></o:p></span></p>
            <p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; "><span lang="EN-US" style="font-family: Arial; "><o:p>&#160;</o:p></span></p>
            <p><span lang="EN-US" style="font-size: 10.5pt; "><a href="http://www.hiads.cn/x/tag/csv" style="color: #000000; text-decoration: none; "><font face="宋体">CSV</font></a></span><span style="font-size: 10.5pt; "><font face="宋体">即<span lang="EN-US">Comma Separate Values</span>的缩写，现在常见到这种格式的文件，例如<span lang="EN-US">Google adsense</span>的自定义报表就有这种格式。一般来说<span lang="EN-US">CSV</span>格式是将数据用引号<span lang="EN-US">,</span>逗号分开的文件格式<span lang="EN-US">. &#160;<o:p></o:p></span></font></span></p>
            <p><span lang="EN-US" style="font-size: 10.5pt; "><font face="宋体">The CSV (&#8221;Comma Separated Value&#8221;) file format is often used to exchange data between disparate applications. The file format, as it is used in Microsoft Excel, has become a pseudo standard throughout the industry, even among non-Microsoft platforms.<o:p></o:p></font></span></p>
            <p><font face="宋体"><span lang="EN-US" style="font-size: 10.5pt; ">CSV</span><span style="font-size: 10.5pt; ">文件格式经常被用于转换<u>不同内容（<span lang="EN-US">disparate applications</span>）</u>之间的数据。这种文件格式，随着其应用于<span lang="EN-US">Microsoft Excel</span>，它在工业甚至是非<span lang="EN-US">Microsoft&#160;</span>平台已经成为一个<u>不符合实际（<span lang="EN-US">pseudo</span>）</u>的标准了<span lang="EN-US"><o:p></o:p></span></span></font></p>
            <p><span lang="EN-US" style="font-size: 10.5pt; "><font face="宋体">As is the case with most exchange formats since XML, CSV files have become somewhat of a legacy format. New applications that wish to include an export format will generally use XML today (though there may be exceptions). In legacy systems though (pre-XML), CSV files had indeed become a de facto industry standard. Just as there are still billions of lines of CoBOL code in use today that need to be maintained, support for a legacy standard such as CSV is likely to be required long after it has stopped being implemented in new designs.<o:p></o:p></font></span></p>
            <p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; "><span style="font-family: 宋体; ">自从</span><span lang="EN-US"><font face="Times New Roman">XML</font></span><span style="font-family: 宋体; ">、</span><span lang="EN-US"><font face="Times New Roman">CSV</font></span><span style="font-family: 宋体; ">文件成为一种<u>传统格式后，它就是很多交换格式的一种现象了。（</u></span><span lang="EN-US"><font face="Times New Roman">As is the case with most exchange formats since XML, CSV files have become somewhat of a legacy format.</font></span><u><span style="font-family: 宋体; ">）。</span></u><span style="font-family: 宋体; ">渴望包含一种输出格式的新的应用将主要运用今天的</span><span lang="EN-US"><font face="Times New Roman">XML</font></span><span style="font-family: 宋体; ">（尽管也可能有一些例外）。在传统系统中，虽然</span><span lang="EN-US"><font face="Times New Roman">CSV</font></span><span style="font-family: 宋体; ">文件已经确实成为一种</span><u><span lang="EN-US"><font face="Times New Roman">de facto</font></span></u><span style="font-family: 宋体; ">企业标准了。尽管今天还有数十亿条</span><span lang="EN-US"><font face="Times New Roman">CoBOL</font></span><span style="font-family: 宋体; ">代码在应用，但我们确实需要一种传统格式来支持。就像</span><span lang="EN-US"><font face="Times New Roman">CSV</font></span><span style="font-family: 宋体; ">是在它已经停止被应用于新的设计之后才被逐渐接受的。</span><span lang="EN-US"><o:p></o:p></span></p>
            <p class="MsoNormal" align="left" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">具体来说，格式如下：<span lang="EN-US"><o:p></o:p></span></span></p>
            <ul type="disc" style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
                <li class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">每条记录占一行<span lang="EN-US"><o:p></o:p></span></span></li>
                <li class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">以逗号为分隔符<span lang="EN-US"><o:p></o:p></span></span></li>
                <li class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">逗号前后的空格会被忽略<span lang="EN-US"><o:p></o:p></span></span></li>
                <li class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">字段中包含有逗号，该字段必须用双引号括起来<span lang="EN-US"><o:p></o:p></span></span></li>
                <li class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">字段中包含有换行符，该字段必须用双引号括起来<span lang="EN-US"><o:p></o:p></span></span></li>
                <li class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">字段前后包含有空格，该字段必须用双引号括起来<span lang="EN-US"><o:p></o:p></span></span></li>
                <li class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">字段中的双引号用两个双引号表示<span lang="EN-US"><o:p></o:p></span></span></li>
                <li class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">字段中如果有双引号，该字段必须用双引号括起来<span lang="EN-US"><o:p></o:p></span></span></li>
                <li class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span style="font-family: 宋体; ">第一条记录，可以是字段名<span lang="EN-US"><o:p></o:p></span></span></li>
            </ul>
            <p class="MsoNormal" align="left" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; text-align: left; "><span lang="EN-US" style="font-family: 宋体; ">windows</span><span style="font-family: 宋体; ">平台下一般将<span lang="EN-US">CSV</span>文件定义为<span lang="EN-US">xml</span>后缀，用文本编辑器就可以打开。<span lang="EN-US"><o:p></o:p></span></span></p>
            <p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0pt; margin-left: 0cm; "><span lang="EN-US"><font face="Times New Roman">csv</font></span><span style="font-family: 宋体; ">文件的特点主要有以下几个：</span><span lang="EN-US"><font face="Times New Roman">&#160;&#160;&#160;<br />
            &#160; 1.</font></span><span style="font-family: 宋体; ">文件结构简单，基本上和文本的差别不大；</span><span lang="EN-US"><font face="Times New Roman">&#160;&#160;&#160;<br />
            &#160; 2.</font></span><span style="font-family: 宋体; ">可以和</span><span lang="EN-US"><font face="Times New Roman">microExcle</font></span><span style="font-family: 宋体; ">进行转换，这是一个很大的优点，很容易进行察看模式转换，但是如果你同样的</span><span lang="EN-US"><font face="Times New Roman">csv</font></span><span style="font-family: 宋体; ">文件和将其转换成</span><span lang="EN-US"><font face="Times New Roman">xls</font></span><span style="font-family: 宋体; ">文件后的</span><span lang="EN-US"><font face="Times New Roman">size</font></span><span style="font-family: 宋体; ">比较就更加明白他在</span><span lang="EN-US"><font face="Times New Roman">size</font></span><span style="font-family: 宋体; ">上的优势了。</span><span lang="EN-US"><font face="Times New Roman">&#160;&#160;&#160;<br />
            &#160; 3.</font></span><span style="font-family: 宋体; ">由于其简单的存储方式，一方面可以减少存储信息的容量，这样有利于网络传输以及客户端的再处</span><span lang="EN-US"><font face="Times New Roman">&#160;&#160;&#160;</font></span><span style="font-family: 宋体; ">理；同时由于是一堆没有任何说明的数据，具备基本的安全性。</span></p>
            </td>
        </tr>
    </tbody>
</table>
</span>
<img src ="http://www.blogjava.net/keweibo/aggbug/255417.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2009-02-19 11:23 <a href="http://www.blogjava.net/keweibo/articles/255417.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>一个分页实现例子</title><link>http://www.blogjava.net/keweibo/articles/156515.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Sun, 28 Oct 2007 11:05:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/156515.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/156515.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/156515.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/156515.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/156515.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp;只有注册用户登录后才能阅读该文。<a href='http://www.blogjava.net/keweibo/articles/156515.html'>阅读全文</a><img src ="http://www.blogjava.net/keweibo/aggbug/156515.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-10-28 19:05 <a href="http://www.blogjava.net/keweibo/articles/156515.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>jspSmartUpload上传下载全攻略</title><link>http://www.blogjava.net/keweibo/articles/153564.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Wed, 17 Oct 2007 06:24:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/153564.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/153564.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/153564.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/153564.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/153564.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;一、安装篇　　jspSmartUpload是由www.jspsmart.com网站开发的一个可免费使用的全功能的文件上传下载组件，适于嵌入执行上传下载操作的JSP文件中。该组件有以下几个特点：1、使用简单。在JSP文件中仅仅书写三五行JAVA代码就可以搞定文件的上传或下载，方便。2、能全程控制上传。利用jspSmartUpload组件提供的对象及其操作方...&nbsp;&nbsp;<a href='http://www.blogjava.net/keweibo/articles/153564.html'>阅读全文</a><img src ="http://www.blogjava.net/keweibo/aggbug/153564.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-10-17 14:24 <a href="http://www.blogjava.net/keweibo/articles/153564.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>HTML在线编辑器的调用方法和使用方法详解</title><link>http://www.blogjava.net/keweibo/articles/152314.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Fri, 12 Oct 2007 05:15:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/152314.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/152314.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/152314.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/152314.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/152314.html</trackback:ping><description><![CDATA[HTML在线编辑器不需要懂得使用Dreamweaver，会用Word就会使用此编辑器，在文章系统或者是新闻系统需要文字编辑的web程序中非常实用。 <br />
但是如何将html编辑器嵌入到web页中和怎么取得里面的数据呢？！ <br />
首先我们假定我们所要调用得HTML在线编辑器放在一个单独得页面中，文件名是gledit.htm。 <br />
HTML在线编辑器有两种基本调用方法 <br />
<span style="color: #ff0000"><strong>一、使用object调用: </strong></span><br />
1、怎么在web页中嵌入html编辑器： 我们在需要嵌入得位置加入以下html代码<span style="color: red">：&lt;object id=doc_html data="gledit.htm" width=530 height=320 type=text/x-scriptlet VIEWASTEXT&gt;&lt;/object&gt; <br />
</span>其中object标签里面得data后面接得数据就是我们所要调用得在线编辑器页得路径，id就是我们调用object得id，<span style="color: red">后面取编辑器中得数据时就要用到这个id</span>。Width和height就是编辑器得高度和宽度了。 <br />
2、怎么取得html编辑器中的数据：所有需要提交的内容我们都是放在一个表单里面，同样利用object调用的编辑器也放在这个表单里面，同时<span style="color: red">我们可以设置一个隐藏的文本区域(&lt;textarea name="content" style="display:none"&gt;&lt;/textarea&gt;或&lt;INPUT TYPE="hidden" name="content"&gt;)用以在提交的时候临时保存html在线编辑器的数据</span>，因为在asp或者jsp，php中不能直接获取表单中的object的内容，所以我们必须借助隐藏文本区域来获取数据。我们在表单提交的同时将object里面的内容复制到隐藏的文本区域中。详细代码如下： <br />
<span style="color: #ff0000">&lt;script language="javascript"&gt; <br />
function CheckForm() <br />
{ <br />
document.form1.<span style="color: #000000">content</span>.value=document.form1.<span style="color: #000000">doc_html</span>.value; <br />
} <br />
&lt;/script&gt; <br />
</span><span style="color: #0000ff">&lt;form method="post" action="add_news_save.asp" onsubmit="CheckForm()" name="form1"&gt; <br />
&lt;object id=doc_html name= doc_html style="LEFT: 0px; TOP: 0px" data=" gledit.htm" width=530 height=320 type=text/x-scriptlet VIEWASTEXT&gt;&lt;/object&gt; <br />
&lt;input type="hidden" name="content" &gt; <br />
&lt;/form&gt; </span><br />
这样在后台处理的页面中我们就可以直接通过取隐藏区域content的数据来获取html在线编辑器的数据。 <br />
3、怎么在文本编辑器中加入上传本机图片到html在线编辑器中：首先我们使得在点击插入图片的按钮时弹出一个上传图片的窗口，我们利用自己写的程序来实现上传本机图片到服务器上，然后我们需要记录图片的路径，然后通过html在线编辑器的值中加入显示图片的html标签。详细说明及代码如下： <br />
在编辑器中我们在插入图片的按钮上加入事件onclick="window.open('img_upload.asp','img_upload','width=481 height=190')"&gt;在'img_upload.asp'中我们将提交的图片上传到服务器制定目录然后记录图片路径 <br />
&lt;script language=javascript&gt; <br />
var src='&lt;%="upload/"&amp;newname%&gt;'; <br />
opener.form1. doc_html.value +="&lt;img border=0 src="+src+"&gt;"; <br />
window.close(); <br />
&lt;/script&gt; <br />
这样就实现了简单的将上传的图片插入到编辑器中。 <br />
4、怎么在编辑修改文章的时候调用HTML在线编辑器来修改数据：当我们把在添加的时候将HTML在线编辑器来修改数据提交到数据库后我们还需要能将数据库的内容用HTML在线编辑器来修改数据。首先我们在表单中加入一个隐藏区域来放置数据库中的内容，例如&lt;TEXTAREA style="display:none" NAME="content" ROWS="20" COLS="70"&gt;&lt;%= rs("Content")%&gt;&lt;/TEXTAREA&gt;，要注意这里我们用隐藏的textarea而不能用隐藏的input，因为数据里面可能包含了回车换行，所以如果我们使用&lt;INPUT TYPE="hidden" name=content value="&lt;%=(rs("Content")%&gt;"&gt;很可能因为&lt;%=(rs("Content")%&gt;有换行而出现HTML错误（value=后面接的数据必须保证是在一行，否则出错）。然后按照前面介绍的方法使用object调用HTML在线编辑器，方法和代码同上，现在我们要做的其实就是提交时候的逆过程，我们只要将隐藏文本区域的内容复制到HTML在线编辑器就可以了，在这里我们在body里面加上&lt;body onload="document.form1. doc_html.value=document.form1.content.value"&gt;，这样在页面装载完的时候就可以将数据库中的内容放入HTML在线编辑器中编辑了，提交过程和上面介绍的一样，在此就不赘述了。 <br />
<p><strong><span style="color: #ff0000"><strong>二、使用iframe调用（有些和object调用重复的地方就简单描述一下）</strong> </span></strong><br />
1、 怎么在web页中嵌入：我们在需要嵌入得位置加入以下html代码<span style="color: #ff0000">：&lt;IFRAME SRC="gledit.htm" id='content_html' style="LEFT: 0px; POSITION: absolute; TOP: 0px;z-index:0" width="100%" height="100%"&gt;&lt;/IFRAME&gt;</span>其中"src="后面接得数据就是我们所要调用得在线编辑器页得路径，id就是我们调用IFRAME得id，Width和height就是编辑器得高度和宽度了。 <br />
2、 怎么取得html编辑器中的数据：同样所有需要提交的内容我们都是放在一个表单里面，<span style="color: #ff0000">同时我们可以设置一个隐藏的文本区域(&lt;textarea name="content" style="display:none"&gt;&lt;/textarea&gt;或&lt;INPUT TYPE="hidden" name="content"&gt;</span>)用以在提交的时候临时保存html在线编辑器的数据，我们借助隐藏文本区域来获取数据。我们在表单提交的同时将object里面的内容复制到隐藏的文本区域中。详细代码如下： <br />
function subchk(cmd) <br />
{ <br />
document.form1.content.value= <span style="color: #0000ff"><strong>window.content_html.getHTML(); </strong></span><br />
} <br />
&lt;/SCRIPT&gt; <br />
&lt;FORM METHOD=POST ACTION="Article_add_save.gl" name="form1" onsubmit=" subchk()"&gt; <br />
&lt;input type="hidden" name="content" &gt; <br />
&lt;IFRAME SRC="gledit.htm" id='content_html' style="LEFT: 0px; POSITION: absolute; TOP: 0px;z-index:0" width="100%" height="100%"&gt;&lt;/IFRAME&gt; <br />
&lt;/FORM&gt; <br />
在后台处理的页面中我们就可以直接通过取隐藏区域content的数据来获取html在线编辑器的数据。 <br />
2、怎么取得html编辑器中的数据：所有需要提交的内容我们都是放在一个表单里面，同样利用object调用的编辑器也放在这个表单里面，同时我们可以设置一个隐藏的文本区域(&lt;textarea name="content" style="display:none"&gt;&lt;/textarea&gt;或&lt;INPUT TYPE="hidden" name="content"&gt;)用以在提交的时候临时保存html在线编辑器的数据，因为在asp或者jsp，php中不能直接获取表单中的object的内容，所以我们必须借助隐藏文本区域来获取数据。我们在表单提交的同时将object里面的内容复制到隐藏的文本区域中。详细代码如下： <br />
&lt;script language="javascript"&gt; <br />
function CheckForm() <br />
{ <br />
document.form1.content.value=document.form1.doc_html.value; <br />
} <br />
&lt;/script&gt; <br />
&lt;form method="post" action="add_news_save.asp" onsubmit="CheckForm()" name="form1"&gt; <br />
&lt;object id=doc_html name= doc_html style="LEFT: 0px; TOP: 0px" data=" gledit.htm" width=530 height=320 type=text/x-scriptlet VIEWASTEXT&gt;&lt;/object&gt; <br />
&lt;input type="hidden" name="content" &gt; <br />
&lt;/form&gt; <br />
这样在后台处理的页面中我们就可以直接通过取隐藏区域content的数据来获取html在线编辑器的数据。 <br />
3、怎么在文本编辑器中加入上传本机图片到html在线编辑器中：首先我们使得在点击插入图片的按钮时弹出一个上传图片的窗口，我们利用自己写的程序来实现上传本机图片到服务器上，然后我们需要记录图片的路径，然后通过在调用html在线编辑器的web页中写一个函数在光标的位置插入显示图片的html标签。详细说明及代码如下： <br />
在编辑器中我们在插入图片的按钮上加入事件onclick="window.open('img_upload.asp','img_upload','width=481 height=190')"&gt;在调用编辑器的页面中我们定义好插入html代码到编辑器的函数 <br />
&lt;script language=javascript&gt; <br />
function insertHtml(HtmlCode) <br />
{ <br />
var win=window.content_html.idEditbox.document; <br />
window.content_html.idEditbox.focus();//是编辑器获得焦点，放置代码插入在编辑器外地方 <br />
win.selection.createRange().pasteHTML(HtmlCode)//在光标的位置插入html代码 <br />
} <br />
&lt;/script&gt; <br />
在处理上传图片的文件中，我们调用父窗口的函数插入html代码 <br />
&lt;script language=javascript&gt; <br />
var src='&lt;%=" upload/"&amp;newname%&gt;'; <br />
var htmlcodes; <br />
htmlcodes = "&lt;img src='"+src+"' alt='&lt;%=theForm("alt")%&gt;' align='&lt;%=theForm("align")%&gt;' border='&lt;%=theForm("border")%&gt;' hspace='&lt;%=theForm("hspace")%&gt;' vspace='&lt;%=theForm("vspace")%&gt;'&gt;"; <br />
opener.insertHtml(htmlcodes) <br />
window.close(); <br />
&lt;/script&gt; <br />
这样就实现了简单的将上传的图片插入到编辑器中。 <br />
4、 怎么在编辑修改文章的时候调用HTML在线编辑器来修改数据：当我们把在添加的时候将HTML在线编辑器来修改数据提交到数据库后我们还需要能将数据库的内容用HTML在线编辑器来修改数据。首先我们在表单中加入一个隐藏区域来放置数据库中的内容，例如&lt;TEXTAREA style="display:none" NAME="content" ROWS="20" COLS="70"&gt;&lt;%= rs("Content")%&gt;&lt;/TEXTAREA&gt;，在这里我们在调用编辑器的iframe里面加上&lt;IFRAME SRC="gledit.htm" id='content_html' style="LEFT: 0px; POSITION: absolute; TOP: 0px;z-index:0" width="100%" height="100%" onload="window.content_html.idEditbox.document.body.innerHTML=document.form1.content.value"&gt;&lt;/IFRAME&gt;，这样在页面装载完的时候就可以将数据库中的内容放入HTML在线编辑器中编辑了，提交过程和上面介绍的一样，在此就不赘述了。 </p>
<p>这里只是简单的向大家介绍了一下如何来调用html在线编辑器，具体代码并未一一列出。</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/152314.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-10-12 13:15 <a href="http://www.blogjava.net/keweibo/articles/152314.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA程序员面试32问</title><link>http://www.blogjava.net/keweibo/articles/145316.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Sat, 15 Sep 2007 02:36:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/145316.html</guid><description><![CDATA[第一，谈谈final， finally， finalize的区别。
<p>&nbsp;&nbsp;&nbsp; 第二，Anonymous Inner Class （匿名内部类） 是否可以extends（继承）其它类，是否可以implements（实现）interface（接口）？ </p>
<p>&nbsp;&nbsp;&nbsp; 第三，Static Nested Class 和 Inner Class的不同，说得越多越好（面试题有的很笼统）。 </p>
<p>&nbsp;&nbsp;&nbsp; 第四，&amp;和&amp;&amp;的区别。 </p>
<p>&nbsp;&nbsp;&nbsp; 第五，HashMap和Hashtable的区别。 </p>
<p>&nbsp;&nbsp;&nbsp; 第六，Collection 和 Collections的区别。 </p>
<p>&nbsp;&nbsp;&nbsp; 第七，什么时候用assert. </p>
<p>&nbsp;&nbsp;&nbsp; 第八，GC是什么？ 为什么要有GC？ </p>
<p>&nbsp;&nbsp;&nbsp; 第九，String s = new String（"xyz"）；创建了几个String Object？ </p>
<p>&nbsp;&nbsp;&nbsp; 第十，Math.round（11.5）等於多少？ Math.round（-11.5）等於多少？ </p>
<p>&nbsp;&nbsp;&nbsp; 第十一，short s1 = 1； s1 = s1 + 1；有什么错？ short s1 = 1； s1 += 1；有什么错？ </p>
<p>&nbsp;&nbsp;&nbsp; 第十二，sleep（） 和 wait（） 有什么区别？ </p>
<p>&nbsp;&nbsp;&nbsp; 第十三，Java有没有goto？ </p>
<p>&nbsp;&nbsp;&nbsp; 第十四，数组有没有length（）这个方法？ String有没有length（）这个方法？ </p>
<p>&nbsp;&nbsp;&nbsp; 第十五，Overload和Override的区别。Overloaded的方法是否可以改变返回值的类型？ </p>
<p>&nbsp;&nbsp;&nbsp; 第十六，Set里的元素是不能重复的，那么用什么方法来区分重复与否呢？ 是用==还是equals（）？ 它们有何区别？ </p>
<p>&nbsp;&nbsp;&nbsp; 第十七，给我一个你最常见到的runtime exception. </p>
<p>&nbsp;&nbsp;&nbsp; 第十八，error和exception有什么区别？ </p>
<p>&nbsp;&nbsp;&nbsp; 第十九，List， Set， Map是否继承自Collection接口？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十，abstract class和interface有什么区别？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十一，abstract的method是否可同时是static，是否可同时是native，是否可同时是synchronized？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十二，接口是否可继承接口？ 抽象类是否可实现（implements）接口？ 抽象类是否可继承实体类（concrete class）？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十三，启动一个线程是用run（）还是start（）？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十四，构造器Constructor是否可被override？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十五，是否可以继承String类？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十六，当一个线程进入一个对象的一个synchronized方法后，其它线程是否可进入此对象的其它方法？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十七，try {}里有一个return语句，那么紧跟在这个try后的finally {}里的code会不会被执行，什么时候被执行，在return前还是后？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十八，编程题： 用最有效率的方法算出2乘以8等於几？ </p>
<p>&nbsp;&nbsp;&nbsp; 第二十九，两个对象值相同（x.equals（y） == true），但却可有不同的hash code，这句话对不对？ </p>
<p>&nbsp;&nbsp;&nbsp; 第三十，当一个对象被当作参数传递到一个方法后，此方法可改变这个对象的属性，并可返回变化后的结果，那么这里到底是值传递还是引用传递？ </p>
<p>&nbsp;&nbsp;&nbsp; 第三十一，swtich是否能作用在byte上，是否能作用在long上，是否能作用在String上？ </p>
<p>&nbsp;&nbsp;&nbsp; 第三十二，编程题： 写一个Singleton出来。 </p>
<p>以下是答案 </p>
<p>&nbsp;&nbsp;&nbsp; 第一，谈谈final， finally， finalize的区别。 </p>
<p>&nbsp;&nbsp;&nbsp; final？修饰符（关键字）如果一个类被声明为final，意味着它不能再派生出新的子类，不能作为父类被继承。因此一个类不能既被声明为 abstract的，又被声明为final的。将变量或方法声明为final，可以保证它们在使用中不被改变。被声明为final的变量必须在声明时给定初值，而在以后的引用中只能读取，不可修改。被声明为final的方法也同样只能使用，不能重载finally？再异常处理时提供 finally 块来执行任何清除操作。如果抛出一个异常，那么相匹配的 catch 子句就会执行，然后控制就会进入 finally 块（如果有的话）。 </p>
<p>&nbsp;&nbsp;&nbsp; finalize？方法名。Java 技术允许使用 finalize（） 方法在垃圾收集器将对象从内存中清除出去之前做必要的清理工作。这个方法是由垃圾收集器在确定这个对象没有被引用时对这个对象调用的。它是在 Object 类中定义的，因此所有的类都继承了它。子类覆盖 finalize（） 方法以整理系统资源或者执行其他清理工作。finalize（） 方法是在垃圾收集器删除对象之前对这个对象调用的。 </p>
<p>&nbsp;&nbsp;&nbsp; 第二，Anonymous Inner Class （匿名内部类） 是否可以extends（继承）其它类，是否可以implements（实现）interface（接口）？ </p>
<p>&nbsp;&nbsp;&nbsp; 匿名的内部类是没有名字的内部类。不能extends（继承） 其它类，但一个内部类可以作为一个接口，由另一个内部类实现。 </p>
<p>&nbsp;&nbsp;&nbsp; 第三，Static Nested Class 和 Inner Class的不同，说得越多越好（面试题有的很笼统）。 </p>
<p>&nbsp;&nbsp;&nbsp; Nested Class （一般是C++的说法），Inner Class （一般是JAVA的说法）。Java内部类与C++嵌套类最大的不同就在于是否有指向外部的引用上。具体可见http： //www.frontfree.net/articles/services/view.asp？id=704&amp;page=1 </p>
<p>&nbsp;&nbsp;&nbsp; 注： 静态内部类（Inner Class）意味着1创建一个static内部类的对象，不需要一个外部类对象，2不能从一个static内部类的一个对象访问一个外部类对象 </p>
<p>&nbsp;&nbsp;&nbsp; 第四，&amp;和&amp;&amp;的区别。 </p>
<p>&nbsp;&nbsp;&nbsp; &amp;是位运算符。&amp;&amp;是布尔逻辑运算符。 </p>
<p>&nbsp;&nbsp;&nbsp; 第五，HashMap和Hashtable的区别。 </p>
<p>&nbsp;&nbsp;&nbsp; 都属于Map接口的类，实现了将惟一键映射到特定的值上。 </p>
<p>&nbsp;&nbsp;&nbsp; HashMap 类没有分类或者排序。它允许一个 null 键和多个 null 值。 </p>
<p>&nbsp;&nbsp;&nbsp; Hashtable 类似于 HashMap，但是不允许 null 键和 null 值。它也比 HashMap 慢，因为它是同步的。 </p>
<p>&nbsp;&nbsp;&nbsp; 第六，Collection 和 Collections的区别。 </p>
<p>&nbsp;&nbsp;&nbsp; Collections是个java.util下的类，它包含有各种有关集合操作的静态方法。 </p>
<p>&nbsp;&nbsp;&nbsp; Collection是个java.util下的接口，它是各种集合结构的父接口。 </p>
<p>第七，什么时候用assert。&nbsp; </p>
<p>　　断言是一个包含布尔表达式的语句，在执行这个语句时假定该表达式为 true。如果表达式计算为 false，那么系统会报告一个 AssertionError。它用于调试目的：&nbsp; </p>
<p>assert(a &gt; 0); // throws an AssertionError if a &lt;= 0&nbsp; </p>
<p>　　断言可以有两种形式：&nbsp; </p>
<p>　　assert Expression1 ;&nbsp; <br />
　　assert Expression1 : Expression2 ;&nbsp; </p>
<p>　　Expression1 应该总是产生一个布尔值。&nbsp; <br />
　　Expression2 可以是得出一个值的任意表达式。这个值用于生成显示更多调试信息的 String 消息。&nbsp; <br />
断言在默认情况下是禁用的。要在编译时启用断言，需要使用 source 1.4 标记：&nbsp; </p>
<p>　　javac -source 1.4 Test.java&nbsp; </p>
<p>　　要在运行时启用断言，可使用 -enableassertions 或者 -ea 标记。&nbsp; <br />
　　要在运行时选择禁用断言，可使用 -da 或者 -disableassertions 标记。&nbsp; <br />
　　要系统类中启用断言，可使用 -esa 或者 -dsa 标记。还可以在包的基础上启用或者禁用断言。&nbsp; </p>
<p>　　可以在预计正常情况下不会到达的任何位置上放置断言。断言可以用于验证传递给私有方法的参数。不过，断言不应该用于验证传递给公有方法的参数，因为不管是否启用了断言，公有方法都必须检查其参数。不过，既可以在公有方法中，也可以在非公有方法中利用断言测试后置条件。另外，断言不应该以任何方式改变程序的状态。&nbsp; </p>
<p><br />
　　第八，GC是什么? 为什么要有GC? (基础)。&nbsp; </p>
<p>　　GC是垃圾收集器。Java 程序员不用担心内存管理，因为垃圾收集器会自动进行管理。要请求垃圾收集，可以调用下面的方法之一：&nbsp; </p>
<p>　　System.gc()&nbsp; <br />
　　Runtime.getRuntime().gc()&nbsp; </p>
<p>　　第九，String s = new String("xyz");创建了几个String Object?&nbsp; </p>
<p>　　两个对象，一个是&#8220;xyx&#8221;,一个是指向&#8220;xyx&#8221;的引用对象s。&nbsp; </p>
<p>　　第十，Math.round(11.5)等於多少? Math.round(-11.5)等於多少?&nbsp; </p>
<p>　　Math.round(11.5)返回（long）12，Math.round(-11.5)返回（long）-11;&nbsp; </p>
<p>　　第十一，short s1 = 1; s1 = s1 + 1;有什么错? short s1 = 1; s1 += 1;有什么错?&nbsp; </p>
<p>　　short s1 = 1; s1 = s1 + 1;有错，s1是short型，s1+1是int型,不能显式转化为short型。可修改为s1 =(short)(s1 + 1) 。short s1 = 1; s1 += 1正确。&nbsp; </p>
<p>　　第十二，sleep() 和 wait() 有什么区别? 搞线程的最爱&nbsp; </p>
<p>　　sleep()方法是使线程停止一段时间的方法。在sleep 时间间隔期满后，线程不一定立即恢复执行。这是因为在那个时刻，其它线程可能正在运行而且没有被调度为放弃执行，除非(a)&#8220;醒来&#8221;的线程具有更高的优先级，(b)正在运行的线程因为其它原因而阻塞。&nbsp; </p>
<p>　　wait()是线程交互时，如果线程对一个同步对象x 发出一个wait()调用，该线程会暂停执行，被调对象进入等待状态，直到被唤醒或等待时间到。&nbsp; </p>
<p>　　第十三，Java有没有goto?&nbsp; </p>
<p>　　Goto?java中的保留字，现在没有在java中使用。&nbsp; </p>
<p>　　第十四，数组有没有length()这个方法? String有没有length()这个方法？&nbsp; </p>
<p>　　数组没有length()这个方法，有length的属性。&nbsp; <br />
　　String有有length()这个方法。&nbsp; </p>
<p>　　第十五，Overload和Override的区别。Overloaded的方法是否可以改变返回值的类型?&nbsp; </p>
<p>　　方法的重写Overriding和重载Overloading是Java多态性的不同表现。重写Overriding是父类与子类之间多态性的一种表现，重载Overloading是一个类中多态性的一种表现。如果在子类中定义某方法与其父类有相同的名称和参数，我们说该方法被重写 (Overriding)。子类的对象使用这个方法时，将调用子类中的定义，对它而言，父类中的定义如同被&#8220;屏蔽&#8221;了。如果在一个类中定义了多个同名的方法，它们或有不同的参数个数或有不同的参数类型，则称为方法的重载(Overloading)。Overloaded的方法是可以改变返回值的类型。&nbsp; </p>
<p>　　第十六，Set里的元素是不能重复的，那么用什么方法来区分重复与否呢? 是用==还是equals()? 它们有何区别?&nbsp; </p>
<p>　　Set里的元素是不能重复的，那么用iterator()方法来区分重复与否。equals()是判读两个Set是否相等。&nbsp; </p>
<p>　　equals()和==方法决定引用值是否指向同一对象equals()在类中被覆盖，为的是当两个分离的对象的内容和类型相配的话，返回真值。&nbsp; </p>
<p>　　第十七，给我一个你最常见到的runtime exception。&nbsp; </p>
<p>　　ArithmeticException, ArrayStoreException, BufferOverflowException, BufferUnderflowException,&nbsp; CannotRedoException,&nbsp;&nbsp;&nbsp; <br />
CannotUndoException,&nbsp; ClassCastException, CMMException,&nbsp;&nbsp; ConcurrentModificationException,&nbsp;&nbsp; <br />
DOMException, EmptyStackException, IllegalArgumentException,&nbsp; IllegalMonitorStateException,&nbsp;&nbsp; <br />
IllegalPathStateException,&nbsp; IllegalStateException,&nbsp;&nbsp; <br />
ImagingOpException,&nbsp;&nbsp; <br />
IndexOutOfBoundsException,&nbsp; MissingResourceException,&nbsp; NegativeArraySizeException,&nbsp; NoSuchElementException,&nbsp;&nbsp; <br />
NullPointerException,&nbsp; ProfileDataException, ProviderException,&nbsp; <br />
&nbsp;RasterFormatException,&nbsp; SecurityException, SystemException, <br />
&nbsp;UndeclaredThrowableException,&nbsp;&nbsp; <br />
UnmodifiableSetException,&nbsp; UnsupportedOperationException&nbsp;&nbsp; </p>
<p>　　第十八，error和exception有什么区别?&nbsp; </p>
<p>　　error 表示恢复不是不可能但很困难的情况下的一种严重问题。比如说内存溢出。不可能指望程序能处理这样的情况。 </p>
<p>　　exception 表示一种设计或实现问题。也就是说，它表示如果程序运行正常，从不会发生的情况。&nbsp; </p>
<p><br />
　　第十九，List, Set, Map是否继承自Collection接口?&nbsp; </p>
<p>　　List，Set是&nbsp; </p>
<p>　　Map不是&nbsp; </p>
<p>　　第二十，abstract class和interface有什么区别?&nbsp; </p>
<p>　　声明方法的存在而不去实现它的类被叫做抽象类（abstract class），它用于要创建一个体现某些基本行为的类，并为该类声明方法，但不能在该类中实现该类的情况。不能创建abstract 类的实例。然而可以创建一个变量，其类型是一个抽象类，并让它指向具体子类的一个实例。不能有抽象构造函数或抽象静态方法。Abstract 类的子类为它们父类中的所有抽象方法提供实现，否则它们也是抽象类为。取而代之，在子类中实现该方法。知道其行为的其它类可以在类中实现这些方法。&nbsp; </p>
<p>　　接口（interface）是抽象类的变体。在接口中，所有方法都是抽象的。多继承性可通过实现这样的接口而获得。接口中的所有方法都是抽象的，没有一个有程序体。接口只可以定义static final成员变量。接口的实现与子类相似，除了该实现类不能从接口定义中继承行为。当类实现特殊接口时，它定义（即将程序体给予）所有这种接口的方法。然后，它可以在实现了该接口的类的任何对象上调用接口的方法。由于有抽象类，它允许使用接口名作为引用变量的类型。通常的动态联编将生效。引用可以转换到接口类型或从接口类型转换，instanceof 运算符可以用来决定某对象的类是否实现了接口。&nbsp; </p>
<p>　　第二十一，abstract的method是否可同时是static,是否可同时是native，是否可同时是synchronized?&nbsp; </p>
<p>　　都不能&nbsp; </p>
<p>　　第二十二，接口是否可继承接口? 抽象类是否可实现(implements)接口? 抽象类是否可继承实体类(concrete class)?&nbsp; </p>
<p>　　接口可以继承接口。抽象类可以实现(implements)接口，抽象类是否可继承实体类，但前提是实体类必须有明确的构造函数。&nbsp; </p>
<p>　　第二十三，启动一个线程是用run()还是start()?&nbsp; </p>
<p>　　启动一个线程是调用start()方法，使线程所代表的虚拟处理机处于可运行状态，这意味着它可以由JVM调度并执行。这并不意味着线程就会立即运行。run()方法可以产生必须退出的标志来停止一个线程。&nbsp; </p>
<p>&nbsp;</p>
<p>　　第二十四，构造器Constructor是否可被override?&nbsp; </p>
<p>　　构造器Constructor不能被继承，因此不能重写Overriding，但可以被重载Overloading。&nbsp; </p>
<p>　　第二十五，是否可以继承String类?&nbsp; </p>
<p>　　String类是final类故不可以继承。&nbsp; </p>
<p>　　第二十六，当一个线程进入一个对象的一个synchronized方法后，其它线程是否可进入此对象的其它方法?&nbsp; </p>
<p>　　不能，一个对象的一个synchronized方法只能由一个线程访问。&nbsp; </p>
<p>　　第二十七，try {}里有一个return语句，那么紧跟在这个try后的finally {}里的code会不会被执行，什么时候被执行，在return前还是后?&nbsp; </p>
<p>　　会执行，在return前执行。&nbsp; </p>
<p>　　第二十八，编程题: 用最有效率的方法算出2乘以8等於几?&nbsp; </p>
<p>　　有C背景的程序员特别喜欢问这种问题。&nbsp; </p>
<p>　　2 &lt;&lt; 3&nbsp; </p>
<p>　　第二十九，两个对象值相同(x.equals(y) == true)，但却可有不同的hash code，这句话对不对?&nbsp; </p>
<p>　　不对，有相同的hash code。&nbsp; </p>
<p>　　第三十，当一个对象被当作参数传递到一个方法后，此方法可改变这个对象的属性，并可返回变化后的结果，那么这里到底是值传递还是引用传递?&nbsp; </p>
<p>　　是值传递。Java 编程语言只由值传递参数。当一个对象实例作为一个参数被传递到方法中时，参数的值就是对该对象的引用。对象的内容可以在被调用的方法中改变，但对象的引用是永远不会改变的。&nbsp; </p>
<p><br />
　　第三十一，swtich是否能作用在byte上，是否能作用在long上，是否能作用在String上?&nbsp; </p>
<p>　　switch（expr1）中，expr1是一个整数表达式。因此传递给 switch 和 case 语句的参数应该是 int、 short、 char 或者 byte。long,string 都不能作用于swtich。&nbsp; </p>
<p>　　第三十二，编程题: 写一个Singleton出来。 </p>
<p>　　Singleton模式主要作用是保证在Java应用程序中，一个类Class只有一个实例存在。&nbsp; </p>
<p>　　一般Singleton模式通常有几种种形式:&nbsp; </p>
<p>　　第一种形式: 定义一个类，它的构造函数为private的，它有一个static的private的该类变量，在类初始化时实例话，通过一个public的getInstance方法获取对它的引用,继而调用其中的方法。&nbsp; </p>
<p>public class Singleton {&nbsp; <br />
　　private Singleton(){}&nbsp; <br />
　　//在自己内部定义自己一个实例，是不是很奇怪？&nbsp; <br />
　　//注意这是private 只供内部调用&nbsp; <br />
　　private static Singleton instance = new Singleton();&nbsp; <br />
　　//这里提供了一个供外部访问本class的静态方法，可以直接访问　　&nbsp; <br />
　　public static Singleton getInstance() {&nbsp; <br />
　　　　return instance; 　　&nbsp; <br />
　　 }&nbsp; <br />
}&nbsp; </p>
<p>　　第二种形式:&nbsp; </p>
<p>public class Singleton {&nbsp; <br />
　　private static Singleton instance = null;&nbsp; <br />
　　public static synchronized Singleton getInstance() {&nbsp; <br />
　　//这个方法比上面有所改进，不用每次都进行生成对象，只是第一次　　　 　&nbsp; <br />
　　//使用时生成实例，提高了效率！&nbsp; <br />
　　if (instance==null)&nbsp; <br />
　　　　instance＝new Singleton();&nbsp; <br />
return instance; 　　}&nbsp; <br />
}&nbsp; </p>
<p>　　其他形式:&nbsp; </p>
<p>　　定义一个类，它的构造函数为private的，所有方法为static的。&nbsp; </p>
<p>　　一般认为第一种形式要更加安全些&nbsp; </p>
<p>　　第三十三 Hashtable和HashMap&nbsp; </p>
<p>　　Hashtable继承自Dictionary类，而HashMap是Java1.2引进的Map interface的一个实现&nbsp; </p>
<p>　　HashMap允许将null作为一个entry的key或者value，而Hashtable不允许&nbsp; </p>
<p>　　还有就是，HashMap把Hashtable的contains方法去掉了，改成containsvalue和containsKey。因为contains方法容易让人引起误解。&nbsp; </p>
<p>　　最大的不同是，Hashtable的方法是Synchronize的，而HashMap不是，在多个线程访问Hashtable时，不需要自己为它的方法实现同步，而HashMap就必须为之提供外同步。&nbsp; </p>
<p>　　Hashtable和HashMap采用的hash/rehash算法都大概一样，所以性能不会有很大的差异。</p>
<br />
<br />
<p id="TBPingURL">Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=623361</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/145316.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-09-15 10:36 <a href="http://www.blogjava.net/keweibo/articles/145316.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>session对象的常用方法</title><link>http://www.blogjava.net/keweibo/articles/143510.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Fri, 07 Sep 2007 10:35:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/143510.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/143510.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/143510.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/143510.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/143510.html</trackback:ping><description><![CDATA[<p><strong><em><u style="font-size: 14pt">session对象的常用方法</u></em></strong></p>
<p>&nbsp;&nbsp;<span style="color: red">public void setAttribute(String Key,Object obj)<br />
</span>&nbsp;&nbsp;session对象类似于散列表,可以调用该方法将参数Object指定的对象obj添加到session对象中<br />
&nbsp;&nbsp;,并为其添加的对象指定了一个索引关键字.如果添加的两个对象的关键字相同,则先前添加的对<br />
&nbsp;&nbsp;象被清除.<br />
&nbsp;&nbsp;<br />
<span style="color: red">&nbsp;&nbsp;public Object getAttribute(String Key)</span><br />
&nbsp;&nbsp;获取session对象中含有的关键字是Key的对象.由于任何对象都可以添加到session对象中,因此<br />
&nbsp;&nbsp;该方法取回对象时,应进行强制类型转换.<br />
&nbsp;&nbsp;<br />
<span style="color: red">&nbsp;&nbsp;public Enumeration getAttributeName()</span><br />
&nbsp;&nbsp;session对象调用该方法产生一个枚举对象.该枚举对象使用nextElement()方法遍历session对象<br />
&nbsp;&nbsp;所含有的全部对象.<br />
&nbsp;&nbsp;<br />
<span style="color: red">&nbsp;&nbsp;public long getCreationTime()</span><br />
&nbsp;&nbsp;session对象调用该方法要以获取对象创建的时间.单位是毫秒(从1970年7月1日午夜起至该对象<br />
&nbsp;&nbsp;创建时刻所走过的毫秒数).<br />
&nbsp;&nbsp;<br />
<span style="color: red">&nbsp;&nbsp;public long getLastAccessedTime()</span><br />
&nbsp;&nbsp;获取当前session对象最后一次被操作的时间.<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<span style="color: red">public int getMaxInactiveInterval()</span><br />
&nbsp;&nbsp;得到允许session对象处于非活动状态的最长时间.<br />
&nbsp;&nbsp;<br />
<span style="color: red">&nbsp;&nbsp;public vodi setMaxInactiveInterval(int n)</span><br />
&nbsp;&nbsp;设置允许session对象处于非活动状态的最长时间.(单位是秒)<br />
&nbsp;&nbsp;<br />
<span style="color: red">&nbsp;&nbsp;public void removeAttribute(String Key)</span><br />
&nbsp;&nbsp;从当前session对象中删除关键字是key的对象.<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;<span style="color: red">public String getId()</span><br />
&nbsp;&nbsp;获取session对象的编号.<br />
&nbsp;&nbsp;<br />
<span style="color: red">&nbsp;&nbsp;invalidate()</span><br />
&nbsp;&nbsp;使得session对象无效.<br />
&nbsp;&nbsp;</p>
<p>&nbsp;&nbsp;</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/143510.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-09-07 18:35 <a href="http://www.blogjava.net/keweibo/articles/143510.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>分页显示</title><link>http://www.blogjava.net/keweibo/articles/142446.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Mon, 03 Sep 2007 13:49:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/142446.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/142446.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/142446.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/142446.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/142446.html</trackback:ping><description><![CDATA[<p>package org.util;</p>
<p><span style="color: #ff00ff">//分页显示</span><br />
public class Pager {</p>
<p>&nbsp;private int currentPage;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #ff00ff">//当前页</span><br />
&nbsp;private int pageSize = 5;&nbsp;&nbsp;&nbsp;<span style="color: #ff00ff">&nbsp;//每页显示的记录数<br />
</span>&nbsp;private int&nbsp; totalSize;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #ff00ff">//总记录数<br />
</span>&nbsp;private int totalPage;&nbsp;&nbsp;&nbsp;<span style="color: #ff00ff">&nbsp;//总页数<br />
</span>&nbsp;</p>
<p>&nbsp;private boolean hasFirst;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #ff00ff">//是否有首页</span><br />
&nbsp;private boolean hasPrevious;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #ff00ff">//&nbsp;是否有上一页</span><br />
&nbsp;private boolean hasNext;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #ff00ff">//&nbsp;是否有下一页</span><br />
&nbsp;private boolean hasLast;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: #ff00ff">//&nbsp;是否有尾页<br />
</span><br />
<span style="color: #ff00ff">/**构造函数必须传入两个参数当前页和总记录数<br />
根据当前页可以判断是否有上一页下一页等等,<br />
根据总记录数可以算出总页数*/</span><br />
<span style="color: #0000ff">&nbsp;public Pager(int currentPage,int totalSize){<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;this.currentPage = currentPage;<br />
&nbsp;&nbsp;this.totalSize = totalSize;<br />
&nbsp;}</span><br />
&nbsp;<br />
&nbsp;public int getCurrentPage() {<br />
&nbsp;&nbsp;return currentPage;<br />
&nbsp;}<br />
&nbsp;public void setCurrentPage(int currentPage) {<br />
&nbsp;&nbsp;this.currentPage = currentPage;<br />
&nbsp;}<br />
&nbsp;public boolean isHasFirst() {<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;if(currentPage == 1)<br />
&nbsp;&nbsp;&nbsp;return false;<br />
&nbsp;&nbsp;return true;<br />
&nbsp;}<br />
&nbsp;public void setHasFirst(boolean hasFirst) {<br />
&nbsp;&nbsp;this.hasFirst = hasFirst;<br />
&nbsp;}<br />
&nbsp;public boolean isHasLast() {<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;if(currentPage == getTotalPage())<br />
&nbsp;&nbsp;&nbsp;return false;<br />
&nbsp;&nbsp;return true;<br />
&nbsp;}<br />
&nbsp;public void setHasLast(boolean hasLast) {<br />
&nbsp;&nbsp;this.hasLast = hasLast;<br />
&nbsp;}<br />
&nbsp;public boolean isHasNext() {<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;if(isHasLast())<br />
&nbsp;&nbsp;&nbsp;return true;<br />
&nbsp;&nbsp;return false;<br />
&nbsp;}<br />
&nbsp;public void setHasNext(boolean hasNext) {<br />
&nbsp;&nbsp;this.hasNext = hasNext;<br />
&nbsp;}<br />
&nbsp;public boolean isHasPrevious() {<br />
&nbsp;&nbsp;<br />
&nbsp;&nbsp;if(isHasFirst())<br />
&nbsp;&nbsp;&nbsp;return true;<br />
&nbsp;&nbsp;return false;<br />
&nbsp;}<br />
&nbsp;public void setHasPrevious(boolean hasPrevious) {<br />
&nbsp;&nbsp;this.hasPrevious = hasPrevious;<br />
&nbsp;}<br />
&nbsp;public int getPageSize() {<br />
&nbsp;&nbsp;return pageSize;<br />
&nbsp;}<br />
&nbsp;public void setPageSize(int pageSize) {<br />
&nbsp;&nbsp;this.pageSize = pageSize;<br />
&nbsp;}<br />
&nbsp;public int getTotalPage() {<br />
<span style="color: #ff00ff">&nbsp;&nbsp;//计算出总页数</span><br />
&nbsp;&nbsp;totalPage = totalSize / pageSize;<br />
&nbsp;&nbsp;if(totalSize % pageSize != 0)<br />
&nbsp;&nbsp;&nbsp;totalPage++;<br />
&nbsp;&nbsp;return totalPage;<br />
&nbsp;}<br />
&nbsp;public void setTotalPage(int totalPage) {<br />
&nbsp;&nbsp;this.totalPage = totalPage;<br />
&nbsp;}<br />
&nbsp;public int getTotalSize() {<br />
&nbsp;&nbsp;return totalSize;<br />
&nbsp;}<br />
&nbsp;public void setTotalSize(int totalSize) {<br />
&nbsp;&nbsp;this.totalSize = totalSize;<br />
&nbsp;}<br />
}<br />
</p>
 <img src ="http://www.blogjava.net/keweibo/aggbug/142446.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-09-03 21:49 <a href="http://www.blogjava.net/keweibo/articles/142446.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在用户提交后禁用按钮</title><link>http://www.blogjava.net/keweibo/articles/140109.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Mon, 27 Aug 2007 11:57:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/140109.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/140109.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/140109.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/140109.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/140109.html</trackback:ping><description><![CDATA[&lt;html&gt;<br>&lt;head&gt;<br>&nbsp;&lt;script language="javascript"&gt;<br>&nbsp;&nbsp;function checkValid(form)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;document.getElementById("submitbutton").disabled=true;<br>&nbsp;&nbsp;&nbsp;return true;<br>&nbsp;&nbsp;}<br>&nbsp;&lt;/script&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&nbsp;&lt;form action="" method="post"&nbsp; &gt;<br>&nbsp;&nbsp;&lt;input type="submit" value="提交" id="submitbutton" onclick="return checkValid(this)"/&gt;<br>&nbsp;&lt;/form&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;
<img src ="http://www.blogjava.net/keweibo/aggbug/140109.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-08-27 19:57 <a href="http://www.blogjava.net/keweibo/articles/140109.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>网上资源(一些常见的网址)</title><link>http://www.blogjava.net/keweibo/articles/138936.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Thu, 23 Aug 2007 14:13:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/138936.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/138936.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/138936.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/138936.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/138936.html</trackback:ping><description><![CDATA[<p>Eclipse 官方主页<br />
<a href="http://www.eclipse.org/">http://www.eclipse.org/</a><br />
MyEclipse 官方主页<br />
<a href="http://www.myeclipseide.com/">http://www.myeclipseide.com/</a><br />
Hibernate 官方主页<br />
<a href="http://www.hibernate.org/">http://www.hibernate.org/</a><br />
Spring 官方主页<br />
<a href="http://www.springframework.org/">http://www.springframework.org/</a><br />
Struts 官方主页<br />
<a href="http://struts.apache.org/">http://struts.apache.org/</a><br />
Webwork 官方主页<br />
<a href="http://www.opensymphony.com/">http://www.opensymphony.com/</a><br />
Jakarta 官方主页<br />
<a href="http://jakarta.apache.org/">http://jakarta.apache.org/</a><br />
MySQL 官方主页<br />
<a href="http://www.mysql.com/">http://www.mysql.com/</a><br />
JUnit 官方主页<br />
<a href="http://www.junit.org/">http://www.junit.org/</a><br />
</p>
<p>jakarta commons <br />
<a href="http://commons.apache.org/lang/api-release/index.html">http://commons.apache.org/lang/api-release/index.html</a><br />
AspectJ AJDT<br />
<a href="http://www.eclipse.org/ajdt/">http://www.eclipse.org/ajdt/</a><br />
CVS<br />
<a href="http://www.march-hare.com/cvspro">http://www.march-hare.com/cvspro</a><br />
Apache HTTP Server <br />
<a href="http://httpd.apache.org/download.cgi">http://httpd.apache.org/download.cgi</a> <br />
Sitemesh<br />
<a href="http://www.opensymphony.com/sitemesh/download.action">http://www.opensymphony.com/sitemesh/download.action</a> </p>
<img src ="http://www.blogjava.net/keweibo/aggbug/138936.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-08-23 22:13 <a href="http://www.blogjava.net/keweibo/articles/138936.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>转发(forwrd)和重定向(redirect)</title><link>http://www.blogjava.net/keweibo/articles/138082.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Mon, 20 Aug 2007 04:09:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/138082.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/138082.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/138082.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/138082.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/138082.html</trackback:ping><description><![CDATA[Forward将保持存储在HTTP请求和请求上下文中的所有内容,仅可用在同一个应用中。<br>&nbsp;&nbsp;&nbsp;<br>Redirect指示WEB客户端进行一次新的请求。请求的资源可以在同一个应用中，也可以不在。原来的请求参数不再保留，原来的请求上下文也会消失。
<img src ="http://www.blogjava.net/keweibo/aggbug/138082.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-08-20 12:09 <a href="http://www.blogjava.net/keweibo/articles/138082.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>tomcat自带的编码过滤器</title><link>http://www.blogjava.net/keweibo/articles/137776.html</link><dc:creator>Ke</dc:creator><author>Ke</author><pubDate>Sat, 18 Aug 2007 02:47:00 GMT</pubDate><guid>http://www.blogjava.net/keweibo/articles/137776.html</guid><wfw:comment>http://www.blogjava.net/keweibo/comments/137776.html</wfw:comment><comments>http://www.blogjava.net/keweibo/articles/137776.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/keweibo/comments/commentRss/137776.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/keweibo/services/trackbacks/137776.html</trackback:ping><description><![CDATA[<p>/*<br>* Licensed to the Apache Software Foundation (ASF) under one or more<br>* contributor license agreements.&nbsp; See the NOTICE file distributed with<br>* this work for additional information regarding copyright ownership.<br>* The ASF licenses this file to You under the Apache License, Version 2.0<br>* (the "License"); you may not use this file except in compliance with<br>* the License.&nbsp; You may obtain a copy of the License at<br>*<br>*&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><br>*<br>* Unless required by applicable law or agreed to in writing, software<br>* distributed under the License is distributed on an "AS IS" BASIS,<br>* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br>* See the License for the specific language governing permissions and<br>* limitations under the License.<br>*/</p>
<p><br>package dgut.ke.filter;</p>
<p><br>import java.io.IOException;<br>import javax.servlet.Filter;<br>import javax.servlet.FilterChain;<br>import javax.servlet.FilterConfig;<br>import javax.servlet.ServletException;<br>import javax.servlet.ServletRequest;<br>import javax.servlet.ServletResponse;</p>
<p>&nbsp;</p>
<p>/**<br>&nbsp;* &lt;p&gt;Example filter that sets the character encoding to be used in parsing the<br>&nbsp;* incoming request, either unconditionally or only if the client did not<br>&nbsp;* specify a character encoding.&nbsp; Configuration of this filter is based on<br>&nbsp;* the following initialization parameters:&lt;/p&gt;<br>&nbsp;* &lt;ul&gt;<br>&nbsp;* &lt;li&gt;&lt;strong&gt;encoding&lt;/strong&gt; - The character encoding to be configured<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; for this request, either conditionally or unconditionally based on<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; the &lt;code&gt;ignore&lt;/code&gt; initialization parameter.&nbsp; This parameter<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; is required, so there is no default.&lt;/li&gt;<br>&nbsp;* &lt;li&gt;&lt;strong&gt;ignore&lt;/strong&gt; - If set to "true", any character encoding<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; specified by the client is ignored, and the value returned by the<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; &lt;code&gt;selectEncoding()&lt;/code&gt; method is set.&nbsp; If set to "false,<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; &lt;code&gt;selectEncoding()&lt;/code&gt; is called &lt;strong&gt;only&lt;/strong&gt; if the<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; client has not already specified an encoding.&nbsp; By default, this<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp; parameter is set to "true".&lt;/li&gt;<br>&nbsp;* &lt;/ul&gt;<br>&nbsp;*<br>&nbsp;* &lt;p&gt;Although this filter can be used unchanged, it is also easy to<br>&nbsp;* subclass it and make the &lt;code&gt;selectEncoding()&lt;/code&gt; method more<br>&nbsp;* intelligent about what encoding to choose, based on characteristics of<br>&nbsp;* the incoming request (such as the values of the &lt;code&gt;Accept-Language&lt;/code&gt;<br>&nbsp;* and &lt;code&gt;User-Agent&lt;/code&gt; headers, or a value stashed in the current<br>&nbsp;* user's session.&lt;/p&gt;<br>&nbsp;*<br>&nbsp;* @author Craig McClanahan<br>&nbsp;* @version $Revision: 466607 $ $Date: 2006-10-21 17:09:50 -0600 (Sat, 21 Oct 2006) $<br>&nbsp;*/</p>
<p>public class SetCharacterEncodingFilter implements Filter {</p>
<p><br>&nbsp;&nbsp;&nbsp; // ----------------------------------------------------- Instance Variables</p>
<p><br>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp; * The default character encoding to set for requests that pass through<br>&nbsp;&nbsp;&nbsp;&nbsp; * this filter.<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; protected String encoding = null;</p>
<p><br>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp; * The filter configuration object we are associated with.&nbsp; If this value<br>&nbsp;&nbsp;&nbsp;&nbsp; * is null, this filter instance is not currently configured.<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; protected FilterConfig filterConfig = null;</p>
<p><br>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp; * Should a character encoding specified by the client be ignored?<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; protected boolean ignore = true;</p>
<p><br>&nbsp;&nbsp;&nbsp; // --------------------------------------------------------- Public Methods</p>
<p><br>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp; * Take this filter out of service.<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; public void destroy() {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.encoding = null;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.filterConfig = null;</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p><br>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp; * Select and set (if specified) the character encoding to be used to<br>&nbsp;&nbsp;&nbsp;&nbsp; * interpret request parameters for this request.<br>&nbsp;&nbsp;&nbsp;&nbsp; *<br>&nbsp;&nbsp;&nbsp;&nbsp; * @param request The servlet request we are processing<br>&nbsp;&nbsp;&nbsp;&nbsp; * @param result The servlet response we are creating<br>&nbsp;&nbsp;&nbsp;&nbsp; * @param chain The filter chain we are processing<br>&nbsp;&nbsp;&nbsp;&nbsp; *<br>&nbsp;&nbsp;&nbsp;&nbsp; * @exception IOException if an input/output error occurs<br>&nbsp;&nbsp;&nbsp;&nbsp; * @exception ServletException if a servlet error occurs<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; public void doFilter(ServletRequest request, ServletResponse response,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FilterChain chain)<br>&nbsp;throws IOException, ServletException {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Conditionally select and set the character encoding to be used<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (ignore || (request.getCharacterEncoding() == null)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String encoding = selectEncoding(request);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (encoding != null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; request.setCharacterEncoding(encoding);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;// Pass control on to the next filter<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; chain.doFilter(request, response);</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p><br>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp; * Place this filter into service.<br>&nbsp;&nbsp;&nbsp;&nbsp; *<br>&nbsp;&nbsp;&nbsp;&nbsp; * @param filterConfig The filter configuration object<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; public void init(FilterConfig filterConfig) throws ServletException {</p>
<p>&nbsp;this.filterConfig = filterConfig;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.encoding = filterConfig.getInitParameter("encoding");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String value = filterConfig.getInitParameter("ignore");<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (value == null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.ignore = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (value.equalsIgnoreCase("true"))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.ignore = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if (value.equalsIgnoreCase("yes"))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.ignore = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.ignore = false;</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p><br>&nbsp;&nbsp;&nbsp; // ------------------------------------------------------ Protected Methods</p>
<p><br>&nbsp;&nbsp;&nbsp; /**<br>&nbsp;&nbsp;&nbsp;&nbsp; * Select an appropriate character encoding to be used, based on the<br>&nbsp;&nbsp;&nbsp;&nbsp; * characteristics of the current request and/or filter initialization<br>&nbsp;&nbsp;&nbsp;&nbsp; * parameters.&nbsp; If no character encoding should be set, return<br>&nbsp;&nbsp;&nbsp;&nbsp; * &lt;code&gt;null&lt;/code&gt;.<br>&nbsp;&nbsp;&nbsp;&nbsp; * &lt;p&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp; * The default implementation unconditionally returns the value configured<br>&nbsp;&nbsp;&nbsp;&nbsp; * by the &lt;strong&gt;encoding&lt;/strong&gt; initialization parameter for this<br>&nbsp;&nbsp;&nbsp;&nbsp; * filter.<br>&nbsp;&nbsp;&nbsp;&nbsp; *<br>&nbsp;&nbsp;&nbsp;&nbsp; * @param request The servlet request we are processing<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; protected String selectEncoding(ServletRequest request) {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (this.encoding);</p>
<p>&nbsp;&nbsp;&nbsp; }</p>
<p><br>}<br>还需要在web.xml中配置相关信息<br>&lt;!-- Example filter to set character encoding on each request --&gt;<br>&nbsp;&nbsp; &lt;filter&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Set Character Encoding&lt;/filter-name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;filter-class&gt;dgut.ke.filter.SetCharacterEncodingFilter&lt;/filter-class&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;init-param&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-name&gt;encoding&lt;/param-name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;param-value&gt;gbk&lt;/param-value&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/init-param&gt;<br>&nbsp;&nbsp; &lt;/filter&gt;<br>&nbsp;&nbsp; &lt;filter-mapping&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;filter-name&gt;Set Character Encoding&lt;/filter-name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/filter-mapping&gt;</p>
<img src ="http://www.blogjava.net/keweibo/aggbug/137776.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/keweibo/" target="_blank">Ke</a> 2007-08-18 10:47 <a href="http://www.blogjava.net/keweibo/articles/137776.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>