??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲91精品麻豆国产系列在线 ,亚洲国产一区二区视频网站,亚洲色大成WWW亚洲女子http://www.tkk7.com/ilovebabyfat/category/48767.html垃圾?/description>zh-cnFri, 06 Apr 2012 08:41:45 GMTFri, 06 Apr 2012 08:41:45 GMT60JQGridhttp://www.tkk7.com/ilovebabyfat/archive/2012/04/06/373456.html思无思无Fri, 06 Apr 2012 04:57:00 GMThttp://www.tkk7.com/ilovebabyfat/archive/2012/04/06/373456.htmlhttp://www.tkk7.com/ilovebabyfat/comments/373456.htmlhttp://www.tkk7.com/ilovebabyfat/archive/2012/04/06/373456.html#Feedback0http://www.tkk7.com/ilovebabyfat/comments/commentRss/373456.htmlhttp://www.tkk7.com/ilovebabyfat/services/trackbacks/373456.html阅读全文

思无 2012-04-06 12:57 发表评论
]]>
IE长时间等待服务器响应Q显C页面无法显C的问题http://www.tkk7.com/ilovebabyfat/archive/2011/08/07/355967.html思无思无Sun, 07 Aug 2011 14:12:00 GMThttp://www.tkk7.com/ilovebabyfat/archive/2011/08/07/355967.htmlhttp://www.tkk7.com/ilovebabyfat/comments/355967.htmlhttp://www.tkk7.com/ilovebabyfat/archive/2011/08/07/355967.html#Feedback0http://www.tkk7.com/ilovebabyfat/comments/commentRss/355967.htmlhttp://www.tkk7.com/ilovebabyfat/services/trackbacks/355967.html开始以为是session的超Ӟ于是在页面中d了ajaxd期发送请求给服务器的代码来维持sessionQ?问题无法解决?br />然后以ؓ是页面缓存的问题Q在h中加了随机的数字Q查看每ơ请求回来的响应头状态都?00的,问题仍旧无法解决?br />l箋癑ֺQl谷歌?br />搜烦到microsoft的一文章,如下
http://support.microsoft.com/kb/181050 

Internet Explorer error "connection timed out" when server does not respond
问题得到解决?br />其实可以说问题无法得到解冟뀂我怎么可能让每个用户去修改他们的注册表么?br />
看来只能采取异步的请求方式了?/span>



思无 2011-08-07 22:12 发表评论
]]>
Actuate使用ȝhttp://www.tkk7.com/ilovebabyfat/archive/2011/06/29/353346.html思无思无Wed, 29 Jun 2011 05:28:00 GMThttp://www.tkk7.com/ilovebabyfat/archive/2011/06/29/353346.htmlhttp://www.tkk7.com/ilovebabyfat/comments/353346.htmlhttp://www.tkk7.com/ilovebabyfat/archive/2011/06/29/353346.html#Feedback0http://www.tkk7.com/ilovebabyfat/comments/commentRss/353346.htmlhttp://www.tkk7.com/ilovebabyfat/services/trackbacks/353346.html

Actuate 单报表的建立q程

1Q?1. 打开 e.report 选择new report


2Q?2.选择I白报表


3Q?3. 建立数据库连接?/span>Toolsà Database Connection


4Q?4. 填写参数


5Q?5. 双击datasource , 填写查询参数


6Q?6. 选中Content, Tool--?span style="font-family: Wingdings;"> Grouping, 讄整个报表?/span>groupQ?/span>1?/span>or n层?/span>


7Q?7. 单击grouping option,group的显C,是否需?/span>befer,after{,每个group需要单独设|?/span>


8Q?nbsp; 8. 讄各种面的控?/span>


9Q?9. 讄参数Q这些参数可以用在报表控制上或是查询的参?/span>Tools -- Parameters


修改后的查询字段

select fund_id,fund_name,fund_abbreviation,fund_mode,rule_id from te_fund where fund_mode=:fundmode

参数10. 用来控制面昄

?/span>labelZ子,重写OnRowҎ

   

Sub OnRow( row As AcDataRow )
    Super::OnRow( row )
    
if fundmode="M" then
         me.Text 
= "Manual Fund Name"
    
else
         me.Text 
= "Auto Fund Name"
    
end if
End Sub

11. ?/span>datasource中的数据控制面

Sub OnRow( row As AcDataRow )
 Super::OnRow( row )
    
If row.GetValue("DR_SHORT_FLAG"=0 Then
     me.Text 
= "BUY BACK"
    
ElseIf row.GetValue("DR_SHORT_FLAG"=1 Then
     me.Text 
= "Sell to Open"
    
End if
End Sub

 



思无 2011-06-29 13:28 发表评论
]]>
Flex Builder 3 下蝲与注?/title><link>http://www.tkk7.com/ilovebabyfat/archive/2011/06/28/353301.html</link><dc:creator>思无</dc:creator><author>思无</author><pubDate>Tue, 28 Jun 2011 14:46:00 GMT</pubDate><guid>http://www.tkk7.com/ilovebabyfat/archive/2011/06/28/353301.html</guid><wfw:comment>http://www.tkk7.com/ilovebabyfat/comments/353301.html</wfw:comment><comments>http://www.tkk7.com/ilovebabyfat/archive/2011/06/28/353301.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/ilovebabyfat/comments/commentRss/353301.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/ilovebabyfat/services/trackbacks/353301.html</trackback:ping><description><![CDATA[<span id="bnbntlr" class="Apple-style-span" style="font-family: verdana,'ms song',宋体,Arial,微Y雅黑,Helvetica,sans-serif; font-size: 12px; line-height: 18px;"><p style="margin: 5px auto; padding: 0px; text-indent: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"><span id="jldhbtt" class="hilite1" style="margin: 0px; padding: 0px; line-height: 1.5;">Flex</span> <span id="btxplbp" class="hilite2" style="margin: 0px; padding: 0px; line-height: 1.5;">Builder</span> 3 正式版,发布于中国时?2008 q?2 ?25 日;<br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" />下蝲地址一Q?br style="margin: 0px; padding: 0px;" /></font></span><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" color="#108ac6" size="2">http://download.macromedia.com/pub/<span id="dpznfxn" class="t_tag" style="margin: 0px; padding: 0px; line-height: 1.5;"><span id="bvhtdlj" class="hilite1" style="margin: 0px; padding: 0px; line-height: 1.5;">flex</span></span>/<span id="bdxbvll" class="t_tag" style="margin: 0px; padding: 0px; line-height: 1.5;"><span id="hrtvzfp" class="hilite1" style="margin: 0px; padding: 0px; line-height: 1.5;">flex</span></span>_builder/FB3_win.exe</font></span></a><br style="margin: 0px; padding: 0px;" /><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">大小Q?424 MB Q未q行压羃?nbsp;<span id="pjvnhtt" class="hilite1" style="margin: 0px; padding: 0px; line-height: 1.5;">Flex</span> <span id="lvxbtjj" class="hilite2" style="margin: 0px; padding: 0px; line-height: 1.5;">Builder</span> 3 安装文g<br style="margin: 0px; padding: 0px;" />不用注册dQ可以直接下载?br style="margin: 0px; padding: 0px;" /><br style="margin: 0px; padding: 0px;" /></font></span><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; color: #800080; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">下蝲地址二:</font></span></a><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"></font></span></p><h2 style="margin: 15px auto 2px; padding: 0px; font-size: 18px; font-weight: bold;"><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" color="#108ac6" size="2">http://t<span id="ppdbddt" class="t_tag" style="margin: 0px; padding: 0px; line-height: 1.5;">ria</span>ls.adobe.com/Applications/.../FB3_WWEJ.exe</font></span></a><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><br style="margin: 0px; padding: 0px;" /><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" color="#108ac6" size="2">大小Q 385.84 MB Q 已经压羃?nbsp;<span id="pfpbfdl" class="hilite1" style="margin: 0px; padding: 0px; line-height: 1.5;">Flex</span> <span id="drdhbrz" class="hilite2" style="margin: 0px; padding: 0px; line-height: 1.5;">Builder</span> 3 安装文g<br style="margin: 0px; padding: 0px;" />需要注册登录,才可下蝲?/font></span></a><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"></font></span></h2><p style="margin: 5px auto; padding: 0px; text-indent: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"><span id="vzxjvdj" class="hilite1" style="margin: 0px; padding: 0px; line-height: 1.5;">Flex</span> <span id="nprnxvt" class="hilite2" style="margin: 0px; padding: 0px; line-height: 1.5;">builder</span> 3.0注册码(已经试过的,可用的)Q?/font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">1377-4168-2018-0771-2432-1495</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">1377-4760-3354-0772-2773-8996</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">1377-4165-2080-7265-7813-8901</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">1377-4964-5021-8182-2399-8235</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"><span id="hzvxtzp" class="hilite1" style="margin: 0px; padding: 0px; line-height: 1.5;">Flex</span> <span id="pztprzf" class="hilite2" style="margin: 0px; padding: 0px; line-height: 1.5;">builder</span> 中要q行调试Q就必须安装含debug的flash player版本。下载链接地址Q?/font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 0px;"><strong style="margin: 0px; padding: 0px;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">Adobe Flash Player 9 — Debugger Versions (aka debug players or content debuggers) for <span id="rxztfnt" class="hilite1" style="margin: 0px; padding: 0px; line-height: 1.5;">Flex</span> and Flash Developers</font></span></strong></p><p style="margin: 5px auto; padding: 0px; text-indent: 2em;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"><strong style="margin: 0px; padding: 0px;">12/3/2007</strong> Updated debugger versions of Flash Player 9 (aka debug players or content debuggers) are available for <span id="dprlxfl" class="hilite1" style="margin: 0px; padding: 0px; line-height: 1.5;">Flex</span> <span id="pjvplbr" class="hilite2" style="margin: 0px; padding: 0px; line-height: 1.5;">Builder</span> 2 users and Flash CS3 Professional users. These new players are version 9.0.r115.</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 2em;"><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; color: #1b8cba; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">Download the Windows Flash Player 9 ActiveX control content debugger (for IE)</font></span></a><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"> (EXE, 1.59 MB)</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 2em;"><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; color: #1b8cba; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">Download the Windows Flash Player 9 Plugin content debugger (for Netscape-compatible browsers)</font></span></a><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"> (EXE, 1.56 MB)</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 2em;"><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; color: #1b8cba; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">Download the Windows Flash Player 9 Projector content debugger</font></span></a><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"> (EXE, 3.69 MB)</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 2em;"><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; color: #1b8cba; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">Download the Macintosh Flash Player 9 Plugin content debugger (Intel-based Macs)</font></span></a><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"> (DMG, 5.35 MB)</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 2em;"><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; color: #1b8cba; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">Download the Macintosh Flash Player 9 Plugin content debugger (PowerPC-based Macs)</font></span></a><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"> (DMG, 2.41 MB)</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 2em;"><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; color: #1b8cba; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">Download the Macintosh Flash Player 9 Projector content debugger</font></span></a><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"> (ZIP, 4.81 MB)</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 2em;"><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2"><strong style="margin: 0px; padding: 0px;">12/3/2007</strong> Updated Linux debugger versions (aka debug players or content debuggers) of Flash Player 9 are now available. Additionally, the Linux standalone player (projector) is available for developers who wish to publish projectors on Linux operating systems.</font></span></p><p style="margin: 5px auto; padding: 0px; text-indent: 2em;"><a target="_blank" style="margin: 0px; padding: 0px; color: black; text-decoration: underline;"><span style="margin: 0px; padding: 0px; line-height: 1.5; color: #1b8cba; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">Download the Linux debugger and standalone players </font></span></a><span style="margin: 0px; padding: 0px; line-height: 1.5; font-size: small;"><font style="margin: 0px; padding: 0px;" size="2">(TAR.GZ, 9.29 MB)</font></span></p></span><span id="vzvxzxx" class="Apple-style-span" style="font-family: verdana,'ms song',宋体,Arial,微Y雅黑,Helvetica,sans-serif; font-size: 12px; line-height: normal;"><h1 class="postTitle" style="margin: 0px; padding: 0px 0px 0px 5px; font-size: 16px; font-weight: bold; border-width: 0px 0px 1px; border-bottom: 1px dashed #cccccc; line-height: 1.5em; width: 1018px; clear: both;"><a id="ctl02_TitleUrl" class="postTitle2" ></a></h1></span><img src ="http://www.tkk7.com/ilovebabyfat/aggbug/353301.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/ilovebabyfat/" target="_blank">思无</a> 2011-06-28 22:46 <a href="http://www.tkk7.com/ilovebabyfat/archive/2011/06/28/353301.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>单的session 时提新http://www.tkk7.com/ilovebabyfat/archive/2011/06/28/353272.html思无思无Tue, 28 Jun 2011 08:22:00 GMThttp://www.tkk7.com/ilovebabyfat/archive/2011/06/28/353272.htmlhttp://www.tkk7.com/ilovebabyfat/comments/353272.htmlhttp://www.tkk7.com/ilovebabyfat/archive/2011/06/28/353272.html#Feedback0http://www.tkk7.com/ilovebabyfat/comments/commentRss/353272.htmlhttp://www.tkk7.com/ilovebabyfat/services/trackbacks/353272.html在即超时的时候,提醒用户Q之后通过ajax 发送空消息l服务器以防止服务器session无效?br />下面是核心的代码Q?br />
var previousSmSession = null;
var times = 0;
var timer = setInterval("checkSmSession()"60 * 3000);
var maxTimes = 9;

function checkSmSession()
{
    
var currentSmSession = getCurrSmSession();
    
if (currentSmSession != previousSmSession) {
        previousSmSession 
= currentSmSession;
        times 
= 0;
    } 
else {
        times
++;
        
if (maxTimes == times) {
                
this.focus();
                
var currentCheckingTime = new Date();
                currentCheckingTime.setTime(currentCheckingTime.getTime() 
+ 60 * 3000);
                
var sessionWarningMsg = "Due to inactivity you will be logged out of the system at " + currentCheckingTime.toLocaleString().replace(/^.*?\d{4/,""+ ". To extend your session click OK."
                
var val = confirm(sessionWarningMsg);
                
if (val) {
                        times 
= 0;
                        refreshSessions();
                 } 
else {
                      
//  self.location = "/wps/logout.jsp"; 
                }
        }
    }
}


function getCurrSmSession() {
    
var allCookies = document.cookie.split(";");
    
    
var aCookie = null;
    
var aCookieName = "";
    
var aCookieValue = "";         
    
for (var i=0; i<allCookies.length; i++)    {
        aCookie 
= allCookies[i].split("=");
        aCookieName 
= aCookie[0].replace(/^\s+|\s+$/g, "");
        
if (smSessionName == aCookieName) {
            
if (aCookie.length > 1) {
                aCookieValue 
= unescape(aCookie[1].replace(/^\s+|\s+$/g, ""));
            }
            
break;
        }
    }
    
if (i == allCookies.length) {
        aCookieValue 
= null;
    }
    
return aCookieValue;
}

function refreshSessions () {
    
var dummyUrls = ["/home/FlexKeepAlive.jsp""/cfi/FlexKeepAlive.jsp"];
    
for (var i=0; i<dummyUrls.length; i++) {
        
var aXmlHttp = getXMLHttpObject();
        
if (null == aXmlHttp) {
            alert(
"AJAX does not work!");
            
break;    
        }
        aXmlHttp.open(
"GET", dummyUrls[i]+"?sid="+Math.random(), true);
        aXmlHttp.send(
null);
    }     
}

function getXMLHttpObject () {
    
var xmlHttpObj = null;
    
    
try {
        xmlHttpObj 
= new XMLHttpRequest();// Firefox    
    } catch (e) {
        
try {
            xmlHttpObj 
= new ActiveXObject("Msxml2.XMLHTTP");    //IE
        } catch (e) {
            xmlHttpObj 
= new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    
    
return xmlHttpObj;
}


思无 2011-06-28 16:22 发表评论
]]>
(?J2EE目异常处理http://www.tkk7.com/ilovebabyfat/archive/2011/06/27/353073.html思无思无Mon, 27 Jun 2011 08:02:00 GMThttp://www.tkk7.com/ilovebabyfat/archive/2011/06/27/353073.htmlhttp://www.tkk7.com/ilovebabyfat/comments/353073.htmlhttp://www.tkk7.com/ilovebabyfat/archive/2011/06/27/353073.html#Feedback0http://www.tkk7.com/ilovebabyfat/comments/commentRss/353073.htmlhttp://www.tkk7.com/ilovebabyfat/services/trackbacks/353073.htmlhttp://www.iteye.com/topic/72170
关于j2ee目中异常的理和设计。之前一直困惑于异常的处理,Z么异常分为checked和uncheckQ应该遵循怎样的规则自定义异常。在j2ee目中,处理异常需要注意什么地斏V?br />[原文]
Z么要在J2EE目中谈异常处理呢?可能许多java初学者都惌Q?#8220;异常处理不就是try….catch…finally吗?q谁都会 啊!”。笔者在初学java时也是这栯为的。如何在一个多层的j2ee目中定义相应的异常c?在项目中的每一层如何进行异常处理?异常何时被抛出??怽时被记录Q异常该怎么记录Q何旉要把checked Exception转化成unchecked Exception Q何旉要把unChecked Exception转化成checked Exception?异常是否应该呈现到前端页面?如何设计一个异常框Ӟ本文就q些问题q行探讨?
1Q?nbsp;JAVA异常处理
在面向过E式的编E语a中,我们可以通过q回值来定Ҏ是否正常执行。比如在一个c语言~写的程序中Q如果方法正的执行则返?.错误则返?。在vb或delphi开发的应用E序中,出现错误Ӟ我们弹Z个消息框l用戗?/div>
通过Ҏ的返回值我们ƈ不能获得错误的详l信息。可能因为方法由不同的程序员~写Q当同一c错误在不同的方法出现时Q返回的l果和错误信息ƈ不一致?/div>
所以java语言采取了一个统一的异常处理机制?/div>
什么是异常Q运行时发生的可被捕获和处理的错误?/div>
在java语言中,Exception是所有异常的父类。Q何异帔R?展于ExceptioncRExceptionq当于一个错误类型。如果要定义一个新的错误类型就扩展一个新的Exception子类。采用异常的好处 q在于可以精的定位到导致程序出错的源代码位|?q获得详l的错误信息?/div>
Java异常处理通过五个关键字来?玎ͼtry,catch,throw ,throws, finally。具体的异常处理l构由try….catch….finally块来实现。try块存攑֏能出现异常的java语句Qcatch用来捕获?生的异常Qƈ对异常进行处理。Finally块用来清除程序中未释攄资源。不理try块的代码如何q回Qfinally块都L被执行?/div>
一个典型的异常处理代码
java 代码
  1.   
  2. public String getPassword(String userId)throws DataAccessException{   
  3. String sql = “select password from userinfo where userid=’”+userId +”’”;   
  4. String password = null;   
  5. Connection con = null;   
  6. Statement s = null;   
  7. ResultSet rs = null;   
  8. try{   
  9.  con = getConnection();//获得数据q接   
  10.  s = con.createStatement();   
  11.  rs = s.executeQuery(sql);   
  12.  while(rs.next()){   
  13.     password = rs.getString(1);   
  14.  }   
  15.  rs.close();   
  16.  s.close();   
  17.      
  18. }   
  19. Catch(SqlException ex){   
  20.  throw new DataAccessException(ex);   
  21. }   
  22. finally{   
  23.  try{   
  24.       if(con != null){   
  25.         con.close();   
  26.       }   
  27.  }   
  28.    Catch(SQLException sqlEx){   
  29.      throw new DataAccessException(“关闭q接p|!”,sqlEx);   
  30.    }   
  31. }   
  32. return password;   
  33. }   
  34.    
可以看出Java的异常处理机制具有的优势Q?/div>
l错误进行了l一的分c,通过扩展ExceptioncL其子cL实现。从而避免了相同的错误可能在不同的方法中h不同的错误信息。在不同的方法中出现相同的错误时Q只需要throw 相同的异常对象即可?/div>
获得更ؓ详细的错误信息。通过异常c,可以l异常更l,对用h为有用的错误信息。以便于用户q行跟踪和调试程序?/div>
把正的q回l果与错误信息分R降低了E序的复杂度。调用者无需要对q回l果q行更多的了解?/div>
强制调用者进行异常处理,提高E序的质量。当一个方法声明需要抛Z个异常时Q那么调用者必M用try….catch块对异常q行处理。当然调用者也可以让异常l往上一层抛出?/div>
 
2Q?nbsp;Checked 异常 q是 unChecked 异常Q?/div>
Java异常分ؓ两大c?checked 异常和unChecked 异常。所有承java.lang.Exception 的异帔R属于checked异常。所有承java.lang.RuntimeException的异帔R属于unChecked异常?/strong>
当一个方法去调用一个可能抛出checked异常的方法,必须通过try…catch块对异常q行捕获q行处理或者重新抛出?/div>
我们看看Connection接口的createStatement()Ҏ的声明?/div>
public Statement createStatement() throws SQLException;
      
   SQLException是checked异常。当调用createStatementҎӞjava强制调用者必dSQLExceptionq行捕获处理?/div>
java 代码
  1.        public String getPassword(String userId){   
  2.        try{   
  3.        ……   
  4.               Statement s = con.createStatement();   
  5.               ……   
  6.        Catch(SQLException sqlEx){   
  7.               ……   
  8.    }   
  9. ……   
  10. }   
或?/div>
java 代码
  1. public String getPassword(String userId)throws SQLException{   
  2.    Statement s = con.createStatement();   
  3. }  
(当然Q像Connection,Satementq些资源是需要及时关闭的Q这里仅是ؓ了说明checked 异常必须强制调用者进行捕hl箋抛出)
 
unChecked异常也称行时异常Q通常 RuntimeException都表C用h法恢复的异常Q如无法获得数据库连接,不能打开文g{。虽然用户也可以像处理checked异常一h?unChecked异常。但是如果调用者ƈ没有L获unChecked异常Ӟ~译器ƈ不会强制你那么做?/strong>
 
比如一个把字符转换为整型数值的代码如下Q?/div>
 
java 代码
  1. String str = “123”;   
  2. int value = Integer.parseInt(str);  
 
parseInt的方法签名ؓQ?/div>
java 代码
  1. public static int parseInt(String s) throws NumberFormatException  
 
当传入的参数不能转换成相应的整数Ӟ会抛出NumberFormatException。因为NumberFormatException扩展于RuntimeExceptionQ是unChecked异常。所以调用parseIntҎ时无需要try…catch
 
因ؓjava不强制调用者对unChecked异常q行捕获或往上抛 出。所以程序员L喜欢抛出unChecked异常。或者当需要一个新的异常类ӞL习惯的从RuntimeException扩展。当你去调用它些?法时Q如果没有相应的catch块,~译器也L让你通过,同时你也Ҏ无需要去了解q个Ҏ倒底会抛Z么异常。看hq似乎倒是一个很好的办法Q但?q样做却是远Mjava异常处理的真实意图。ƈ且对调用你这个类的程序员带来误导Q因用者根本不知道需要在什么情况下处理异常。而checked?常可以明的告诉调用者,调用q个c需要处理什么异常。如果调用者不d理,~译器都会提Cƈ且是无法~译通过的。当然怎么处理是由调用者自己去军_的?/div>
 
       所以Java推荐Z在应用代码中应该使用checked异常。就像我们在上节提到q用异常的好外在于可以强制调用者必d会产生的异常进行处理。包括在《java Tutorial》等java官方文档中都把checked异常作ؓ标准用法?/div>
       使用checked异常Q应意味着有许多的try…catch在你的代码中。当在编写和处理来多的try…catch块之后,许多人终于开始怀疑checked异常倒底是否应该作ؓ标准用法了?/div>
甚至q大名鼎鼎的《thinking in java》的作者Bruce Eckel也改变了他曾l的x。Bruce Eckel甚至d把unChecked异常作ؓ标准用法。ƈ发表文章Q以试验checked异常是否应该从java中去掉。Bruce Eckel语:“当少量代码时Qchecked异常无疑是十分优雅的构思,q有助于避免了许多潜在的错误。但是经验表明,对大量代码来说结果正好相?#8221;
关于checked异常和unChecked异常的详l讨论可以参?/div>
 
使用checked异常会带来许多的问题?/div>
       checked异常D了太多的try…catch 代码
              可能有很多checked异常对开发h员来说是无法合理地进行处理的Q比?SQLException。而开发h员却不得不去q行try…catch。当开发h员对一个checked异常无法正确的处理时Q通常是简单的把异常打?出来或者是q脆什么也不干。特别是对于新手来说Q过多的checked异常让他感到无所适从?/div>
java 代码
  1.        try{   
  2.        ……   
  3.               Statement s = con.createStatement();   
  4.               ……   
  5.        Catch(SQLException sqlEx){   
  6.               sqlEx.PrintStackTrace();   
  7.    }   
  8.    或?  
  9.        try{   
  10.        ……   
  11.               Statement s = con.createStatement();   
  12.               ……   
  13.        Catch(SQLException sqlEx){   
  14.           //什么也不干   
  15. }   
 
checked异常D了许多难以理解的代码产生
        当开发h员必d捕获一个自己无法正处理的checked异常Q通常的是重新装成一个新的异常后再抛出。这样做q没有ؓE序带来M好处。反而代码晚难以理解?/div>
像我们使用JDBC代码那样Q需要处理非常多的try…catch.Q真正有用的代码被包含在try…catch之内。得理解这个方法变理困难v?/div>
checked异常D异常被不断的装成另一个类异常后再抛出
java 代码
  1.         public void methodA()throws ExceptionA{   
  2.          …..          
  3.           throw new ExceptionA();        
  4. }   
  5.           
  6. public void methodB()throws ExceptionB{   
  7.    try{   
  8.       methodA();   
  9.       ……   
  10.    }catch(ExceptionA ex){   
  11.    throw new ExceptionB(ex);   
  12.    }   
  13. }   
  14.            
  15.         Public void methodC()throws ExceptinC{   
  16.        try{   
  17.          methodB();   
  18.          …   
  19.        }   
  20.        catch(ExceptionB ex){   
  21.           throw new ExceptionC(ex);   
  22.         }   
  23.     }   
我们看到异常p样一层层无休止的被封装和重新抛出?/div>
 
checked异常D破坏接口Ҏ
   一个接口上的一个方法已被多个类使用Q当个方法额外添加一个checked异常Ӟ那么所有调用此Ҏ的代码都需要修攏V?/div>
 
可见上面q些问题都是因ؓ调用者无法正的处理checked异常时而被q去捕获和处理,被迫装后再重新抛出。这样十分不方便Qƈ不能带来M好处。在q种情况下通常使用unChecked异常?/div>
chekced异常q不是无一是处Qchecked异常比传l编E的错误q回D好用得多。通过~译器来保正确的处理异常比通过q回值判断要好得多?/div>
如果一个异常是致命的,不可恢复的。或者调用者去捕获它没有Q何益处,使用unChecked异常?/strong>
如果一个异常是可以恢复的,可以被调用者正处理的Q用checked异常?/div>
在用unChecked异常Ӟ必须在在Ҏ声明中详l的说明该方法可能会抛出的unChekced异常。由调用者自己去军_是否捕获unChecked异常
 
倒底什么时候用checked异常Q什么时候用unChecked异常Qƈ没有一个绝对的标准。但是笔者可以给Z些徏?/div>
当所有调用者必d理这个异常,可以让调用者进行重试操作;或者该异常相当于该Ҏ的第二个q回倹{用checked异常?/div>
q个异常仅是数比较高的调用者才能处理,一般的调用者不能正的处理。用unchecked异常。有能力处理的调用者可以进行高U处理,一般调用者干脆就不处理?/div>
q个异常是一个非怸重的错误Q如数据库连接错误,文g无法打开{。或者这些异常是与外部环境相关的。不是重试可以解决的。用unchecked异常。因U异怸旦出玎ͼ调用者根本无法处理?/div>
如果不能定Ӟ使用unchecked异常。ƈ详细描述可能会抛出的异常,以让调用者决定是否进行处理?/div>
 
3Q?span style="font-family: 'Times New Roman';"> 设计一个新的异常类
在设计一个新的异常类Ӟ首先看看是否真正的需要这个异常类。一般情况下量不要去设计新的异常类Q而是量使用java中已l存在的异常cR?/div>
?div>java 代码
  1. IllegalArgumentException, UnsupportedOperationException  
 
不管是新的异常是chekced异常q是unChecked异常。我们都必须考虑异常的嵌套问题?/div>
java 代码
  1. public void methodA()throws ExceptionA{   
  2.          …..          
  3.           throw new ExceptionA();        
  4. }   
 
ҎmethodA声明会抛出ExceptionA.
 
public void methodB()throws ExceptionB
methodB声明会抛出ExceptionB,当在methodB?法中调用methodAӞExceptionA是无法处理的,所以ExceptionA应该l箋往上抛出。一个办法是把methodB声明会抛?ExceptionA.但这样已l改变了MethodB的方法签名。一旦改变,则所有调用methodB的方法都要进行改变?/div>
另一个办法是把ExceptionA装成ExceptionBQ然后再抛出。如果我们不把ExceptionA装在ExceptionB中,׃׃根异怿息,使得无法跟踪异常的原始出处?/div>
java 代码
  1. public void methodB()throws ExceptionB{   
  2.    try{   
  3.       methodA();   
  4.       ……   
  5.    }catch(ExceptionA ex){   
  6.      throw new ExceptionB(ex);   
  7.    }   
  8. }  
 
   如上面的代码中,ExceptionB嵌套一个ExceptionA.我们暂且把ExceptionAUCؓ“起因异常”,因ؓExceptionAD了ExceptionB的生。这h不异常信息丢失?/div>
所以我们在定义一个新的异常类Ӟ必须提供q样一个可以包含嵌套异常的构造函数。ƈ有一个私有成员来保存q个“起因异常”?/div>
java 代码
  1. public Class ExceptionB extends Exception{   
  2. private Throwable cause;   
  3.     
  4. public ExceptionB(String msg, Throwable ex){   
  5.  super(msg);   
  6.  this.cause = ex;   
  7. }   
  8.     
  9. public ExceptionB(String msg){   
  10.  super(msg);   
  11. }   
  12.     
  13. public ExceptionB(Throwable ex){   
  14.  this.cause = ex;   
  15. }   
  16. }   
当然Q我们在调用printStackTraceҎӞ需要把所有的“起因异常”的信息也同时打印出来。所以我们需要覆写printStackTraceҎ来显C全部的异常栈跟t。包括嵌套异常的栈跟t?/div>
java 代码
  1. public void printStackTrace(PrintStrean ps){   
  2. if(cause == null){   
  3.  super.printStackTrace(ps);   
  4. }else{   
  5.  ps.println(this);   
  6.  cause.printStackTrace(ps);   
  7. }   
  8. }   
 
一个完整的支持嵌套的checked异常cL码如下。我们在q里暂且把它叫做NestedException
 
java 代码
  1. public NestedException extends Exception{   
  2. private Throwable cause;   
  3. public NestedException (String msg){   
  4.  super(msg);   
  5. }   
  6.     
  7. public NestedException(String msg, Throwable ex){   
  8.  super(msg);   
  9.  This.cause = ex;   
  10. }   
  11.     
  12. public Throwable getCause(){   
  13.  return (this.cause == null ? this :this.cause);   
  14. }   
  15.     
  16. public getMessage(){   
  17.  String message = super.getMessage();   
  18.  Throwable cause = getCause();   
  19.    if(cause != null){   
  20.      message = message + “;nested Exception is ” + cause;   
  21.    }   
  22.  return message;   
  23. }   
  24. public void printStackTrace(PrintStream ps){   
  25.  if(getCause == null){   
  26.     super.printStackTrace(ps);   
  27.        
  28.  }else{   
  29.  ps.println(this);   
  30.  getCause().printStackTrace(ps);   
  31.  }   
  32. }   
  33.     
  34. public void printStackTrace(PrintWrite pw){   
  35.  if(getCause() == null){   
  36.     super.printStackTrace(pw);   
  37.  }   
  38.  else{   
  39.     pw.println(this);   
  40.     getCause().printStackTrace(pw);   
  41.  }   
  42. }   
  43. public void printStackTrace(){   
  44.  printStackTrace(System.error);   
  45. }   
  46. }   
  47.     
同样要设计一个unChecked异常cM与上面一栗只是需要承RuntimeException?/div>
 
 
4Q?span style="font-family: 'Times New Roman';"> 如何记录异常
作ؓ一个大型的应用pȝ都需要用日志文g来记录系l的q行Q以便于跟踪和记录系l的q行情况。系l发生的异常理所当然的需要记录在日志pȝ中?/div>
java 代码
  1. public String getPassword(String userId)throws NoSuchUserException{   
  2. UserInfo user = userDao.queryUserById(userId);   
  3. If(user == null){   
  4.  Logger.info(“找不到该用户信息,userId=”+userId);   
  5.  throw new NoSuchUserException(“找不到该用户信息,userId=”+userId);   
  6. }   
  7. else{   
  8.  return user.getPassword();   
  9. }   
  10. }   
  11.     
  12. public void sendUserPassword(String userId)throws Exception {   
  13. UserInfo user = null;   
  14. try{   
  15.   user = getPassword(userId);   
  16.    //……..   
  17.  sendMail();   
  18.  //   
  19. }catch(NoSuchUserException ex)(   
  20.    logger.error(“找不到该用户信息:”+userId+ex);   
  21.    throw new Exception(ex);   
  22. }   
 
我们注意刎ͼ一个错误被记录了两?在错误的h位置我们仅是以infoU别q行记录。而在sendUserPasswordҎ中,我们q把整个异常信息都记录了?/div>
W者曾看到很多目是这栯录异常的Q不三七二一Q只有遇到异常就把整个异常全部记录下。如果一个异常被不断的封装抛出多ơ,那么p记录了多ơ。那么异常倒底该在什么地方被记录Q?/div>
异常应该在最初生的位置记录Q?/div>
 
如果必须捕获一个无法正处理的异常Q仅仅是把它装成另外一U异常往上抛出。不必再ơ把已经被记录过的异常再ơ记录?/div>
 
如果捕获C个异常,但是q个异常是可以处理的。则无需要记录异?/strong>
 
java 代码
  1. public Date getDate(String str){   
  2.  Date applyDate = null;   
  3. SimpleDateFormat format = new SimpleDateFormat(“MM/dd/yyyy”);   
  4. try{   
  5.  applyDate = format.parse(applyDateStr);   
  6. }   
  7. catch(ParseException ex){   
  8.  //乎略Q当格式错误Ӟq回null   
  9. }   
  10. return applyDate;   
  11. }   
 
捕获C个未记录q的异常或外部系l异常时Q应该记录异常的详细信息
java 代码
  1. try{   
  2.        ……   
  3.         String sql=”select * from userinfo”;   
  4.               Statement s = con.createStatement();   
  5.               ……   
  6.        Catch(SQLException sqlEx){   
  7.           Logger.error(“sql执行错误”+sql+sqlEx);   
  8. }   
      
   I竟在哪里记录异怿息,及怎么记录异常信息Q可能是见仁见智的问题了。甚x些系l让异常cM记录异常。当产生一个新异常对象Ӟ异常信息p自动记录?/div>
java 代码
  1.   public class BusinessException extends Exception {   
  2.       private void logTrace() {   
  3.           StringBuffer buffer=new StringBuffer();   
  4.           buffer.append("Business Error in Class: ");   
  5.           buffer.append(getClassName());   
  6.           buffer.append(",method: ");   
  7.           buffer.append(getMethodName());   
  8.           buffer.append(",messsage: ");   
  9.           buffer.append(this.getMessage());   
  10.           logger.error(buffer.toString());   
  11.              
  12. }   
  13. public BusinessException(String s) {   
  14.          super(s);   
  15. race();   
  16. }   
q似乎看h是十分美妙的Q其实必然导致了异常被重复记录。同时违反了“cȝ职责分配原则”Q是一U不好的设计。记录异怸属于异常cȝ行ؓQ记录异常应 该由专门的日志系l去做。ƈ且异常的记录信息是不断变化的。我们在记录异常同应该给更丰富些的信息。以利于我们能够Ҏ异常信息扑ֈ问题的根源,以解决问 题?/div>
虽然我们对记录异常讨Z很多Q过多的q些反而开发h员更为疑惑,一U好的方式是为系l提供一个异常处理框架。由框架来决定是否记录异常和怎么记录异常。而不是由普通程序员d定。但是了解些q是有益的?/div>
5Q?nbsp;J2EE目中的异常处理
目前,J2ee目一般都会从逻辑上分为多层。比较经典的分ؓ三层Q表C层Q业务层Q集成层(包括数据库访问和外部pȝ的访??/div>
J2ee目有着其复杂性,J2ee目的异常处理需要特别注意几个问题?/div>
在分布式应用Ӟ我们会遇到许多checked异常。所有RMI调用 Q包括EJBq程接口调用Q都会抛出java.rmi.RemoteException;同时RemoteException是checked异常Q当?们在业务pȝ中进行远E调用时Q我们都需要编写大量的代码来处理这些checked异常。而一旦发生RemoteExceptionq些checked?常对pȝ是非怸重的Q几乎没有Q何进行重试的可能。也是_当出现RemoteExceptionq些可怕的checked异常Q我们没有Q何重试的 必要性,却必要~写大量的try…catch代码d理它。一般我们都是在最底层q行RMI调用Q只要有一个RMI调用Q所有上层的接口都会要求抛出 RemoteException异常。因为我们处理RemoteException的方式就是把它l往上抛。这样一来就破坏了我们业务接口?RemoteExceptionq些J2EEpȝU的异常严重的媄响了我们的业务接口。我们对pȝq行分层的目的就是减系l之间的依赖Q每一层的技术改 变不至于影响到其它层?/div>
 
java 代码
  1. //   
  2. public class UserSoaImpl implements UserSoa{   
  3.    public UserInfo getUserInfo(String userId)throws RemoteException{   
  4.       //……   
  5. q程Ҏ调用.   
  6.       //……   
  7.    }   
  8. }   
  9. public interface UserManager{   
  10.    public UserInfo getUserInfo(Stirng userId)throws RemoteException;   
  11. }   
 
同样JDBC讉K都会抛出SQLException的checked异常?/div>
 
Z避免pȝU的checked异常对业务系l的深度侵入Q我们可以ؓ 业务Ҏ定义一个业务系l自q异常。针对像SQLException,RemoteExceptionq些非常严重的异常,我们可以新定义一?unChecked的异常,然后把SQLExceptionQRemoteException装成unChecked异常后抛出?/div>
如果q个pȝU的异常是要交由上一U调用者处理的Q可以新定义一个checked的业务异常,然后把系l的异常封存装成业务的异常后再抛出?/div>
一般地Q我们需要定义一个unChecked异常Q让集成层接口的所有方法都声明抛出qunChecked异常?/span>
java 代码
  1. public DataAccessException extends RuntimeException{   
  2.  ……   
  3. }   
  4. public interface UserDao{   
  5.  public String getPassword(String userId)throws DataAccessException;   
  6. }   
  7.     
  8. public class UserDaoImpl implements UserDAO{   
  9. public String getPassword(String userId)throws DataAccessException{   
  10.  String sql = “select password from userInfo where userId= ‘”+userId+”’”;   
  11. try{   
  12.     …   
  13.      //JDBC调用   
  14.      s.executeQuery(sql);   
  15.     …   
  16.    }catch(SQLException ex){   
  17.       throw new DataAccessException(“数据库查询失?#8221;+sql,ex);   
  18.    }   
  19. }   
  20. }   
 
定义一个checked的业务异常,让业务层的接口的所有方法都声明抛出Checked异常.
 
java 代码
  1. public class BusinessException extends Exception{   
  2.  …..   
  3. }   
  4.     
  5. public interface UserManager{   
  6.    public Userinfo copyUserInfo(Userinfo user)throws BusinessException{   
  7.       Userinfo newUser = null;   
  8.       try{   
  9.         newUser = (Userinfo)user.clone();   
  10. }catch(CloneNotSupportedException ex){   
  11.  throw new BusinessException(“不支持cloneҎ:”+Userinfo.class.getName(),ex);   
  12. }   
  13.  }   
  14. }  
 
J2ee表示层应该是一个很薄的层,主要的功能ؓQ获得页面请求,把页 面的参数l装成POJO对象Q调用相应的业务ҎQ然后进行页面{发,把相应的业务数据呈现l页面。表C层需要注意一个问题,表示层需要对数据的合法性进 行校验,比如某些录入域不能ؓI,字符长度校验{?/div>
J2ee从页面所有传l后台的参数都是字符型的Q如果要求输入数值或日期cd的参数时Q必L字符D{换ؓ相应的数值或日期倹{?/div>
如果表示层代码校验参C合法Ӟ应该q回到原始页面,让用户重新录入数据,q提C相关的错误信息?/div>
 
通常把一个从面传来的参数{换ؓ数|我们可以看到q样的代?/div>
java 代码
  1. ModeAndView handleRequest(HttpServletRequest request,HttpServletResponse response)throws Exception{   
  2.    String ageStr = request.getParameter(“age”);   
  3.    int age = Integer.parse(ageStr);   
  4.    …………   
  5.     
  6.  String birthDayStr = request.getParameter(“birthDay”);   
  7. SimpleDateFormat format = new SimpleDateFormat(“MM/dd/yyyy”);   
  8. Date birthDay = format.parse(birthDayStr);   
  9.     
  10. }   
 
上面的代码应该经常见刎ͼ但是当用户从面录入一个不能{换ؓ整型的字W或一个错误的日期倹{?/div>
Integer.parse()Ҏ被抛Z?NumberFormatException的unChecked异常。但是这个异常绝对不是一个致命的异常,一般当用户在页面的录入域录入的g合法 Ӟ我们应该提示用户q行重新录入。但是一旦抛出unchecked异常Q就没有重试的机会了。像q样的代码造成大量的异怿息显C到面。我们的系l?看v来非常的脆弱?/div>
同样QSimpleDateFormat.parse()Ҏ也会抛出ParseException的unChecked异常?/div>
q种情况我们都应该捕莯些unChecked异常Qƈl提C用户重新录入?/div>
java 代码
  1. ModeAndView handleRequest(HttpServletRequest request,HttpServletResponse response)throws Exception{   
  2.    String ageStr = request.getParameter(“age”);   
  3. String birthDayStr = request.getParameter(“birthDay”);   
  4.    int age = 0;   
  5.  Date birthDay = null;   
  6. try{   
  7. age=Integer.parse(ageStr);   
  8.    }catch(NumberFormatException ex){   
  9.      error.reject(“age”,”不是合法的整数?#8221;);   
  10.    }   
  11.    …………   
  12.     
  13.  try{   
  14. SimpleDateFormat format = new SimpleDateFormat(“MM/dd/yyyy”);   
  15.  birthDay = format.parse(birthDayStr);   
  16. }catch(ParseException ex){   
  17.  error.reject(“birthDay”,”不是合法的日期,请录?#8217;MM/dd/yyy’格式的日?#8221;);   
  18. }   
  19.     
  20. }  
在表C层一定要弄清楚调用方法的是否会抛出unChecked异常Q什么情况下会抛些异常,q作出正的处理?/strong>
在表C层调用pȝ的业务方法,一般情况下是无需要捕获异常的。如果调用的业务Ҏ抛出的异常相当于W二个返回值时Q在q种情况下是需要捕?/strong>


思无 2011-06-27 16:02 发表评论
]]><瞬间之美-web界面设计如何让用户心?gt;d?/title><link>http://www.tkk7.com/ilovebabyfat/archive/2011/06/09/351973.html</link><dc:creator>思无</dc:creator><author>思无</author><pubDate>Thu, 09 Jun 2011 05:30:00 GMT</pubDate><guid>http://www.tkk7.com/ilovebabyfat/archive/2011/06/09/351973.html</guid><wfw:comment>http://www.tkk7.com/ilovebabyfat/comments/351973.html</wfw:comment><comments>http://www.tkk7.com/ilovebabyfat/archive/2011/06/09/351973.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/ilovebabyfat/comments/commentRss/351973.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/ilovebabyfat/services/trackbacks/351973.html</trackback:ping><description><![CDATA[做了q么多年前台的东西,q是W一ơ捧起前台相关的书来看?br />q次看得是Robert Hoekman的第二本书,M感觉看下来,比较受用Q重点讲了下面几个词汇?br />单,清楚Q预期,反馈?br />单:界面要够的单,不要多,更不要无必要?#8220;?#8220;Q要?#8220;?#8220;的东襉K藏v来,多指不常用的Q比?#8220;高“的功能?br />清楚Q突Z么要清楚Q突Z么可以通过颜色Q视觉习惯等Ҏ?br />预期Q用戯知道自己操作的进度,比如填写多页表单?br />反馈Q让用户知道自己操作的结果的提示Q操作完面需要做出反馈以提示用户操作的结果?br /><br />该书从设计用L陆开始,中间I插了一些网站小模块的设计,到最l用户退出系l的设计。比较完整的?1个瞬间讲qC一个用h览网站的q程?br /><br />l自己最大的提示Q老生常谈Q站在用者的角度Q方便用者的目的Qƈ可能依靠用者的“抱?#8221;Q改q系l的设计Q提高用者的效率?img src ="http://www.tkk7.com/ilovebabyfat/aggbug/351973.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/ilovebabyfat/" target="_blank">思无</a> 2011-06-09 13:30 <a href="http://www.tkk7.com/ilovebabyfat/archive/2011/06/09/351973.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java.lang.ClassCastException: oracle.sql.CLOBhttp://www.tkk7.com/ilovebabyfat/archive/2011/06/07/351847.html思无思无Tue, 07 Jun 2011 05:38:00 GMThttp://www.tkk7.com/ilovebabyfat/archive/2011/06/07/351847.htmlhttp://www.tkk7.com/ilovebabyfat/comments/351847.htmlhttp://www.tkk7.com/ilovebabyfat/archive/2011/06/07/351847.html#Feedback0http://www.tkk7.com/ilovebabyfat/comments/commentRss/351847.htmlhttp://www.tkk7.com/ilovebabyfat/services/trackbacks/351847.html转自    oracle.sql.CLOB clob =null;  
    stmt 
= conn.createStatement();  
    rs 
= stmt.executeQuery(sql);  
    
if (rs.next()) {  
        System.out.println(rs.getClob(
column).getClass());  
        clob 
= (oracle.sql.CLOB) rs.getClob(column);  
        out 
= new BufferedWriter(clob.getCharacterOutputStream());  
        
in = new BufferedReader(new StringReader(data));  
    }
q个代码很奇怪,看试没有一炚w题,但是Q项目跑h后,代码 
clob = (oracle.sql.CLOB) rs.getClob(column); 
都会抛出java.lang.ClassCastException: oracle.sql.CLOB异常QWEB容器使用的是TOMCAT5.5Q?先以为是cd转换的问题, 
System.out.println(rs.getClob(column).getClass()); 
但打印出来的?span style="background-color: #00ffff;">oracle.sql.clob 
后又以ؓ是驱动的问题Q把classes12.jar换成了ojdbc14.jar 
可问题还没有解决 

解决的方法: 

在网上狂找,l于扑ֈ一位高人写的一高水^的文章(主要是把我的问题l解决了Q哈Q?nbsp;

是因为驱动包重复了,我理解ؓc重名,我用的是tomcat数据源,哪么Q?TOMCAT_HOME$\comm\lib目录下需?span style="background-color: #00ffff;">oracle驱动包,是给tomcat创徏jndi数据源时用的Q而项目中也要?span style="background-color: #00ffff;">oracle驱动包,是给E序~译用的Q最后用eclilpse?span style="background-color: #ffff00;">java build pathq行外部引用Q用应用程序编译通过Q但也不会把ojdbc14.jar的驱动包引入到发布目录,再试Q果然解决了问题?/div>


思无 2011-06-07 13:38 发表评论
]]>
JQueryhttp://www.tkk7.com/ilovebabyfat/archive/2011/05/31/351441.html思无思无Tue, 31 May 2011 08:19:00 GMThttp://www.tkk7.com/ilovebabyfat/archive/2011/05/31/351441.htmlhttp://www.tkk7.com/ilovebabyfat/comments/351441.htmlhttp://www.tkk7.com/ilovebabyfat/archive/2011/05/31/351441.html#Feedback0http://www.tkk7.com/ilovebabyfat/comments/commentRss/351441.htmlhttp://www.tkk7.com/ilovebabyfat/services/trackbacks/351441.htmlSelectors


Selector Example Selects
* $("*") All elements
#id $("#lastname") The element with id=lastname
.class $(".intro") All elements with class="intro"
element $("p") All p elements
.class.class $(".intro.demo") All elements with the classes "intro" and "demo"
     
:first $("p:first") The first p element
:last $("p:last") The last p element
:even $("tr:even") All even tr elements
:odd $("tr:odd") All odd tr elements
     
:eq(index) $("ul li:eq(3)") The fourth element in a list (index starts at 0)
:gt(no) $("ul li:gt(3)") List elements with an index greater than 3
:lt(no) $("ul li:lt(3)") List elements with an index less than 3
:not(selector) $("input:not(:empty)") All input elements that are not empty
     
:header $(":header") All header elements h1, h2 ...
:animated $(":animated") All animated elements
     
:contains(text) $(":contains('W3Schools')") All elements which contains the text
:empty $(":empty") All elements with no child (elements) nodes
:hidden $("p:hidden") All hidden p elements
:visible $("table:visible") All visible tables
     
s1,s2,s3 $("th,td,.intro") All elements with matching selectors
     
[attribute] $("[href]") All elements with a href attribute
[attribute=value] $("[href='default.htm']") All elements with a href attribute value equal to "default.htm"
[attribute!=value] $("[href!='default.htm']") All elements with a href attribute value not equal to "default.htm"
[attribute$=value] $("[href$='.jpg']") All elements with a href attribute value ending with ".jpg"
     
:input $(":input") All input elements
:text $(":text") All input elements with type="text"
:password $(":password") All input elements with type="password"
:radio $(":radio") All input elements with type="radio"
:checkbox $(":checkbox") All input elements with type="checkbox"
:submit $(":submit") All input elements with type="submit"
:reset $(":reset") All input elements with type="reset"
:button $(":button") All input elements with type="button"
:image $(":image") All input elements with type="image"
:file $(":file") All input elements with type="file"
     
:enabled $(":enabled") All enabled input elements
:disabled $(":disabled") All disabled input elements
:selected $(":selected") All selected input elements
:checked $(":checked") All checked input elements


Events

Method Description
bind() Add one or more event handlers to matching elements
blur() Triggers, or binds a function to the blur event of selected elements
change() Triggers, or binds a function to the change event of selected elements
click() Triggers, or binds a function to the click event of selected elements
dblclick() Triggers, or binds a function to the dblclick event of selected elements
delegate() Add one or more event handlers to current, or future, specified child elements of the matching elements
die() Remove all event handlers added with the live() function
error() Triggers, or binds a function to the error event of selected elements
event.currentTarget The current DOM element within the event bubbling phase
event.data Contains the optional data passed to jQuery.fn.bind when the current executing handler was bound
event.isDefaultPrevented() Returns whether event.preventDefault() was called for the event object
event.isImmediatePropagationStopped() Returns whether event.stopImmediatePropagation() was called for the event object
event.isPropagationStopped() Returns whether event.stopPropagation() was called for the event object
event.pageX The mouse position relative to the left edge of the document
event.pageY The mouse position relative to the top edge of the document
event.preventDefault() Prevents the default action of the event
event.relatedTarget The other DOM element involved in the event, if any
event.result This attribute contains the last value returned by an event handler that was triggered by this event, unless the value was undefined
event.stopImmediatePropagation() Prevents other event handlers from being called
event.stopPropagation() Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event
event.target The DOM element that initiated the event
event.timeStamp This attribute returns the number of milliseconds since January 1, 1970, when the event is triggered
event.type Describes the nature of the event
event.which Which key or button was pressed for a key or button event
focus() Triggers, or binds a function to the focus event of selected elements
focusin() Binds a function to the focusin event of selected elements
focusout() Binds a function to the focusout event of selected elements
hover() Binds one or two functions to the hover event of selected elements
keydown() Triggers, or binds a function to the keydown event of selected elements
keypress() Triggers, or binds a function to the keypress event of selected elements
keyup() Triggers, or binds a function to the keyup event of selected elements
live() Add one or more event handlers to current, or future, matching elements
load() Triggers, or binds a function to the load event of selected elements
mousedown() Triggers, or binds a function to the mouse down event of selected elements
mouseenter() Triggers, or binds a function to the mouse enter event of selected elements
mouseleave() Triggers, or binds a function to the mouse leave event of selected elements
mousemove() Triggers, or binds a function to the mouse move event of selected elements
mouseout() Triggers, or binds a function to the mouse out event of selected elements
mouseover() Triggers, or binds a function to the mouse over event of selected elements
mouseup() Triggers, or binds a function to the mouse up event of selected elements
one() Add one or more event handlers to matching elements. This handler can only be triggered once per element
ready() Binds a function to the ready event of a document
(when an HTML document is ready to use)
resize() Triggers, or binds a function to the resize event of selected elements
scroll() Triggers, or binds a function to the scroll event of selected elements
select() Triggers, or binds a function to the select event of selected elements
submit() Triggers, or binds a function to the submit event of selected elements
toggle() Binds two or more functions to the toggle between for the click event for selected elements
trigger() Triggers all events bound to the selected elements
triggerHandler() Triggers all functions bound to a specified event for the selected elements
unbind() Remove an added event handler from selected elements
undelegate() Remove an event handler to selected elements, now or in the future
unload() Triggers, or binds a function to the unload event of selected elements

Effect
Method Description
animate() Performs a custom animation (of a set of CSS properties) for selected elements
clearQueue() Removes all queued functions for the selected element
delay() Sets a delay for all queued functions for the selected element
dequeue() Runs the next queued functions for the selected element
fadeIn() Gradually changes the opacity, for selected elements, from hidden to visible
fadeOut() Gradually changes the opacity, for selected elements, from visible to hidden
fadeTo() Gradually changes the opacity, for selected elements, to a specified opacity
hide() Hides selected elements
queue() Shows the queued functions for the selected element
show() Shows hidden selected elements
slideDown() Gradually changes the height, for selected elements, from hidden to visible
slideToggle() Toggles between slideUp() and slideDown() for selected elements
slideUp() Gradually changes the height, for selected elements, from visible to hidden
stop() Stops a running animation on selected elements
toggle() Toggles between hide() and show(), or custom functions, for selected elements

HTML

Method Description
addClass() Adds one or more classes (for CSS) to selected elements
after() Inserts content after selected elements
append() Inserts content at the end of (but still inside) selected elements
appendTo() Inserts content at the end of (but still inside) selected elements
attr() Sets or returns an attribute and value of selected elements
before() Inserts content before selected elements
clone() Makes a copy of selected elements
detach() Removes (but keeps a copy of) selected elements
empty() Removes all child elements and content from selected elements
hasClass() Checks if any of the selected elements have a specified class (for CSS)
html() Sets or returns the content of selected elements
insertAfter() Inserts HTML markup or elements after selected elements
insertBefore() Inserts HTML markup or elements before selected elements
prepend() Inserts content at the beginning of (but still inside) selected elements
prependTo() Inserts content at the beginning of (but still inside) selected elements
remove() Removes selected elements
removeAttr() Removes an attribute from selected elements
removeClass() Removes one or more classes (for CSS) from selected elements
replaceAll() Replaces selected elements with new content
replaceWith() Replaces selected elements with new content
text() Sets or returns the text content of selected elements
toggleClass() Toggles between adding/removing one or more classes (for CSS) from selected elements
unwrap() Removes the parent element of the selected elements
val() Sets or returns the value attribute of the selected elements (form elements)
wrap() Wraps specified HTML element(s) around each selected element
wrapAll() Wraps specified HTML element(s) around all selected elements
wrapInner() Wraps specified HTML element(s) around the content of each selected element

CSS

Method Description
addClass() Adds one or more classes to selected elements
css() Sets or returns one or more style properties for selected elements
hasClass() Checks if any of the selected elements have a specified class
height() Sets or returns the height of selected elements
offset() Sets or returns the position (relative to the document) for selected elements
offsetParent() Returns the first parent element that is positioned
position() Returns the position (relative to the parent element) of the first selected element
removeClass() Removes one or more classes from selected elements
scrollLeft() Sets or returns the horizontal position of the scrollbar for the selected elements
scrollTop() Sets or returns the vertical position of the scrollbar for the selected elements
toggleClass() Toggles between adding/removing one or more classes from selected elements
width() Sets or returns the width of selected elements

AJAX

Method Description
$.ajax() Performs an AJAX request
ajaxComplete() Specifies a function to run when the AJAX request completes
ajaxError() Specifies a function to run when the AJAX request completes with an error
ajaxSend() Specifies a function to run before the AJAX request is sent
$.ajaxSetup() Sets the default values for future AJAX requests
ajaxStart() Specifies a function to run when the first AJAX request begins
ajaxStop() Specifies a function to run when all AJAX requests have completed
ajaxSuccess() Specifies a function to run an AJAX request completes successfully
$.get() Loads data from a server using an AJAX HTTP GET request
$.getJSON() Loads JSON-encoded data from a server using a HTTP GET request
$.getScript() Loads (and executes) a JavaScript from the a server using an AJAX HTTP GET request
load() Loads data from a server and puts the returned HTML into the selected element
$.param() Creates a serialized representation of an array or object (can be used as URL query string for AJAX requests)
$.post() Loads data from a server using an AJAX HTTP POST request
serialize() Encodes a set of form elements as a string for submission
serializeArray() Encodes a set of form elements as an array of names and values

MISC

Method Description
data() Attaches data to, or gets data from, selected elements
each() Run a function for each element matched by the jQuery selector
get() Get the DOM elements matched by the selector
index() Search for a given element from among the matched elements
$.noConflict() Release jQuery's control of the $ variable
$.param() Creates a serialized representation of an array or object (can be used as URL query string for AJAX requests)
removeData() Removes a previously-stored piece of data
size() Return the number of DOM elements matched by the jQuery selector
toArray() Retrieve all the DOM elements contained in the jQuery set, as an array


思无 2011-05-31 16:19 发表评论
]]> վ֩ģ壺 ڵaëƬѿ| ϺƷAV߲| һAvëƬþþƷ| ߹ۿʮ| þŮƷƷ | ޾ƷƵ| AVպAVþ| Ƶ88| ˾ƷƵ99߹ۿ| 91޹˾þþƷ| ޸Ļַ| 99Ƶۿ| Ѹ߹ۿ| Ƶվ| ˳վ7777Ƶ| 99þþùƷ| ˾ҹƵ| 91޹˾Ʒ| һþۺ³³ | ߹ۿվ| Ļ߹ۿƵ| ؼëƬAëƬ100Ѳ | ѹۿƵ| þþþþ޾Ʒ| mm1313޾Ʒ| һѹۿƵwww| 91Ƶ| ƷƵ| һƵ߹ۿ| þ޹ҹƷƬ | þþƷAV| ɱƬav| ȫaëƬѿ| 鶹ȫַ| av߾Ʒ޵һվ| sɫƬ߹ۿ| ޹һƵ| ƬѸƬ| 91Ƶ91| ӰҹƵ| þѹۿƷ|