??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲成在人线aⅴ免费毛片 ,亚洲成色999久久网站,亚洲av永久无码精品天堂久久http://www.tkk7.com/kelly/category/49859.htmlzh-cnThu, 09 Jan 2014 15:17:41 GMTThu, 09 Jan 2014 15:17:41 GMT60tomcat_dbcpq接池详?/title><link>http://www.tkk7.com/kelly/archive/2013/12/20/407832.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Fri, 20 Dec 2013 15:01:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2013/12/20/407832.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/407832.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2013/12/20/407832.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/407832.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/407832.html</trackback:ping><description><![CDATA[<div style="widows: 2; text-transform: none; text-indent: 0px; margin: 7px 0px 10px; width: 758px; letter-spacing: normal; zoom: 1; font: 14px/1.5 tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); overflow: hidden; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" id="content" class="content mod-cs-content text-content clearfix"> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">1   ~写目的 </p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">本文详细介绍了DBCPq接池的各个配置参数的含义,q过实际例子演示不同的参数设|可能参数的l果?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">2   适用对象 </p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">  目实施人员</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">3   参考资?nbsp;</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">4   知识文g主要内容4.1q接池知识简?nbsp;</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">L周知建立数据库连接是一个非常耗时耗资源的行ؓQ因此现代的Web中间Ӟ无论是开源的Tomcat、Jbossq是商业的websphere、weblogic都提供了数据库连接池功能Q可以毫不夸张的_数据库连接池性能的好坏,不同厂商对连接池有着不同的实玎ͼ本文只介l拜特公怋用较多的开源web中间件Tomcat中默认的q接池DBCPQDataBase connection poolQ的使用?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">4.2Tomcat下配|连接池 </p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">下面以tomcat5.5.26Z来介l如何配|连接池</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">1Q需要的jar</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">在tomcat的安装目录common\lib下有一个naming-factory-dbcp.jarQ这个是tomcat修改后的dbcpq接池实玎ͼ同时Z能够正常q行Q还需要commons-pool.jar?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">2Q徏立context文g</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">q入到conf\Catalina\localhost新徏一个上下文文gQ文件的名称既ؓ来要访问是输入url上下文名Uͼ例如我们建立一个名为btweb的文件内容如下:</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><Context debug="0" docBase="D:\v10_workspace\build\WebRoot"<br />reloadable="false"><br /><Resource<br />name="jdbc/btdb1"<br />type="javax.sql.DataSource"<br />factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"<br />username="v10"<br />password="v10"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">driverClassName="oracle.jdbc.driver.OracleDriver"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">url="jdbc:oracle:thin:@127.0.0.1:1521:cahs"<br />maxActive="5"<br />maxIdle="3"<br />maxWait="5000"<br />removeAbandoned="true"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">removeAbandonedTimeout="60"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">testOnBorrow="true"<br />validationQuery="select count(*) from bt_user"<br />logAbandoned="true"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><br />/><br /></Context></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">4.3参数分步介绍 </p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">u<br /><strong>数据库连接相?/strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">username="v10"<br />password="v10"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">driverClassName="oracle.jdbc.driver.OracleDriver"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">url="jdbc:oracle:thin:@127.0.0.1:1521:cahs"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">u<br /><strong>jndi</strong><strong>相关</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">name="jdbc/btdb1"<br />type="javax.sql.DataSource"<br />factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">factory默认是org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactoryQtomcat也允讔R用其他连接实玎ͼ不过默认使用dbcp?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">u<br /><strong>q接数控制与q接归还{略</strong><br />maxActive="5"<br /></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">maxIdle="3"<br /></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">minIdle=”2”<br />maxWait="5000"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">u<br /><strong>  </strong><strong>应对|络不稳定的{略</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">testOnBorrow="true"<br />validationQuery="select count(*) from bt_user"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">u<br /><strong>应对q接泄漏的策?/strong><br />removeAbandoned="true"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">removeAbandonedTimeout="60"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><br />logAbandoned="true"</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">   </p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">如下图所C:q接池处于应用程序与数据库之_一斚w应用E序通过它来获取q接Q归q连接,另一斚wq接又需要从数据里获取连接,归还q接?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">步骤1Q系l启?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">pȝ启动Ӟ初始化连接池Q由于没有Q何请求连接池中连接数??/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><strong>maxActive="5"</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">表示q发情况下最大可从连接池中获取的q接数。如果数据库不是单独Q供一个应用用,通过讄maxActive参数可以避免某个应用无限制的获取q接对其他应用造成影响Q如果一个数据库只是用来支持一个应用那么maxActive理论上可以设|成该数据库可以支撑的最大连接数。maxActive只是表示通过q接池可以ƈ发的获取的最大连接数?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">从图上我们可以看到连接的获取与释放是双向Q当应用E序q发hq接池时Q连接池需要从数据库获取连接,那么但应用程序用完q接q将q接归还l连接池Ӟq接池是否也同时连接归q给数据库呢Q很昄{案是否定的Q如果那L话连接池变得多此一举,不但不能提高性能Q反而会降低性能Q那么但应用成归q连接后Q连接池如何处理呢?</p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><strong>maxIdle="3"</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">如果在ƈ发时辑ֈ了maxActive=5Q那么连接池必M数据库中获取5个连接来供应用程序用,当应用程序关闭连接后Q由于maxIdle=3,因此q不是所有的q接都会归还l数据库Q将会有3个连接保持在q接池种中,状态ؓI闲?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><strong>minIdle=</strong><strong>”</strong><strong>2</strong><strong>”</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">最默认情况下q不生效Q它的含义是当连接池中的q接有minIdleQ系l监控线E将启动补充功能Q一般情况下我们q不启动补充U程?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><strong>问题Q如何设|maxActive和maxIdleQ?/strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">理论上讲maxActive应该讄成应用的最大ƈ发数Q这样一来即便是在最大ƈ发的情况下,应用依然能够从连接池中获取连接,但是困难时的是我们很隑և估计到最大ƈ发数Q设|成最大ƈ发数是一U最优的服务质量保证Q事实上Q如果某个用L录提C系l繁忙,那么在他再次dӞ可能pȝ资源已经充Q对于拜特资金管理系l我们徏议将<strong>maxActive</strong>讄为系l注册h数的十分之一C十分之一之间。例如系l的注册人数?000Q那么设|成50-100靠近100的数字,例如85?0?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><br /><strong>maxIdle</strong>对应的连接,实际上是q接池保持的长连接,q也是连接池发挥优势的部分,理论上讲保持较多的长q接Q在应用h时可以更快的响应Q但是过多的q接保持Q反而会消耗数据库大量的资源,因此<strong>maxIdle</strong>也ƈ不是大好Q同上例我们?strong>maxIdle</strong>讄?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">50-100中靠q?0的数字,例如55。这样就能在兼顾最大ƈ发同Ӟ保持较少的数据库q接Q而且在绝大多情况Q能够ؓ应用E序提供最快的相应速度?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><strong>testOnBorrow="true"</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><strong>validationQuery="select count(*) from bt_user"</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">我们知道数据库连接从本质上架构在tcp/ipq接之上Q一般情况下web服务器与数据库服务器都不在同一台物理机器上Q而是通过|络q行q接Q那么当建立数据库连接池的机器与数据库服务器自己出现|络异常Ӟ保持在连接池中的q接失效,不能够在ơ用,传统的情况下只能通过重新启动Q再ơ徏立连接,通过讄以上两个参数Q但应用E序从连接池中获取连接时Q会首先q行zd性检,当获取的q接是活动的时候才会给应用E序使用Q如果连接失效,q接释放该q接?strong>validationQuery</strong>是一条测试语句,没有实际意义Q现实中Q一般用一条最为简单的查询语句充当?/p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><strong>removeAbandoned="true"</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><strong>removeAbandonedTimeout="60"</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px"><strong>logAbandoned="true"</strong></p> <p style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px">有时_心的程序编写者在从连接池中获取连接用后忘记了连接的关闭Q这栯池的q接׃逐渐辑ֈ<strong>maxActive</strong>直至q接池无法提供服务。现代连接池一般提供一U?#8220;”的检查,但设|了<strong>removeAbandoned="true"</strong>Ӟ当连接池q接数到?getNumIdle() < 2) and (getNumActive() > getMaxActive() - 3)时便会启动连接回Ӟ那种zd旉过<strong>removeAbandonedTimeout="60"</strong>的连接将会被回收Q同时如?strong>logAbandoned="true"</strong>讄为true,E序在回收连接的同时会打印日志?strong>removeAbandoned</strong>是连接池的高U功能,理论上这中配|不应该出现在实际的生环境Q因为有时应用程序执行长事务Q可能这U情况下Q会被连接池误回Ӟ该种配置一般在E序试阶段Qؓ了定位连接泄漏的具体代码位置Q被开启,生环境中连接的关闭应该靠程序自׃证?/p></div><img src ="http://www.tkk7.com/kelly/aggbug/407832.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2013-12-20 23:01 <a href="http://www.tkk7.com/kelly/archive/2013/12/20/407832.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Base64在js传递参C含加?+)的处理方??/title><link>http://www.tkk7.com/kelly/archive/2013/12/17/407677.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Tue, 17 Dec 2013 03:03:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2013/12/17/407677.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/407677.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2013/12/17/407677.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/407677.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/407677.html</trackback:ping><description><![CDATA[<p style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto; letter-spacing: normal; font: 15px/24px 微Y雅黑, 宋体, Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">一般情况下QURL 中的参数应?url ~码规则Q即把参数字W串中除?-_. 之外的所有非字母数字字符都将被替换成癑ֈP%Q后跟两位十六进制数Q空格则~码为加P+Q。但是对于带有中文的参数来说Q这U编码会使编码后的字W串变得很长。如果希望有短一点的方式对参数编码,可以采用 base64 ~码方式对字W串q行~码Q但?base64 ~码方式不能处理 JavaScript 中的中文Q因?JavaScript 中的中文都是?UTF-16 方式保存的。?base64 只能处理单字节字W,所以不能直接用 base64 对带有中文的 JavaScript 字符串进行编码。但是可以通过 <a style="color: rgb(70,70,70); text-decoration: none" rel="nofollow">utf.js</a> q个E序中提供的 utf16to8 来将 UTF-16 ~码的中文先转化?UTF-8 方式Q然后再q行 base64 ~码。这L码后的字W串Q在传递到服务器端后可以直接通过 base64_decode 解码?UTF-8 的中文字W串。但是还有个问题需要注意。base64 ~码中用了加号Q?Q,?+ ?URL 传递时会被当成I格Q因此必要?base64 ~码后的字符串中的加h换成 %2B 才能当作 URL 参数q行传递。否则在服务器端解码后就会出错?/p> <p style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; margin: 10px auto; letter-spacing: normal; font: 15px/24px 微Y雅黑, 宋体, Arial; white-space: normal; orphans: 2; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">所以我们需要做的就是:<br />js中:encodeURI(str).replace(/\+/g,'%2B')<br />java中:str.replaceAll("<a href='file://\\+","%2B' href_cetemp='file://\\+","%2B'>\\+","%2B</a>")</p><img src ="http://www.tkk7.com/kelly/aggbug/407677.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2013-12-17 11:03 <a href="http://www.tkk7.com/kelly/archive/2013/12/17/407677.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java中比较两个doublecd的数据的大小http://www.tkk7.com/kelly/archive/2013/11/07/406106.htmlkellykellyThu, 07 Nov 2013 07:42:00 GMThttp://www.tkk7.com/kelly/archive/2013/11/07/406106.htmlhttp://www.tkk7.com/kelly/comments/406106.htmlhttp://www.tkk7.com/kelly/archive/2013/11/07/406106.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/406106.htmlhttp://www.tkk7.com/kelly/services/trackbacks/406106.htmlDoublecd不能直接q行比较大小?br />非整型数Q运由于精度问题,可能会有误差Q徏议用BigDecimalcdQ具体BigDecimal的详l说明参考jdk开发帮助文档?/span>

public class Test {
 public static String compare(BigDecimal val1, BigDecimal val2) {
  String result = "";
  if (val1.compareTo(val2) < 0) {
   result = "W二位数大!";
   }
  if (val1.compareTo(val2) == 0) {
   result = "两位C样大Q?;
   }
  if (val1.compareTo(val2) > 0) {
   result = "W一位数大!";
   }
  return result;
  }
 
 public static void main(String[] args) {
  String a = "200.5"; String b = "1000";
  BigDecimal data1 = new BigDecimal(a);
  BigDecimal data2 = new BigDecimal(b);
  System.out.print(compare(data1, data2));
  }
}


kelly 2013-11-07 15:42 发表评论
]]>
正则表达式,金额_到小数点两位,javascript,java版本-?/title><link>http://www.tkk7.com/kelly/archive/2013/11/07/406094.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Thu, 07 Nov 2013 05:31:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2013/11/07/406094.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/406094.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2013/11/07/406094.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/406094.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/406094.html</trackback:ping><description><![CDATA[<span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">l常处理金额Q对于输入需要做验证处理Q下面给出正则表辑ּ和解释:</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">javascritpt的应用:</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">var patrn=/^(-)?(([1-9]{1}\d*)|([0]{1}))(\.(\d){1,2})?$/;</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">if (!patrn.exec('-012312123.23')) {</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">alert('false');</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">}else{</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">alert('true');</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">}</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">解读/^(-)?(([1-9]{1}\d*)|([0]{1}))(\.(\d){1,2})?$/</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">^表示以什么开?我们q里?- Q后面的Q是表示“-”出现一ơ或者零?/span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">(([1-9]{1}\d*)|([0]{1})) 表示不以0开头的数字l合或者仅出现一?</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">(\.(\d){1,2})?表示数点后两位Q出?ơ或者一?/span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">必须是大?的金额正则表辑ּQ?/span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">var patrn=/^(([1-9]{1}\d*)|([0]{1}))(\.(\d){1,2})?$/;</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Java里的应用Q?/span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Pattern pattern = Pattern.compile("^(-)?(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){1,2})?$");</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Matcher matcher = pattern.matcher("-0.11");</span><br style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /><span style="widows: 2; text-transform: none; background-color: rgb(255,255,255); text-indent: 0px; letter-spacing: normal; display: inline !important; font: 14px/21px tahoma, helvetica, arial; white-space: normal; orphans: 2; float: none; color: rgb(69,69,69); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">System.out.println(matcher.matches());</span> <img src ="http://www.tkk7.com/kelly/aggbug/406094.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2013-11-07 13:31 <a href="http://www.tkk7.com/kelly/archive/2013/11/07/406094.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>get方式使用utf-8~码时URL中文q解决Ҏhttp://www.tkk7.com/kelly/archive/2011/09/30/359846.htmlkellykellyFri, 30 Sep 2011 03:34:00 GMThttp://www.tkk7.com/kelly/archive/2011/09/30/359846.htmlhttp://www.tkk7.com/kelly/comments/359846.htmlhttp://www.tkk7.com/kelly/archive/2011/09/30/359846.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/359846.htmlhttp://www.tkk7.com/kelly/services/trackbacks/359846.htmlq在响应面中添加了request.setCharacterEncoding("GB2312");//q转换
response.setContentType("text/html;charset=GB2312");
 response.setCharacterEncoding("GB2312");但是得到的还是ؕ码?br />
后来把项目改成GB2312~码Qget方式提交可以得到正常的中文。后来通过癑ֺ和googl的编码得C启发。百度中输入中文搜烦Qurl中显C的是中文。google输入中文q行搜烦Qurl中显C的是带%的编码。说明百度用的是GB2312~码Q中文可以正常解析。google用的是UTF-8~码Q所以需要对中文q行转码?br />
下面是我目中的解决ҎQ?br />1、在h面中把中文参数q行转码
如:String content="试短信";
content=URLEncoder.encode(content,"UTF-8");

2、在接收参数的响应页面进行中文参数的解码
如:String message= URLDecoder.decode(request.getParameter,"UTF-8");

l过q次的问题,个h认ؓq是用GB2312~码比较省事?/div>


kelly 2011-09-30 11:34 发表评论
]]>换掉tomcat默认的图?/title><link>http://www.tkk7.com/kelly/archive/2011/06/24/352931.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Fri, 24 Jun 2011 02:46:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2011/06/24/352931.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/352931.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2011/06/24/352931.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/352931.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/352931.html</trackback:ping><description><![CDATA[<span id="qkueqko" class="Apple-style-span" style="font-family: simsun; ">为换成项目自带标志,我们仅仅需要修改一下项目根目录下的图标Q有以下几个ҎQ?br />1、比如修?span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; "><a href="http://localhost:8080/" style="text-decoration: none; color: #36649d; ">http://localhost:8080</a></span>讉K的图标,我们可以Q修?span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">E:\apache-tomcat-5.5.28\webapps\ROOT</span>下的Q?span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">ico</span>文gQ将该文件替换成惌的图标即可,命名也ؓ<span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">favicon.ico,</span>pȝ会自动找到这个文件?/span><span id="eogcykc" class="Apple-style-span" style="font-family: simsun; "><p style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; word-wrap: normal; word-break: normal; "><span style="word-wrap: normal; word-break: normal; "><span style="font-family: simsun; font-size: 14px; "></span></span></p><p style="color: #494949; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; word-wrap: normal; word-break: normal; line-height: 12.25pt; "><span style="word-wrap: normal; word-break: normal; line-height: 21px; color: black; ">2、系l部|到<span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">TOMCAT</span>Q访问时<span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">IE</span>栏出?span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">TOMCAT</span>的小猫图?span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; "> </span></span></p><p style="color: #494949; margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; word-wrap: normal; word-break: normal; line-height: 12.25pt; "><span style="word-wrap: normal; word-break: normal; line-height: 21px; color: black; ">同样如果部v?span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">webapps</span>下面的也一样处理?br />3、或者直接在tomcat安装跟目录下放一个命名ؓtomcat.ico文g的图标,所有项目将引用q个图标。(我暂旉用的q种方式Q?/span></p></span><p> </p><span id="swaocmc" class="Apple-style-span" style="font-family: simsun; ">但是Q如果直接替换,效果不会昄出来Q重?span xml:lang="EN-US" style="word-wrap: normal; word-break: normal; line-height: 21px; ">tomcat</span>也不用Q这是由于浏览器~冲造成的我们把历史记录删除卛_?/span><span id="yssoqiy" class="Apple-style-span" style="font-family: simsun; "><p style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; list-style-type: none; list-style-position: initial; list-style-image: initial; word-wrap: normal; word-break: normal; "><br /></p></span><img src ="http://www.tkk7.com/kelly/aggbug/352931.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2011-06-24 10:46 <a href="http://www.tkk7.com/kelly/archive/2011/06/24/352931.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JDK6.0下蝲,JDK1.5下蝲,eclipse3.2中文版下?linux安装配置jdk1 (转蝲)http://www.tkk7.com/kelly/archive/2011/03/03/345611.htmlkellykellyThu, 03 Mar 2011 09:18:00 GMThttp://www.tkk7.com/kelly/archive/2011/03/03/345611.htmlhttp://www.tkk7.com/kelly/comments/345611.htmlhttp://www.tkk7.com/kelly/archive/2011/03/03/345611.html#Feedback2http://www.tkk7.com/kelly/comments/commentRss/345611.htmlhttp://www.tkk7.com/kelly/services/trackbacks/345611.html

 

 

 

linux安装配置jdk1.5、tomcat5.5、eclipse3.2、Myeclipse

linux安装配置jdk1.5、tomcat5.5、eclipse3.2、Myeclipse5.1详解
      包括安装jdk1.5Qtomcat5.5Qeclipse3.2QMyeclipse5.1到配|搭建成功?

W一步:下蝲所要的Y?

下蝲jdk1.5?
下蝲tomcat5.5?
下蝲eclipse3.2?
下蝲Myeclipse5.1

W二步:安装已下载Y?
假设你将上诉所要下载的软g全部从光盘拷贝或者通过pc机ftp到linux服务器上传到/home/user/Downloads目录下?

首先要安装jdk1.5
          1. 打开l端Q运行命令su root 切换到超U用戗?
          2.cd切换?home/user/Downloads目录下。运行命?cp jdk-1_5_0_12-linux-i586.bin /usr/localjdk复制?usr/local目录下?
          3.cd切换?usr/local目录下。运行命?chmod a+x jdk-1_5_0_12-linux-i586.binl於相应权限?
          4.q行命o ./jdk-1_5_0_12-linux-i586.bin {待Q按提示安装jdkQ假讑֮装在/usr/local目录下。jdk安装完成?

然后安装tomcat5.5
              1.cd切换?home/user/Downloads目录下。运行命令cp apache-tomcat-5.tar.gz /usr/local其拯?usr/local目录下?
          2.cd切换?usr/local目录下。运行命令tar xvfz apache-tomcat-5.tar.gz其?usr/local目录中解压。tomcat5.5安装完成?

安装eclipse3.2
          1.cd切换?home/user/Downloads目录下。运行命令cp eclipse-SDK-3.2.2-linux-gtk.tar.gz /usr/local其拯?usr/local目录下?
          2.cd切换?usr/local目录下。运行命令tar xvfz eclipse-SDK-3.2.2-linux-gtk.tar.gz 其解压。eclipse3.2安装完成?

安装Myeclipse5.1
1.cd切换?home/user/Downloads目录下。运行命令cp MyEclipseEnterprise(Linux)WorkbenchInstaller_5_1_0GA_E3_2_1.bin /usr/local其拯?usr/local目录下?
          2.cd切换?usr/local目录下。运行命令chmod +x MyEclipseEnterprise(Linux)WorkbenchInstaller_5_1_0GA_E3_2_1.bin ,然后q行$./M*.bin 安装q程中会提示选择Eclipse安装目录Q按照你实际的Eclipse安装目录q行选择卛_。Myeclipse安装完成?
到此步骤Q安装Y件已l完成了Q但是还不能q行Q还要进行配|?


W三步:配置环境变量

          首先q行命o vi /etc/profile 出现profile文g源代码?
          按键盘子?#8220;i”q入插入模式?
          在profile文g中插入以下代码:
           export JAVA_HOME=/usr/local/java
      export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
       export CLASSPATH=.:/usr/local/java/lib:/usr/local/java/jre/lib:$CLASSPATH
       export TOMCAT_HOME=/usr/local/tomcat
          我得源文件代码是q样Q?
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
        if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
           if [ "$2" = "after" ] ; then
              PATH=$PATH:$1
           else
              PATH=$1:$PATH
           fi
        fi
}
# Path manipulation
#if [ `id -u` = 0 ]; then
        pathmunge /sbin
        pathmunge /usr/sbin
        pathmunge /usr/local/sbin
#fi
pathmunge /usr/X11R6/bin after
unset pathmunge
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1

USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"

HOSTNAME=`/bin/hostname`
HISTSIZE=1000

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi

export JAVA_HOME=/usr/local/java
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.:/usr/local/java/lib:/usr/local/java/jre/lib:$CLASSPATH
export TOMCAT_HOME=/usr/local/tomcat


export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC

for i in /etc/profile.d/*.sh ; do
    if [ -r "$i" ]; then
        . $i
    fi
done
unset i
export G_BROKEN_FILENAMES=true
          黑体字部分是插入代码?
          插入完成后按“ESC”健。在按大写的子母“ZZ”。保存退出?
          环境变量配置完成后,可以做以下策试?
          q行命ojava -versionQ出现jdk版本和相关信息,证明jdk已经OK了?
          cd切换?opt/tomcat/bin目录下,q行命o ./startup.shQ出现如下信息:
           Using CATALINA_BASE:   /opt/tomcat
           Using CATALINA_HOME:   /opt/tomcat
           Using CATALINA_TMPDIR: /opt/tomcat/temp
           Using JRE_HOME:       /usr/java/jre1.5.0_05
          证明安装成功。如果以上策试没成功的话Q请仔细查环境变量的配置?
          到此步骤为止Q已l成功的配置完成了jdk和tomcat。该是配|我们eclipse的时候了?/div>


kelly 2011-03-03 17:18 发表评论
]]>
java处理日期旉 相加减大?/title><link>http://www.tkk7.com/kelly/archive/2011/02/21/344755.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Mon, 21 Feb 2011 04:15:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2011/02/21/344755.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/344755.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2011/02/21/344755.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/344755.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/344755.html</trackback:ping><description><![CDATA[<p>java处理日期旉 相加?br /> JAVA处理日期旉常用ҎQ?<br /> <br /> 1.java.util.Calendar <br /> Calendar cL一个抽象类Q它为特定瞬间与一l诸?YEAR、MONTH、DAY_OF_MONTH、HOUR {?日历字段之间的{换提供了一些方法,qؓ操作日历字段Q例如获得下星期的日期)提供了一些方法。瞬间可用毫U值来表示Q它是距历元Q即格林威治标准旉 1970 q?1 ?1 日的 00:00:00.000Q格里高利历Q的偏移量?<br /> <br /> ? <br /> Java代码  <br /> 1. Calendar cal = Calendar.getInstance();//使用默认时区和语a环境获得一个日历?nbsp;   <br /> 2. cal.add(Calendar.DAY_OF_MONTH, -1);//取当前日期的前一?    <br /> 3.   <br /> 4. cal.add(Calendar.DAY_OF_MONTH, +1);//取当前日期的后一?    <br /> 5.   <br /> 6. //通过格式化输出日?nbsp;   <br /> 7. java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd");    <br /> 8.   <br /> 9. System.out.println("Today is:"+format.format(Calendar.getInstance().getTime()));    <br /> 10.   <br /> 11. System.out.println("yesterday is:"+format.format(cal.getTime()));  <br /> <br /> <br /> 得到2007-12-25日期: <br /> Java代码  <br /> 1. Calendar calendar = new GregorianCalendar(2007, 11, 25,0,0,0);    <br /> 2. Date date = calendar.getTime();    <br /> 3. System.out.println("2007 Christmas is:"+format.format(date));  <br /> <br /> java月䆾是从0-11,月䆾讄时要?. <br /> <br /> GregorianCalendar构造方法参CơؓQ年Q月-1Q日Q时Q分Q秒. <br /> <br /> 取日期的部分: <br /> Java代码  <br /> 1. int year =calendar.get(Calendar.YEAR);    <br /> 2.   <br /> 3. int month=calendar.get(Calendar.MONTH)+1;    <br /> 4.   <br /> 5. int day =calendar.get(Calendar.DAY_OF_MONTH);    <br /> 6.   <br /> 7. int hour =calendar.get(Calendar.HOUR_OF_DAY);    <br /> 8.   <br /> 9. int minute =calendar.get(Calendar.MINUTE);    <br /> 10.   <br /> 11. int seconds =calendar.get(Calendar.SECOND);  <br /> <br /> <br /> 取月份要?. <br /> <br /> 判断当前月䆾的最大天? <br /> Java代码  <br /> 1. Calendar cal = Calendar.getInstance();    <br /> 2. int day=cal.getActualMaximum(Calendar.DAY_OF_MONTH);    <br /> 3. System.out.println(day);  <br /> <br /> <br /> 2.java.util.Date <br /> Java代码  <br /> 1. java.util.Date today=new java.util.Date();    <br /> 2. System.out.println("Today is "+formats.format(today));  <br /> <br /> <br /> 取当月的W一? <br /> Java代码  <br /> 1. java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-01");    <br /> 2. java.util.Date firstDay=new java.util.Date();    <br /> 3. System.out.println("the month first day is "+formats.format(firstDay));  <br /> <br /> 取当月的最后一? <br /> Java代码  <br /> 1.     <br /> 2. Calendar cal = Calendar.getInstance();    <br /> 3. int maxDay=cals.getActualMaximum(Calendar.DAY_OF_MONTH);    <br /> 4. java.text.Format formatter3=new java.text.SimpleDateFormat("yyyy-MM-"+maxDay);    <br /> 5. System.out.println(formatter3.format(cal.getTime()));  <br /> <br /> <br /> 求两个日期之间相隔的天数: <br /> Java代码  <br /> 1. java.text.SimpleDateFormat format = new java.text.SimpleDateFormat("yyyy-MM-dd");    <br /> 2. java.util.Date beginDate= format.parse("2007-12-24");    <br /> 3. java.util.Date endDate= format.parse("2007-12-25");    <br /> 4. long day=(date.getTime()-mydate.getTime())/(24*60*60*1000);    <br /> 5. System.out.println("盔R的天?"+day);  <br /> <br /> 一q前的日? <br /> Java代码  <br /> 1. java.text.Format formatter=new java.text.SimpleDateFormat("yyyy-MM-dd");    <br /> 2. java.util.Date todayDate=new java.util.Date();    <br /> 3. long beforeTime=(todayDate.getTime()/1000)-60*60*24*365;    <br /> 4. todayDate.setTime(beforeTime*1000);    <br /> 5. String beforeDate=formatter.format(todayDate);    <br /> 6. System.out.println(beforeDate);  <br /> <br /> 一q后的日? <br /> Java代码  <br /> 1. java.text.Format formatter=new java.text.SimpleDateFormat("yyyy-MM-dd");    <br /> 2. java.util.Date todayDate=new java.util.Date();    <br /> 3. long afterTime=(todayDate.getTime()/1000)+60*60*24*365;    <br /> 4. todayDate.setTime(afterTime*1000);    <br /> 5. String afterDate=formatter.format(todayDate);    <br /> 6. System.out.println(afterDate);  <br /> <br /> ?0时后的旉 <br /> Java代码  <br /> 1. java.util.Calendar Cal=java.util.Calendar.getInstance();    <br /> 2. Cal.setTime(dateOper);    <br /> 3. Cal.add(java.util.Calendar.HOUR_OF_DAY,10);    <br /> 4. System.out.println("date:"+forma.format(Cal.getTime()));  <br /> <br /> ?0时前的旉 <br /> Java代码  <br /> 1. java.util.Calendar Cal=java.util.Calendar.getInstance();    <br /> 2. Cal.setTime(dateOper);    <br /> 3. Cal.add(java.util.Calendar.HOUR_OF_DAY,-10);    <br /> 4. System.out.println("date:"+forma.format(Cal.getTime()));  <br /> <br /> 3.java.sql.Date <br /> l承自java.util.Date,是操作数据库用的日期cd <br /> Java代码  <br /> 1. java.sql.Date sqlDate = new java.sql.Date(java.sql.Date.valueOf("2007-12-25").getTime());  <br /> <br /> 日期比较:单的比较可以以字W串的Ş式直接比?也可使用 <br /> java.sql.Date.valueOf("2007-03-08").compareTo(java.sql.Date.valueOf("2007-03-18"))方式来比较日期的大小.也可使用java.util.Date.after(java.util.Date)来比? <br /> <br /> 相差旉Q?<br /> long difference=c2.getTimeInMillis()-c1.getTimeInMillis(); <br /> 相差天数Qlong day=difference/(3600*24*1000) <br /> 相差时Qlong hour=difference/(3600*1000) <br /> 相差分钟Qlong minute=difference/(60*1000) <br /> 相差U: long second=difference/1000 <br /> <br /> 补充Q?<br /> Java代码  <br /> 1. DateFormat df=new SimpleDateFormat("yyyy-MM-dd EE hh:mm:ss");    <br /> 2. System.out.println(df.format(new Date()));    <br /> 3. Date date = new Date();    <br /> 4. DateFormat shortDate=DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);    <br /> 5. DateFormat mediumDate =DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);    <br /> 6. DateFormat longDate =DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);    <br /> 7. DateFormat fullDate =DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);    <br /> 8.   <br /> 9. system.out.println(shortDate.format(date));    <br /> 10. System.out.println(mediumDate.format(date));    <br /> 11. System.out.println(longDate.format(date));    <br /> 12. System.out.println(fullDate.format(date));    <br /> 13.   <br /> 14. 08-4-15 下午3:24    <br /> 15. 2008-4-15 15:24:31    <br /> 16. 2008q??5?下午03?4?1U?nbsp;   <br /> 17. 2008q??5?星期?下午03?4?1UCST    <br /> 18.   <br /> 19.   <br /> 20. Calendar c = Calendar.getInstance();    <br /> 21.   <br /> 22. c.add(Calendar.MONTH, 1); // 目前時間?個月    <br /> 23. System.out.println(df.format(c.getTime()));    <br /> 24.   <br /> 25. c.add(Calendar.HOUR, 3); // 目前時間?時    <br /> 26. System.out.println(df.format(c.getTime()));    <br /> 27.   <br /> 28. c.add(Calendar.YEAR, -2); // 目前時間?q?nbsp;   <br /> 29. System.out.println(df.format(c.getTime()));    <br /> 30.   <br /> 31. c.add(Calendar.DAY_OF_WEEK, 7); // 目前的時間加7?nbsp;   <br /> 32. System.out.println(df.format(c.getTime())); <br /> <br /> </p><img src ="http://www.tkk7.com/kelly/aggbug/344755.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2011-02-21 12:15 <a href="http://www.tkk7.com/kelly/archive/2011/02/21/344755.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>java取星期几http://www.tkk7.com/kelly/archive/2009/05/31/279286.htmlkellykellySun, 31 May 2009 13:30:00 GMThttp://www.tkk7.com/kelly/archive/2009/05/31/279286.htmlhttp://www.tkk7.com/kelly/comments/279286.htmlhttp://www.tkk7.com/kelly/archive/2009/05/31/279286.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/279286.htmlhttp://www.tkk7.com/kelly/services/trackbacks/279286.html String dayNames[] = {"星期?,"星期一","星期?,"星期?,"星期?,"星期?,"星期?};
 SimpleDateFormat f =new SimpleDateFormat("yyyy-MM-dd");
 Date d=f.parse(today);
 Calendar cal = Calendar.getInstance(); 
 cal.setTime(d); 
 int day= cal.get(Calendar.DAY_OF_WEEK); 
 String week_day = dayNames[day - 1];



kelly 2009-05-31 21:30 发表评论
]]>
JAVA取年月日http://www.tkk7.com/kelly/archive/2009/05/31/279281.htmlkellykellySun, 31 May 2009 12:53:00 GMThttp://www.tkk7.com/kelly/archive/2009/05/31/279281.htmlhttp://www.tkk7.com/kelly/comments/279281.htmlhttp://www.tkk7.com/kelly/archive/2009/05/31/279281.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/279281.htmlhttp://www.tkk7.com/kelly/services/trackbacks/279281.htmlCalendar   calendar   =   Calendar.getInstance();

calendar.setTime(new   Date());  
                      String   year   =   String.valueOf(calendar.get(Calendar.YEAR));  
                      String   month   =   String.valueOf(calendar.get(Calendar.MONTH)+1);  
                      String   day   =   String.valueOf(calendar.get(Calendar.DATE));  
                      String   hour   =   String.valueOf(calendar.get(Calendar.HOUR));  
                      String   minute   =   String.valueOf(calendar.get(Calendar.MINUTE));  
                      String   second   =   String.valueOf(calendar.get(Calendar.SECOND));  
                      System.out.println(year+month+day+hour+minute+second);



kelly 2009-05-31 20:53 发表评论
]]>
JSP中文q解决Ҏ-Tomcat5.0?/title><link>http://www.tkk7.com/kelly/archive/2008/01/22/176905.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Tue, 22 Jan 2008 01:27:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2008/01/22/176905.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/176905.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2008/01/22/176905.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/176905.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/176905.html</trackback:ping><description><![CDATA[首先Q说说JSP/Servlet中的几个~码的作用? <div id="uamqcsi" class="art_txt"> <div> <div> <p style="text-indent: 2em">在JSP/Servlet中主要有以下几个地方可以讄~码QpageEncoding="UTF-8"、contentType="text/html;charset=UTF-8"、request.setCharacterEncoding("UTF-8")和response.setCharacterEncoding("UTF-8")Q其中前两个只能用于JSP中,而后两个可以用于JSP和Servlet中?/p> <p style="text-indent: 2em">1、pageEncoding="UTF-8"的作用是讄JSP~译成Servlet时用的~码?/p> <p style="text-indent: 2em">       众所周知QJSP在服务器上是要先被编译成Servlet的。pageEncoding="UTF-8"的作用就是告诉JSP~译器在JSP文g~译成Servlet时用的~码。通常Q在JSP内部定义的字W串Q直接在JSP中定义,而不是从览器提交的数据Q出Cؕ码时Q很多都是由于该参数讄错误引v的。例如,你的JSP文g是以GBK为编码保存的Q而在JSP中却指定pageEncoding="UTF-8"Q就会引起JSP内部定义的字W串Zؕ码?/p> <p style="text-indent: 2em">       另外Q该参数q有一个功能,是在JSP中不指定contentType参数Q也不用response.setCharacterEncodingҎӞ指定Ҏ务器响应q行重新~码的编码?/p> <p style="text-indent: 2em">       2、contentType="text/html;charset=UTF-8"的作用是指定Ҏ务器响应q行重新~码的编码?/p> <p style="text-indent: 2em">       在不使用response.setCharacterEncodingҎӞ用该参数指定Ҏ务器响应q行重新~码的编码。服务器在将数据发送到览器前Q对数据q行重新~码Ӟ使用的就是该~码?/p> <p style="text-indent: 2em">       3、request.setCharacterEncoding("UTF-8")的作用是讄对客Lhq行重新~码的编码?/p> <p style="text-indent: 2em">       该方法用来指定对览器发送来的数据进行重新编码(或者称码)Ӟ使用的编码?/p> <p style="text-indent: 2em">       4、response.setCharacterEncoding("UTF-8")的作用是指定Ҏ务器响应q行重新~码的编码?/p> <p style="text-indent: 2em">       服务器在数据发送到览器前Q对数据q行重新~码Ӟ使用的就是该~码?/p> <p style="text-indent: 2em">       其次Q要说一说浏览器是怎么样对接收和发送的数据q行~码?/p> <p style="text-indent: 2em">       response.setCharacterEncoding("UTF-8")的作用是指定Ҏ务器响应q行重新~码的编码。同Ӟ览器也是根据这个参数来对其接收到的数据q行重新~码Q或者称码)。所以在无论你在JSP中设|response.setCharacterEncoding("UTF-8")或者response.setCharacterEncoding("GBK")Q浏览器均能正确昄中文Q前提是你发送到览器的数据~码是正的Q比如正设|了pageEncoding参数{)。读者可以做个实验,在JSP中设|response.setCharacterEncoding("UTF-8")Q在IE中显C面Ӟ在IE的菜单中选择"查看(V)"à"~码(D)"中可以查看到? UnicodeQUTF-8Q?Q而在在JSP中设|response.setCharacterEncoding("GBK")Q在IE中显C面Ӟ在IE的菜单中选择"查看(V)"à"~码(D)"中可以查看到?体中文(GB2312Q??/p> <p style="text-indent: 2em">       览器在发送数据时Q对URL和参Cq行URL~码Q对参数中的中文Q浏览器也是使用response.setCharacterEncoding参数来进行URL~码的。以癑ֺ和GOOGLEZQ如果你在百度中搜烦"汉字"Q百度会其~码?%BA%BA%D7%D6"。而在GOOGLE中搜?汉字"QGOOGLE会将其编码ؓ"%E6%B1%89%E5%AD%97"Q这是因为百度的response.setCharacterEncoding参数为GBKQ而GOOGLE的的response.setCharacterEncoding参数为UTF-8?/p> <p style="text-indent: 2em">       览器在接收服务器数据和发送数据到服务器时所使用的编码是相同的,默认情况下均为JSP面的response.setCharacterEncoding参数Q或者contentType和pageEncoding参数Q,我们U其为浏览器~码。当Ӟ在IE中可以修Ҏ览器~码Q在IE的菜单中选择"查看(V)"à"~码(D)"中修改)Q但通常情况下,修改该参C使原本正的面中出Cؕ码。一个有的例子是,在IE中浏览GOOGLE的主|Q将览器编码修改ؓ"体中文(GB2312Q?Q此Ӟ面上的中文会变成ؕ码,不理它,在文本框中输?汉字"Q提交,GOOGLE会将其编码ؓ"%BA%BA%D7%D6"Q可见,览器在对中文进行URL~码Ӟ使用的就是浏览器~码?/p> <p style="text-indent: 2em">       弄清了浏览器是在接收和发送数据时Q是如何Ҏ据进行编码的了,我们再来看看服务器是在接收和发送数据时Q是如何Ҏ据进行编码的?/p> <p style="text-indent: 2em">       对于发送数据,服务器按照response.setCharacterEncoding—contentType—pageEncoding的优先顺序,对要发送的数据q行~码?/p> <p style="text-indent: 2em">       对于接收数据Q要分三U情c一U是览器直接用URL提交的数据,另外两种是用表单的GET和POST方式提交的数据?/p> <p style="text-indent: 2em">       因ؓ各种WEB服务器对q三U方式的处理也不相同Q所以我们以Tomcat5.0Z?/p> <p style="text-indent: 2em">       无论使用那种方式提交Q如果参C包含中文Q浏览器都会使用当前览器编码对其进行URL~码?/p> <p style="text-indent: 2em">       对于表单中POST方式提交的数据,只要在接收数据的JSP中正request.setCharacterEncoding参数Q即对客户端请求进行重新编码的~码讄成浏览器~码Q就可以保证得到的参数编码正。有写读者可能会问,那如何得到浏览器~码呢?上面我们提过了,在默认请情况下,览器编码就是你在响应该h的JSP面中response.setCharacterEncoding讄的倹{所以对于POST表单提交的数据,在获得数据的JSP面中request.setCharacterEncoding要和生成提交该表单的JSP面的response.setCharacterEncoding讄成相同的倹{?/p> <p style="text-indent: 2em">       对于URL提交的数据和表单中GET方式提交的数据,在接收数据的JSP中设|request.setCharacterEncoding参数是不行的Q因为在Tomcat5.0中,默认情况下用ISO-8859-1对URL提交的数据和表单中GET方式提交的数据进行重新编码(解码Q,而不使用该参数对URL提交的数据和表单中GET方式提交的数据进行重新编码(解码Q。要解决该问题,应该在Tomcat的配|文件的Connector标签中设|useBodyEncodingForURI或者URIEncoding属性,其中useBodyEncodingForURI参数表示是否用request.setCharacterEncoding参数对URL提交的数据和表单中GET方式提交的数据进行重新编码,在默认情况下Q该参数为falseQTomcat4.0中该参数默认为trueQ;URIEncoding参数指定Ҏ有GET方式hQ包括URL提交的数据和表单中GET方式提交的数据)q行l一的重新编码(解码Q的~码。URIEncoding和useBodyEncodingForURI区别是,URIEncoding是对所有GET方式的请求的数据q行l一的重新编码(解码Q,而useBodyEncodingForURI则是Ҏ响应该请求的面的request.setCharacterEncoding参数Ҏ据进行的重新~码Q解码)Q不同的面可以有不同的重新~码Q解码)的编码。所以对于URL提交的数据和表单中GET方式提交的数据,可以修改URIEncoding参数为浏览器~码或者修改useBodyEncodingForURI为trueQƈ且在获得数据的JSP面中request.setCharacterEncoding参数讄成浏览器~码?/p> <p style="text-indent: 2em">       下面ȝ下,以Tomcat5.0为WEB服务器时Q如何防止中文ؕ码?/p> <p style="text-indent: 2em">1?对于同一个应用,最好统一~码Q推荐ؓUTF-8Q当然GBK也可以?/p> <p style="text-indent: 2em">2?正确讄JSP的pageEncoding参数</p> <p style="text-indent: 2em">3?在所有的JSP/Servlet中设|contentType="text/html;charset=UTF-8"或response.setCharacterEncoding("UTF-8")Q从而间接实现对览器编码的讄?/p> <p style="text-indent: 2em">4?对于hQ可以用过滤器或者在每个JSP/Servlet中设|request.setCharacterEncoding("UTF-8")。同Ӟ要修改Tomcat的默认配|,推荐useBodyEncodingForURI参数讄为trueQ也可以URIEncoding参数讄为UTF-8Q有可能影响其他应用Q所以不推荐Q?/p> </div> </div> </div><img src ="http://www.tkk7.com/kelly/aggbug/176905.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2008-01-22 09:27 <a href="http://www.tkk7.com/kelly/archive/2008/01/22/176905.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MessageDigest对密码进行加?http://www.tkk7.com/kelly/archive/2008/01/04/172778.htmlkellykellyFri, 04 Jan 2008 08:26:00 GMThttp://www.tkk7.com/kelly/archive/2008/01/04/172778.htmlhttp://www.tkk7.com/kelly/comments/172778.htmlhttp://www.tkk7.com/kelly/archive/2008/01/04/172778.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/172778.htmlhttp://www.tkk7.com/kelly/services/trackbacks/172778.html今天到java.security.MessageDigestq个c;查看api解释为: ?MessageDigest cMؓ应用E序提供信息摘要法的功能,?MD5 ?SHA 法。信息摘要是安全的单向哈希函敎ͼ它接收Q意大的数据Q输出固定长度的哈希倹{?/font>
又baidu了一下,搜搜资料Q下面一个例子很不错Q就把它引用q来?完整如下 ^^V

<!------------------------

有时候,我们必须把用户密码存攑ֈ数据库,Z安全赯Q我们需要对q些密码q行单向的加密处理,
比如Q有明文密码如下Q?br /> String originalPwd = "mypassword";

应用报文摘要ҎQ得到单向的加密字符?

//MD5?6?SHA?0位(q是两种报文摘要的算法)
//MessageDigest md= MessageDigest.getInstance("MD5");
MessageDigest messageDigest=MessageDigest.getInstance("SHA-1");
messageDigest.update(originalPwd.getBytes());
//String digestedPwdString = new String(messageDigest.digest());
String digestedPwdString = new String(Base64.encode(messageDigest.digest()));
System.out.println("pwd:" + digestedPwdString);
q样Q就得到密码的报文摘要,把此摘要保存到数据库Q?br /> 以后用户登陆Ӟ用相同的法出摘要Q和数据库中的比较,如果一_则密码正?

注意Q?br /> byte[] digest = messageDigest.digest();
得到的是个二q制byte数组Q有可能某些byte是不可打印的字符?br /> 所以用Base64.encode把它转化成可打印字符?

也可以把digest的每个byte转化成hexQ?6q制Q保存?br /> MessageDigest messageDigest=MessageDigest.getInstance("SHA-1");
messageDigest.update(originalPwd.getBytes());
byte[] bin = messageDigest.digest()Q?br /> 再调用下面的Ҏ生hexQ?6q制Q保存?


二行制{hex字符串的Ҏ如下Q?br /> private static String byte2hex(byte[] b){
    String hs="";
    String stmp="";
    for (int n=0; n<b.length; n++){
        stmp=(java.lang.Integer.toHexString(b[n] & 0xFF));
        if (stmp.length()==1) hs=hs+"0"+stmp;
            else hs=hs+stmp;
    }
    return hs;
}

或者:
private static String byto2hex2(byte[] bin){
    StringBuffer buf = new StringBuffer();
    for (int i = 0; i < bin.length; ++i) {
        int x = bin[i] & 0xFF, h = x >>> 4, l = x & 0x0F;
        buf.append((char) (h + ((h < 10) ? '0' : 'a' - 10)));
        buf.append((char) (l + ((l < 10) ? '0' : 'a' - 10)));
    }
    return buf.toString();
}

或?
q脆直接用下面的Ҏ生成Q用到第三方包:
public static String encryptPwd(String pwd, String algorithm){
    //String a = org.apache.catalina.realm.RealmBase.Digest(pwd,"SHA-1");
    return org.apache.catalina.realm.RealmBase.Digest(pwd, algorithm);
}



kelly 2008-01-04 16:26 发表评论
]]>
关于Connector的URIEncoding属?/title><link>http://www.tkk7.com/kelly/archive/2007/12/03/164877.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Mon, 03 Dec 2007 06:53:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2007/12/03/164877.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/164877.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2007/12/03/164877.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/164877.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/164877.html</trackback:ping><description><![CDATA[<p>tomcat5中,因ؓ众所周知的原因,Z保证get/post数据都采用相同的UTF8~码Q我们在server.xml中进行了如下讄Q?/p> <p><connector port="8080" maxthreads="150" minsparethreads="25" br="" <="">maxSpareThreads="75" enableLookups="false" redirectPort="8443" <br /> acceptCount="100" debug="99" connectionTimeout="20000" <br /> disableUploadTimeout="true" URIEncoding="UTF-8"/></connector></p> <p>q里指定了get时候的数据~码。但是,当用IIS作ؓwebserver转发servlet/jsphlTomcat时候,q个讄却失效了。其实原因很单:IIS是通过AJP协议Q把h转发到Tomcat监听?009端口上的Q所以这里针?080的设|自然就无效了。正的Ҏ是进行下面的讄Q?</p> <p><connector port="8009" enablelookups="false" redirectport="8443" br="" <="">debug="0" protocol="AJP/1.3" URIEncoding="UTF-8"/></connector></p> <p>虽然是小问题Q却׃我几个小时才惛_?nbsp; </p><img src ="http://www.tkk7.com/kelly/aggbug/164877.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2007-12-03 14:53 <a href="http://www.tkk7.com/kelly/archive/2007/12/03/164877.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>解决中文qhttp://www.tkk7.com/kelly/archive/2007/12/03/164866.htmlkellykellyMon, 03 Dec 2007 06:40:00 GMThttp://www.tkk7.com/kelly/archive/2007/12/03/164866.htmlhttp://www.tkk7.com/kelly/comments/164866.htmlhttp://www.tkk7.com/kelly/archive/2007/12/03/164866.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/164866.htmlhttp://www.tkk7.com/kelly/services/trackbacks/164866.html一、请求结果的q:

  • POST提交:

   

解决办法Q在昄中文字符串前加上 request.setCharacterEncoding("gbk");

                 或?在获取字W串str后用str = new String(str.getBytes("ISO-8859-1"),"GB2312");转换

                 ISO-8859-1是默认的字符~码

  • GET提交:

   解决办法Q?/p>

1、项目已打包到web服务器:

  扑ֈ %TOMCAT_HOME%\conf\server.xml文gQ将此文件的代码D|֊              ?nbsp;URIEncoding="gbk"Q结果如下所C:

<Connector port="8080" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="gbk"/>

2、开发过E中Q?/p>

扑ֈ %project_name%\Tomcat\conf\server.xml文gQ删除文件中的备注,增加URIEncoding="gbk"Q结果如下所C:

<Connector acceptCount="10" connectionTimeout="60000" maxThreads="75" minSpareThreads="5" port="8080" URIEncoding="gbk"/>

二、处理响应结果的q..

1.在servlet?response.setContentType("text/html;charset=GB2312");

2.在jsp?<%@page contentType="text/html;charset=GB2312"%>

3.在html?<head><META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=GB2312"></head>



kelly 2007-12-03 14:40 发表评论
]]>
ajax参数q转换http://www.tkk7.com/kelly/archive/2007/09/20/146749.htmlkellykellyThu, 20 Sep 2007 04:22:00 GMThttp://www.tkk7.com/kelly/archive/2007/09/20/146749.htmlhttp://www.tkk7.com/kelly/comments/146749.htmlhttp://www.tkk7.com/kelly/archive/2007/09/20/146749.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/146749.htmlhttp://www.tkk7.com/kelly/services/trackbacks/146749.html


 一、提交中文是使用javascript的函敎ͼencodeURIComponent()q行~码Q?br />例如Q?br />String 

param=encodeURIComponet("param");
然后到服务器端用UTF-8~码提取参数Q?br /> request.setCharacterEncoding("UTF-8");
String str = request.getParameter("param");
然后使用下面的方式进行解码:
java.net.URLDecoder.decode(str,"UTF-8")
q样可以得到正的参数?br />



kelly 2007-09-20 12:22 发表评论
]]>
JSP中ؕ码解x?/title><link>http://www.tkk7.com/kelly/archive/2007/03/19/104742.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Mon, 19 Mar 2007 07:37:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2007/03/19/104742.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/104742.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2007/03/19/104742.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/104742.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/104742.html</trackback:ping><description><![CDATA[<p>在JSP的查询或者插入数据库的时候M遇到q的问题,下面l出两种解决ҎQ?br />1、在面中加?nbsp;  request.setCharacterEncoding("utf-8");<br />2、String name=new String(request.getparameters("name").getBytes("ISO8859_1"),"utf-8")</p><img src ="http://www.tkk7.com/kelly/aggbug/104742.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2007-03-19 15:37 <a href="http://www.tkk7.com/kelly/archive/2007/03/19/104742.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>重蝲Q重写,l承Q多?/title><link>http://www.tkk7.com/kelly/archive/2007/03/15/103940.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Thu, 15 Mar 2007 01:52:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2007/03/15/103940.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/103940.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2007/03/15/103940.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/103940.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/103940.html</trackback:ping><description><![CDATA[<p>1、重载是在一个类里一pd参数不同名字相同的方?<br />      Ҏ{֐由方法名U和一个参数列表(Ҏ的参数的序和类型)l成。只要签名不同,可以在一U类型内定义h相同名称的多U方法。当定义两种或多U具有相同名U的ҎӞq作重载?br />2、重写是l承后重新实现父cȝҎ.zcd可以重写l承的虚Ҏ<br />3、承是子类获得父类的成?br />4、多态则是父cM用子cȝҎ<br /><br />下面l出一个例子:<br />一个父c:test_father,一个子c:test_sub,来说明这几个概念的关p?br />test_fatherc?<br /><br />public class test_father {</p> <p> public  test_father() {<br />  System.out.println("father");//构造器<br /> }<br /> <br /> public void test_father() {<br />  System.out.println("father");//重蝲<br /> }<br /> public int test_father(int i) {<br />  System.out.println("fatherii"+i);<br />  return i;//重蝲<br /> }</p> <p>}<br /><br />test_subc:<br />public class test_sub extends test_father{//l承</p> <p> public test_sub() {<br />  System.out.println("test_sub");//构造器<br /> }<br /> <br /> public void test_father() {<br />  System.out.println("sub");//重写父类Ҏ<br /> }<br /> public int test_father(int i) {<br />  System.out.println("subii"+i);<br />  <br />  return i;<br /> }</p> <p> /**<br />  * @param args<br />  */<br /> public static void main(String[] args) {<br />  // TODO Auto-generated method stub<br />  test_father fa=new test_sub();//多?br />  fa.test_father();<br />  fa.test_father(3);<br /> }</p> <p>}<br /><br />输出l果Q?br />father<br />test_sub<br />sub<br />subii3<br /><br /><br /></p><img src ="http://www.tkk7.com/kelly/aggbug/103940.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2007-03-15 09:52 <a href="http://www.tkk7.com/kelly/archive/2007/03/15/103940.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在java中直接调用servletE序Q?/title><link>http://www.tkk7.com/kelly/archive/2007/01/31/96983.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Wed, 31 Jan 2007 07:21:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2007/01/31/96983.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/96983.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2007/01/31/96983.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/96983.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/96983.html</trackback:ping><description><![CDATA[<p>׃一些项目的需求,我需要把数据库操作都攑ֈ服务器端处理Q而页面则在本圎ͼ所以就用到 了远端调用的问题。ؓ了实现用本地jspq端调用数据库操作程序,我采用用jspq端调用servlet的方法,servletE序把处理完的结果以字符串的形式q回ljsp面。下面是实现q端调用的方法?br /></p> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /> <span style="color: #000000">URL url </span> <span style="color: #000000">=</span> <span style="color: #000000"> </span> <span style="color: #0000ff">new</span> <span style="color: #000000"> URL(</span> <span style="color: #000000">"</span> <span style="color: #000000">http://127.0.0.1:8080/KFC/servlet/TestServlet?firstName=111&middleName=222&birthday=333</span> <span style="color: #000000">"</span> <span style="color: #000000"> );<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />InputStream is </span> <span style="color: #000000">=</span> <span style="color: #000000"> url.openStream();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />BufferedReader br </span> <span style="color: #000000">=</span> <span style="color: #000000"> </span> <span style="color: #0000ff">new</span> <span style="color: #000000"> BufferedReader(</span> <span style="color: #0000ff">new</span> <span style="color: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />    InputStreamReader(is));<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />String aa </span> <span style="color: #000000">=</span> <span style="color: #000000"> </span> <span style="color: #000000">""</span> <span style="color: #000000">;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />String msgcontent </span> <span style="color: #000000">=</span> <span style="color: #000000"> </span> <span style="color: #000000">""</span> <span style="color: #000000">;<br /><img id="Codehighlighter1_296_320_Open_Image" onclick="this.style.display='none'; Codehighlighter1_296_320_Open_Text.style.display='none'; Codehighlighter1_296_320_Closed_Image.style.display='inline'; Codehighlighter1_296_320_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"><img id="Codehighlighter1_296_320_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_296_320_Closed_Text.style.display='none'; Codehighlighter1_296_320_Open_Image.style.display='inline'; Codehighlighter1_296_320_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top"></span> <span style="color: #0000ff">while</span> <span style="color: #000000"> ( (aa </span> <span style="color: #000000">=</span> <span style="color: #000000"> br.readLine()) </span> <span style="color: #000000">!=</span> <span style="color: #000000"> </span> <span style="color: #0000ff">null</span> <span style="color: #000000">) </span> <span id="Codehighlighter1_296_320_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"> <img src="http://www.tkk7.com/images/dot.gif" alt="" /> </span> <span id="Codehighlighter1_296_320_Open_Text"> <span style="color: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />    msgcontent </span> <span style="color: #000000">+=</span> <span style="color: #000000"> aa;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" />}</span> </span> <span style="color: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" />is.close(); </span> </div> <p>q段代码是jsp中调用的写法。在servlet面中可以用request.getparameter()的方法直接得Cq去的参敎ͼ然后调用servletE序中的doget()Ҏ。在doget()Ҏ中进行业务处理,然后把处理结果以字符串的形式q回。在servletE序中的输出方式是:<br /></p> <div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /> <span style="color: #000000"> PrintWriter out </span> <span style="color: #000000">=</span> <span style="color: #000000"> response.getWriter();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /> out.println(responseText);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /> out.flush();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /> out.close();</span> </div> <p> <br /> </p><img src ="http://www.tkk7.com/kelly/aggbug/96983.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2007-01-31 15:21 <a href="http://www.tkk7.com/kelly/archive/2007/01/31/96983.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用java实现打印功能http://www.tkk7.com/kelly/archive/2007/01/31/96973.htmlkellykellyWed, 31 Jan 2007 07:03:00 GMThttp://www.tkk7.com/kelly/archive/2007/01/31/96973.htmlhttp://www.tkk7.com/kelly/comments/96973.htmlhttp://www.tkk7.com/kelly/archive/2007/01/31/96973.html#Feedback13http://www.tkk7.com/kelly/comments/commentRss/96973.htmlhttp://www.tkk7.com/kelly/services/trackbacks/96973.html阅读全文

kelly 2007-01-31 15:03 发表评论
]]>
js自动跌{http://www.tkk7.com/kelly/archive/2006/12/21/89198.htmlkellykellyThu, 21 Dec 2006 01:44:00 GMThttp://www.tkk7.com/kelly/archive/2006/12/21/89198.htmlhttp://www.tkk7.com/kelly/comments/89198.htmlhttp://www.tkk7.com/kelly/archive/2006/12/21/89198.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/89198.htmlhttp://www.tkk7.com/kelly/services/trackbacks/89198.html     setTimeout("window.location.href='index.asp'",60000)
     </script>
参数说明Q第一个参数要跌{的页面,W二个参数的跌{的时_1000?S?img src ="http://www.tkk7.com/kelly/aggbug/89198.html" width = "1" height = "1" />

kelly 2006-12-21 09:44 发表评论
]]>
如何昄旉和星?/title><link>http://www.tkk7.com/kelly/archive/2006/12/18/88518.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Mon, 18 Dec 2006 05:45:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2006/12/18/88518.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/88518.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2006/12/18/88518.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/88518.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/88518.html</trackback:ping><description><![CDATA[<p>下面提供三种昄旉和星期的ҎQ?br />一、用js控制Q代码如下:<br /><html><br /><script language=JavaScript><br />today=new Date();<br />function initArray()<br />{<br />alert(initArray.arguments.length);<br />this.length=initArray.arguments.length;<br />for(var i=0;i<this.length;i++)<br />{<br />this[i+1]=initArray.arguments[i] ;<br />alert(this);<br />alert(this[i+1]);<br />}<br />}<br />var d=new initArray(<br />"星期?,<br />"星期一",<br />"星期?,<br />"星期?,<br />"星期?,<br />"星期?,<br />"星期?);<br />document.write(d);<br />document.write(today.getDay()+1);<br />document.write(<br />"<font color=#0000ff style='font-size:9pt;font-family: 宋体'> ",<br />today.getYear(),"q?,<br />today.getMonth()+1,"?,<br />today.getDate(),"?,<br />d[today.getDay()+1],<br />"</font>" ); <br /></script> <br /></html><br /><br />输出l果Q?font size="2"><font color="#0000ff"><font face="宋体">2006q?2?8日星期一 <script language="JavaScript"><![CDATA[ var day=""; var month=""; var ampm=""; var ampmhour=""; var myweekday=""; var year=""; mydate=new Date(); myweekday=mydate.getDay(); mymonth=mydate.getMonth()+1; myday= mydate.getDate(); myyear= mydate.getYear(); year=(myyear > 200) ? myyear : 1900 + myyear; if(myweekday == 0) weekday=" 星期?"; else if(myweekday == 1) weekday=" 星期一 "; else if(myweekday == 2) weekday=" 星期?"; else if(myweekday == 3) weekday=" 星期?"; else if(myweekday == 4) weekday=" 星期?"; else if(myweekday == 5) weekday=" 星期?"; else if(myweekday == 6) weekday=" 星期?"; document.write("<font color=#ff0000>北京旉 "+year+"q?+mymonth+"?+myday+"?"+weekday+"</font>); ]]></script></font></font></font><br /><br />二、用 js控制Q代码如下:<br /><br /><SCRIPT language=JavaScript><br />var day="";<br />var month="";<br />var ampm="";<br />var ampmhour="";<br />var myweekday="";<br />var year="";<br />mydate=new Date();<br />myweekday=mydate.getDay();<br />mymonth=mydate.getMonth()+1;<br />myday= mydate.getDate();<br />myyear= mydate.getYear();</p> <p>year=(myyear > 200) ? myyear : 1900 + myyear;<br />if(myweekday == 0)<br />weekday=" 星期?";<br />else if(myweekday == 1)<br />weekday=" 星期一 ";<br />else if(myweekday == 2)<br />weekday=" 星期?";<br />else if(myweekday == 3)<br />weekday=" 星期?";<br />else if(myweekday == 4)<br />weekday=" 星期?";<br />else if(myweekday == 5)<br />weekday=" 星期?";<br />else if(myweekday == 6)<br />weekday=" 星期?";<br />document.write("<font color=#ff0000>北京旉 "+year+"q?+mymonth+"?+myday+"?"+weekday+"</font>");<br /></SCRIPT><br /><br />输出l果Q?br /><font color="#ff0000">北京旉 2006q?2?8?星期一<br /><br /><font color="#000000">三、用ASP代码写日?br /></font><br /></font><font color="#000000"><%<br />Response.write FormatDateTime(Date, 1)</font></p> <p> <font color="#000000">MyWeekDay= Weekday(date) <br />If MyWeekDay=1 Then <br /> MyWeekDay_result=" 星期?"<br />ElseIf MyWeekDay=2 Then <br /> MyWeekDay_result=" 星期一 "<br />ElseIf MyWeekDay=3 Then <br /> MyWeekDay_result=" 星期?"<br />ElseIf MyWeekDay=4 Then <br /> MyWeekDay_result=" 星期?"<br />ElseIf MyWeekDay=5 Then <br /> MyWeekDay_result=" 星期?"<br />ElseIf MyWeekDay=6 Then <br /> MyWeekDay_result=" 星期?"<br />ElseIf MyWeekDay=7 Then <br /> MyWeekDay_result=" 星期?"<br />End If </font> </p> <p> <font color="#000000">Response.write MyWeekDay_result</font> </p> <p> <font color="#ff0000"> <font color="#000000">%><br /></font> <br />输出l果Q?font color="#000000">2006q?2?8?星期一 </font><br /><br /><br /></font> <br /> <br /> <br /> <br /> </p><img src ="http://www.tkk7.com/kelly/aggbug/88518.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2006-12-18 13:45 <a href="http://www.tkk7.com/kelly/archive/2006/12/18/88518.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA中日期格式化http://www.tkk7.com/kelly/archive/2006/12/18/88497.htmlkellykellyMon, 18 Dec 2006 05:15:00 GMThttp://www.tkk7.com/kelly/archive/2006/12/18/88497.htmlhttp://www.tkk7.com/kelly/comments/88497.htmlhttp://www.tkk7.com/kelly/archive/2006/12/18/88497.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/88497.htmlhttp://www.tkk7.com/kelly/services/trackbacks/88497.html旉格式?
一、JAVA中日期的获取、设|和格式?br />1QJAVA提供?个日期类QDate、Calendar和DateFormat?br />Date()Ҏ主要用于创徏日期对象q获取日期;
Calendar()Ҏ主要用于获取和设|日期;
DateFormat()Ҏ主要用于创徏日期格式化器Q然后再由格式化器将日期转换为各U日期格式串输出?br />2QJAVA语言规定的基准日期ؓ格林治标准旉1970.1.1.00:00:00Q当前日期是由基准日期开始所l历的毫U数转换出来的?br />3QDateFomatcdjava.text包中QDate和Calendarcdjava.util包中?br />4Q实例如下:
import java.util.*;
import java.text.*;

public class DisplayDate {
public static void main(String[] args){
Date today;
Calendar now;
DateFormat f1,f2;
String s1,s2;

System.out.println("\n昄Datecȝ相关用法");

today = new Date();
System.out.println("new Date()= \t"+ today);

System.out.println("\n用DateFormatcLC各U日期格?);

//昄各种日期格式
f1 = DateFormat.getDateInstance();
s1 = f1.format(today);
System.out.println("DateFormat.getDateInstance()= \t"+s1);

f1 = DateFormat.getDateInstance(DateFormat.LONG,Locale.CHINA);
s1 = f1.format(today);
System.out.println("DateFormat.getDateInstance(DateFormat.LONG,Locale.CHINA)= \t"+ s1);

f1 = DateFormat.getDateInstance(DateFormat.MEDIUM,Locale.CHINA);
s1 = f1.format(today);
System.out.println("DateFormat.getDateInstance(DateFormat.MEDIUM,Locale.CHINA)= \t"+ s1);

f1 = DateFormat.getDateInstance(DateFormat.SHORT,Locale.CHINA);
s1 = f1.format(today);
System.out.println("DateFormat.getDateInstance(DateFormat.SHORT,Locale.CHINA)= \t" + s1);

System.out.println("\n用DateFormatcLC各U时间格?);

//昄各种旉格式
f1 = DateFormat.getTimeInstance();
s1 = f1.format(today);
System.out.println("DateFormat.getTimeInstance()= \t"+s1);

f1 = DateFormat.getTimeInstance(DateFormat.LONG,Locale.CHINA);
s1 = f1.format(today);
System.out.println("DateFormat.getTimeInstance(DateFormat.LONG,Locale.CHINA)= \t"+s1);

f1 = DateFormat.getTimeInstance(DateFormat.MEDIUM,Locale.CHINA);
s1 = f1.format(today);
System.out.println("DateFormat.getTimeInstance(DateFormat.MEDIUM,Locale.CHINA)= \t"+s1);

f1 = DateFormat.getTimeInstance(DateFormat.SHORT,Locale.CHINA);
s1 = f1.format(today);
System.out.println("DateFormat.getTimeInstance(DateFormat.SHORT,Locale.CHINA)= \t"+s1);

System.out.println("\n昄Calendar的相x间用?);

now = Calendar.getInstance();
today = now.getTime();
System.out.println("Calendar.getInstance().getTime()= \t"+ today.toString());

}
}

E序q行l果昄如下Q?/p>

昄Datecȝ相关用法
new Date()= Fri May 02 13:29:32 CST 2003

用DateFormatcLC各U日期格?br />DateFormat.getDateInstance()= 2003-5-2
DateFormat.getDateInstance(DateFormat.LONG,Locale.CHINA)= 2003q???br />DateFormat.getDateInstance(DateFormat.MEDIUM,Locale.CHINA)= 2003-5-2
DateFormat.getDateInstance(DateFormat.SHORT,Locale.CHINA)= 03-5-2

用DateFormatcLC各U时间格?br />DateFormat.getTimeInstance()= 13:29:32
DateFormat.getTimeInstance(DateFormat.LONG,Locale.CHINA)= 下午01?9?2U?br />DateFormat.getTimeInstance(DateFormat.MEDIUM,Locale.CHINA)= 13:29:32
DateFormat.getTimeInstance(DateFormat.SHORT,Locale.CHINA)= 下午1:29

昄Calendar的相x间用?br />Calendar.getInstance().getTime()= Fri May 02 13:29:33 CST 2003



kelly 2006-12-18 13:15 发表评论
]]>
java中日期的应用Q?Q?/title><link>http://www.tkk7.com/kelly/archive/2006/12/07/86079.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Thu, 07 Dec 2006 05:51:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2006/12/07/86079.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/86079.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2006/12/07/86079.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/86079.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/86079.html</trackback:ping><description><![CDATA[1、文本框中输入的日期串{换成YYYY-MM-DD的Ş?br /><br />׃formatQ)中的参数必须是日期型的,所以要先把Stringcd转换成Datecd?br /><br />代码如下Q?br />String sz_date="2006-3-6";<br />java.util.Date birthday = new java.util.Date();<br /> java.text.SimpleDateFormat sdf=new java.text.SimpleDateFormat("yyyy-MM-dd");<br /> birthday = sdf.parse(sz_date);//把字W串cd转换成日期类?br />String date = sdf.format(birthday );//把日期格式化<br />输入l果Q?006-03-06<br />下面l出一个完成的例子<br /><div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; word-break: break-all; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee"><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><span style="color: #0000ff">package</span><span style="color: #000000"> net.yeah.glchengang;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.text.SimpleDateFormat;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> java.util.Date;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span><span style="color: #0000ff">import</span><span style="color: #000000"> com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /><br /><img id="Codehighlighter1_190_1121_Open_Image" onclick="this.style.display='none'; Codehighlighter1_190_1121_Open_Text.style.display='none'; Codehighlighter1_190_1121_Closed_Image.style.display='inline'; Codehighlighter1_190_1121_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top"><img id="Codehighlighter1_190_1121_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_190_1121_Closed_Text.style.display='none'; Codehighlighter1_190_1121_Open_Image.style.display='inline'; Codehighlighter1_190_1121_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top"></span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">class</span><span style="color: #000000"> ExampleDate </span><span id="Codehighlighter1_190_1121_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" alt="" /></span><span id="Codehighlighter1_190_1121_Open_Text"><span style="color: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /><img id="Codehighlighter1_194_255_Open_Image" onclick="this.style.display='none'; Codehighlighter1_194_255_Open_Text.style.display='none'; Codehighlighter1_194_255_Closed_Image.style.display='inline'; Codehighlighter1_194_255_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_194_255_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_194_255_Closed_Text.style.display='none'; Codehighlighter1_194_255_Open_Image.style.display='inline'; Codehighlighter1_194_255_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top">    </span><span id="Codehighlighter1_194_255_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">/** */</span><span id="Codehighlighter1_194_255_Open_Text"><span style="color: #008000">/**</span><span style="color: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />     * </span><span style="color: #808080">@param</span><span style="color: #008000"> args<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />     * </span><span style="color: #808080">@throws</span><span style="color: #008000"> java.text.ParseException <br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />     </span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /><img id="Codehighlighter1_329_636_Open_Image" onclick="this.style.display='none'; Codehighlighter1_329_636_Open_Text.style.display='none'; Codehighlighter1_329_636_Closed_Image.style.display='inline'; Codehighlighter1_329_636_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_329_636_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_329_636_Closed_Text.style.display='none'; Codehighlighter1_329_636_Open_Image.style.display='inline'; Codehighlighter1_329_636_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top">    </span><span style="color: #0000ff">public</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> </span><span style="color: #0000ff">void</span><span style="color: #000000"> main(String[] args) </span><span style="color: #0000ff">throws</span><span style="color: #000000"> java.text.ParseException </span><span id="Codehighlighter1_329_636_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" alt="" /></span><span id="Codehighlighter1_329_636_Open_Text"><span style="color: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />    </span><span style="color: #008000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /></span><span style="color: #000000">        <br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        Date mydate</span><span style="color: #000000">=</span><span style="color: #000000">getDate(</span><span style="color: #000000">"</span><span style="color: #000000">2006-3-6</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        <br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        SimpleDateFormat formatter </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> SimpleDateFormat(</span><span style="color: #000000">"</span><span style="color: #000000">yyyy-MM-dd </span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        String date </span><span style="color: #000000">=</span><span style="color: #000000"> formatter.format(mydate);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        <br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        System.out.print(date);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />    }</span></span><span style="color: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />    </span><span style="color: #0000ff">private</span><span style="color: #000000"> </span><span style="color: #0000ff">static</span><span style="color: #000000"> Date getDate(String sz_date) </span><span style="color: #0000ff">throws</span><span style="color: #000000"> java.text.ParseException<br /><img id="Codehighlighter1_716_1118_Open_Image" onclick="this.style.display='none'; Codehighlighter1_716_1118_Open_Text.style.display='none'; Codehighlighter1_716_1118_Closed_Image.style.display='inline'; Codehighlighter1_716_1118_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_716_1118_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_716_1118_Closed_Text.style.display='none'; Codehighlighter1_716_1118_Open_Image.style.display='inline'; Codehighlighter1_716_1118_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top">    </span><span id="Codehighlighter1_716_1118_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" alt="" /></span><span id="Codehighlighter1_716_1118_Open_Text"><span style="color: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />        java.util.Date birthday </span><span style="color: #000000">=</span><span style="color: #000000"> </span><span style="color: #0000ff">new</span><span style="color: #000000"> java.util.Date();<br /><img id="Codehighlighter1_774_929_Open_Image" onclick="this.style.display='none'; Codehighlighter1_774_929_Open_Text.style.display='none'; Codehighlighter1_774_929_Closed_Image.style.display='inline'; Codehighlighter1_774_929_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_774_929_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_774_929_Closed_Text.style.display='none'; Codehighlighter1_774_929_Open_Image.style.display='inline'; Codehighlighter1_774_929_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top">        </span><span style="color: #0000ff">try</span><span style="color: #000000"> </span><span id="Codehighlighter1_774_929_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" alt="" /></span><span id="Codehighlighter1_774_929_Open_Text"><span style="color: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />               java.text.SimpleDateFormat sdf</span><span style="color: #000000">=</span><span style="color: #0000ff">new</span><span style="color: #000000"> java.text.SimpleDateFormat(</span><span style="color: #000000">"</span><span style="color: #000000">yyyy-MM-dd</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />               birthday </span><span style="color: #000000">=</span><span style="color: #000000"> sdf.parse(sz_date);<br /><img id="Codehighlighter1_956_1040_Open_Image" onclick="this.style.display='none'; Codehighlighter1_956_1040_Open_Text.style.display='none'; Codehighlighter1_956_1040_Closed_Image.style.display='inline'; Codehighlighter1_956_1040_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top"><img id="Codehighlighter1_956_1040_Closed_Image" style="display: none" onclick="this.style.display='none'; Codehighlighter1_956_1040_Closed_Text.style.display='none'; Codehighlighter1_956_1040_Open_Image.style.display='inline'; Codehighlighter1_956_1040_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top">               }</span></span><span style="color: #000000"> </span><span style="color: #0000ff">catch</span><span style="color: #000000"> (ParseException e) </span><span id="Codehighlighter1_956_1040_Closed_Text" style="border-right: #808080 1px solid; border-top: #808080 1px solid; display: none; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff"><img src="http://www.tkk7.com/images/dot.gif" alt="" /></span><span id="Codehighlighter1_956_1040_Open_Text"><span style="color: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />                       System.out.println(</span><span style="color: #000000">"</span><span style="color: #000000">String to Date error</span><span style="color: #000000">"</span><span style="color: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />               }</span></span><span style="color: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />               System.out.print(birthday);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" />               </span><span style="color: #0000ff">return</span><span style="color: #000000"> birthday;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" alt="" />    }</span></span><span style="color: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" alt="" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" alt="" />}</span></span><span style="color: #000000"><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" alt="" /></span></div><img src ="http://www.tkk7.com/kelly/aggbug/86079.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2006-12-07 13:51 <a href="http://www.tkk7.com/kelly/archive/2006/12/07/86079.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ASP中日期应?/title><link>http://www.tkk7.com/kelly/archive/2006/12/07/86062.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Thu, 07 Dec 2006 04:10:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2006/12/07/86062.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/86062.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2006/12/07/86062.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/86062.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/86062.html</trackback:ping><description><![CDATA[1、取当前旉 Response.write Now&Chr(13) l果输出Q?006-12-7 11:59:31 <br />2、DateAdd的用?Response.write DateAdd("d",1,date)&Chr(13) l果输出Q?006-12-8 <br />说明Q?<br />yyyy q?<br />q 季度 <br />m ?<br />y 一q的日数 <br />d ?<br />w 一周的日数 <br />ww ?h 时 <br />n 分钟 <br />s U?<br />3、format日期 Response.write FormatDateTime(now,2)&Chr(13) l果输出Q?006-12-8 <br />说明Q?<br />vbGeneralDate 0 <br />昄日期?或时间。如果有日期部分Q则该部分昄为短日期格式。如果有旉部分Q则该部分昄为长旉格式。如果都存在Q则昄所有部分?<br />vbLongDate 1 使用计算机区域设|中指定的长日期格式昄日期?<br />vbShortDate 2 使用计算机区域设|中指定的短日期格式昄日期?<br />vbLongTime 3 使用计算机区域设|中指定的时间格式显C时间?<br />vbShortTime 4 使用 24 时格式 (hh:mm) 昄旉?img src ="http://www.tkk7.com/kelly/aggbug/86062.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2006-12-07 12:10 <a href="http://www.tkk7.com/kelly/archive/2006/12/07/86062.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>数字验证代码http://www.tkk7.com/kelly/archive/2006/11/24/83230.htmlkellykellyFri, 24 Nov 2006 05:22:00 GMThttp://www.tkk7.com/kelly/archive/2006/11/24/83230.htmlhttp://www.tkk7.com/kelly/comments/83230.htmlhttp://www.tkk7.com/kelly/archive/2006/11/24/83230.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/83230.htmlhttp://www.tkk7.com/kelly/services/trackbacks/83230.html<body>
<form name=form1>
<input   name="textfield2"   type="text"       onKeyUp="value=value.replace(/[^\d]/g,'');"   onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
</form>
</body>
</html>
代码说明Q?br />onKeyUp是键盘弹起事件?br />

kelly 2006-11-24 13:22 发表评论
]]>
实现视频全屏播放代码http://www.tkk7.com/kelly/archive/2006/11/24/83173.htmlkellykellyFri, 24 Nov 2006 01:23:00 GMThttp://www.tkk7.com/kelly/archive/2006/11/24/83173.htmlhttp://www.tkk7.com/kelly/comments/83173.htmlhttp://www.tkk7.com/kelly/archive/2006/11/24/83173.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/83173.htmlhttp://www.tkk7.com/kelly/services/trackbacks/83173.html<html>
<head>
<script language=javascript>
Real='document.NSPlay.';
function DoFull()
{
//alert("ddd");
eval(Real+'DisplaySize=3');
}
</script>
</head>
<body>

<object classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95
            codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701
            height=180 id=NSPlay type=application/x-oleobject width=240
            VIEWASTEXT standby="加蝲 Microsoft Windows Media Player lg...">
        <param name="FileName" value="        <param name="AutoStart" value="true"><!--是否自动播放-->
        <param name="AutoRewind" value="-1">
        <param name="AnimationAtStart" value="false">
        <param name="ShowControls" value="false"><!--是否昄控制,比如播放,停止,暂停-->
        <param name="ClickToPlay" value="false">
        <param name="EnableContextMenu" value="true"> <!--是否用右键弹单控?->
        <param name="EnablePositionControls" value="false">
        <param name="Balance" value="0">
        <param name="ShowStatusBar" value="false"><!--当前播放信息,昄是否正在播放,及L放时间和当前播放到的旉-->
        <param name="AutoSize" value="0">   <!--是否自动调整播放大小-->
  <param name="PlayCount" value="0"><!--播放ơ数Q?为@环播?->
        <embed
            type="application/x-mplayer2"
            pluginspage="
            filename src  autostart="false"
   enablecontextmenu="false"
   clicktoplay="false"  
   enablepositioncontrols="false"               
            showcontrols="0" showstatusbar="1"               
            showdisplay="0"                width="240" height="180">
        </embed>
      </object>

    <input type="button" onMouseDown="DoFull()" value="全屏昄" style="border-style: ridge; border-width: 1">

   </body>
   </html>
   <script language=javascript>
  setTimeout("DoFull()",1000)
  </script>



kelly 2006-11-24 09:23 发表评论
]]>
实现IE全屏昄http://www.tkk7.com/kelly/archive/2006/11/24/83171.htmlkellykellyFri, 24 Nov 2006 01:21:00 GMThttp://www.tkk7.com/kelly/archive/2006/11/24/83171.htmlhttp://www.tkk7.com/kelly/comments/83171.htmlhttp://www.tkk7.com/kelly/archive/2006/11/24/83171.html#Feedback0http://www.tkk7.com/kelly/comments/commentRss/83171.htmlhttp://www.tkk7.com/kelly/services/trackbacks/83171.html
<SCRIPT LANGUAGE="javascript">
<!-- Begin
if (this.name!='fullscreen'){
  window.open(location.href,'fullscreen','fullscreen,scrollbars')
}
//  End -->
</script>


下面q句话可以不要?/p>

<a href="javascript:window.close(self)">q回正常效果昄</a>



kelly 2006-11-24 09:21 发表评论
]]>
如何配置TOMCAT,以及TOMCAT和IIS的配|?/title><link>http://www.tkk7.com/kelly/archive/2005/08/22/10707.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Mon, 22 Aug 2005 09:22:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2005/08/22/10707.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/10707.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2005/08/22/10707.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/10707.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/10707.html</trackback:ping><description><![CDATA[<font size="2">2、下面接着说一下TOMCAT和IIS的配|?br />把TOMCAT和IIS配置在一P可以扩展IIS的功能,让它也可以运行java webE序?br /><br />JK插gQisapi_redirect-<!--?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /--><st1:chsdate w:st="on" year="1899" month="12" day="30" islunardate="False" isrocdate="False">1.2.9</st1:chsdate>.dll Q可以去<span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><a ><font face="宋体, MS Song">http://archive.apache.org/dist/jakarta/tomcat-connectors/jk/binaries/win32/jk-1.2.9/isapi_redirect-1.2.9.dll</font></a>下蝲?br /><br /><font size="2">q程Q?br />Q?Q、将isapi_redirect-<st1:chsdate w:st="on" year="1899" month="12" day="30" islunardate="False" isrocdate="False">1.2.9</st1:chsdate>.dll COPY到D:\profiles\Tomcat 5.0\bin下?br /></font>Q?Q、在<font size="2">D:\profiles\Tomcat 5.0\conf下创建如下的workers.properties文gQ?/font><font face="宋体"><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">workers.tomcat_home=<font size="2">D:\profiles\Tomcat 5.0</font>  #</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">mod_jk</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">模块知道</span></font><font face="宋体"><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">TOMCAT<br />workers.java_home=D:\profiles\JDK-1_4_2   #</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">mod_jk</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">模块知道</span></font><font face="宋体"><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">JDK<br />ps=\                                 #</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">指定文g路径分隔W?/span></font><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥"><br /><font face="宋体">worker.list=worker1<br />worker.worker1.port=8009             #</font></span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥"><font face="宋体">工作端口</font></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥"><br /><font face="宋体">worker.worker1.host=localhost        #TOMCAt</font></span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥"><font face="宋体">服务器地址Q?font color="#000080">某JSP|站的ip地址</font>Q?/font></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥"><br /><font face="宋体">worker.worker1.type=ajp13            #</font></span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥"><font face="宋体">cd</font></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥"><br /><font face="宋体">worker.worker1.lbfactor=1            #</font></span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥"><font face="宋体">负蝲q因数<br /><br />Q?Q、在<font size="2">D:\profiles\Tomcat 5.0\conf下创建如下的uriworkermap.properties文gQ?br /><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">/*.jsp=worker1<br />/testd/*=worker1   //</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">对应自己?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">TOMCAT </span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">应用<br /><br />Q?Q?span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">修改注册?/span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">:</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">创徏</span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi<span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">Redirector\1.0</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">?/span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">;</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">?/span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">1.0</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">下建立如下字符?/span></font><font face="宋体, MS Song"><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">:<br /><br /></span></font></span></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">extension_uri    /jakarta/isapi_redirect-<st1:chsdate w:st="on" year="1899" month="12" day="30" islunardate="False" isrocdate="False">1.2.9</st1:chsdate>.dll     jakarta</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">IIS</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">下的虚拟目录<br /></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">log_file         <font size="2">D:\profiles\Tomcat 5.0\</font>logs\isapi.log          </span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">指定</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">JK</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">插g使用的日志文?br /></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">log_level         debug                            </span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">指定日志U别<br /></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">worker_file      <font size="2">D:\profiles\Tomcat 5.0\</font>conf\workers.properties    </span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">指定</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">JK</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">插g的工作文?br /></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">worker_mount_file   <font size="2">D:\profiles\Tomcat 5.0\</font>conf\uriworkermap.properties   </span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">指定</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">JK</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">插g?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">URL</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">映射<br /></span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥"><!--?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /--><o:p></o:p></span><br />Q?Q?span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">?/span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">IIS</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">中创拟目录(或在某jsp站点中创建)</span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">,</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">名ؓ</span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">"jakarta",</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">路径?/span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">isapi_redirect-<st1:chsdate w:st="on" year="1899" month="12" day="30" islunardate="False" isrocdate="False">1.2.9</st1:chsdate>.dll</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">所在的路径</span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">,</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">修改</span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">jakarta</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">虚拟目录?/span></font></font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">属?/span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">.</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">其执行权限改ؓ</span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">"</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">脚本和可执行E序</span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">"Q(<font color="#000080">IP地址最好ؓ全部未分配,然后可以有主机头?/font>Q?br /></font></span><br />Q?Q?font face="宋体"><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">JK</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">插g加入</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">IIS</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">的筛选中?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">..</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">在默认网站上右键</span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">----></span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">属?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">---->ISAPI</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">{选里d一个名?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">"jakarta"</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">的筛?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">,</span><span style="font-size: 9.5pt; line-height: 160%; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥">文g?/span><span lang="EN-US" style="font-size: 9.5pt; line-height: 160%; font-family: ˎ̥">isapi_redirect-<st1:chsdate w:st="on" year="1899" month="12" day="30" islunardate="False" isrocdate="False">1.2.9</st1:chsdate>.dll.<br /><o:p></o:p></span></font><br />Q?Q、重启IIS和TOMCAT,<span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">查看下刚才加入的{选是否有一个绿色向上的头</span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">,</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">如果?/span><span lang="EN-US" style="font-size: 9.5pt; font-family: ˎ̥; mso-fareast-font-family: 宋体; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><font face="宋体, MS Song">,</font></span><span style="font-size: 9.5pt; font-family: 宋体; mso-ascii-font-family: ˎ̥; mso-hansi-font-family: ˎ̥; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">那就说明配置成功了一半了.打开IE,在地址栏中输入HTTPQ?/localhost/index.jsp,(localhost<strong>或ؓL头名</strong>)Q将会看到首c如果TOMCAT中已l有了某个测试项目,q可以用某测试项目来讉K?/span><br /></span><br /></font><img src ="http://www.tkk7.com/kelly/aggbug/10707.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2005-08-22 17:22 <a href="http://www.tkk7.com/kelly/archive/2005/08/22/10707.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何配置TomcatQ以及Tomcat和IIS的配|?/title><link>http://www.tkk7.com/kelly/archive/2005/08/22/10702.html</link><dc:creator>kelly</dc:creator><author>kelly</author><pubDate>Mon, 22 Aug 2005 08:43:00 GMT</pubDate><guid>http://www.tkk7.com/kelly/archive/2005/08/22/10702.html</guid><wfw:comment>http://www.tkk7.com/kelly/comments/10702.html</wfw:comment><comments>http://www.tkk7.com/kelly/archive/2005/08/22/10702.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/kelly/comments/commentRss/10702.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/kelly/services/trackbacks/10702.html</trackback:ping><description><![CDATA[<p><font size="2">1、首先要先下载JDK和TomcatQ我使用的版本是JDK_1_4_2_08和Tomcat5.0.16.下蝲|址误q上搜?br />下面先安装JDK,然后再安装Tomcat。安装完成以后就要添加环境变量了?br />叛_我的电脑Q?gt;属性->高Q?gt;环境变量Q在pȝ变量中新建或~辑环境变量<br /><br />需要添加的环境变量如下Q?br />Q?Q、JAVA_HOME(JDKq行使用QJDK是java开发工具包Q它是javaE序的运行环?<br />   JAVA_HOME=D:\profiles\JDK-1_4_2(JDK的安装\?<br /><br />Q?Q、TOMCAT_HOME<br />   TOMCAT_HOME=D:\TOMCAT5.0QTOMCAT的安装\径)<br /><br />Q?Q、ClassPathQ类路径Q?br />   CLASSPATH=D:\profiles\JDK-1_4_2\lib\tools.jar;D:\profiles\JDK-1_4_2\lib\dt.jar;<br />   (dt.jar是关于运行环境的cdQtools.jar是关于一些工Lcd)<br /><br />(4)、PATH(用于可以执行一些java命oQ如javac?<br />PATH=D:\profiles\JDK-1_4_2\bin<br /><br />q样TOMCAT配|完成了。启动TOMCAT,在IE地址栏中输入<a href="http://localhost:8080">http://localhost:8080</a>,可以看到TOMCAT首页面,q就表示TOMCAT配置成功了?br /><br /><br /><br /><br /><br /><br /><br /></font></p><img src ="http://www.tkk7.com/kelly/aggbug/10702.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/kelly/" target="_blank">kelly</a> 2005-08-22 16:43 <a href="http://www.tkk7.com/kelly/archive/2005/08/22/10702.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在Eclipse中用JUnitq行单元试http://www.tkk7.com/kelly/archive/2005/06/03/5532.htmlkellykellyFri, 03 Jun 2005 07:53:00 GMThttp://www.tkk7.com/kelly/archive/2005/06/03/5532.htmlhttp://www.tkk7.com/kelly/comments/5532.htmlhttp://www.tkk7.com/kelly/archive/2005/06/03/5532.html#Feedback1http://www.tkk7.com/kelly/comments/commentRss/5532.htmlhttp://www.tkk7.com/kelly/services/trackbacks/5532.html       
junit?/span>java中书?/span>unit test?/span>frameworkQ目前一些流行的unit test工具大都都是?/span>junit上扩展而来的。目前它的版本是junit3.8.1Q可以从www.junit.org上下载?br />          StrtusTest?/span>junit的扩?/span>当前的版本是StrutsTest2.1.0Q在q个版本中不支持Struts1.0。如果需要测?/span>struts1.0的应用程序,对应的版本是StrutsTest2.0。可以从http://sourceforge.net/projects/strutstestcase/下蝲?br />    下面介绍一下它的用。直接把解压的下载文件保存到目的classpath中,然后再引入这两个jar文gQ就可以使用了?br />    叛_目中Q何一个文件夹Q选择news的othersQ这时就会出现Junit的文件夹Q展开文g多w择JUnit Test Case Q点M一步,在Name中填写测试程序的名字Q一般名字必MTestl尾。然后构选setup()和teardown()选项Q选择需要测试的ActionQ点M一步,选择需要测试的ҎQ点击Finish卛_自动生成试文g。测试文件中自动生成了setup()和teardown()ҎQ用来在试Ҏ执行前初始化试环境和在执行后撤销试环境。测试方法都是以test开头的Q如(testDoExecute()).
     下面在测试方法中可以填写自己需要的东西了。如下面的例子:
package com.ezcross.SMS.common.struts.action;

import servletunit.struts.MockStrutsTestCase;

/**
 * @author paul.ping(wp.huang@ezcross.com)
 *
 * cdQSMS10Test
 * 操作Q?br /> 
*/

public class LoginActionTest extends MockStrutsTestCase {
    
/*
     * @see TestCase#setUp()
     
*/

    
protected void setUp() throws Exception {
        super.setUp();
    }


    
/*
     * @see TestCase#tearDown()
     
*/

    
protected void tearDown() throws Exception {
        super.tearDown();
    }


    
public void testDoExecute() {
        
try

        
{
            addRequestParameter(
"user_name","cka"
);
            addRequestParameter(
"passward","111111"
);
            setRequestPathInfo(
"/login"
);
            System.
out.println("hava completed adding data"
);
            actionPerform();
            System.
out.println("begin verify"
);
            verifyForward(
"dologin"
);
            verifyForwardPath(
"/Login.jsp"
);
            verifyNoActionErrors();
            System.
out.println("end verify"
);
            
            
//assertNotNull(testObject.doExecute(null,null,null,null,null));

        }

        
catch (Exception ee)
        
{
            System.
out
.println(ee.toString());
        }

    }


}

填写完程序后Q右ȝ序,选择run下的JUnit Testq行q行Q如果没有错误的话则昄l色 Q否则显C红艌Ӏ?br />
对程序的说明Q?br />主要函数和作用:

-          setContextDirectoryQ设|?/span>web应用的根

-          setRequestPathInfoQ设|?/span>request的请?/span>

-          addRequestParameterQ将参数和对应的值加?/span>request?/span>

-          actionPerformQ执行这个请?/span>

-          verifyForwardQ验?/span>forward的名字是否正?/span>

-          verifyForwardPathQ验?/span>forward?/span>path是否正确

-          verifyNoActionErrorsQ验证在action执行q程中没?/span>ActionError产生

-          verifyActionErrorsQ验证在action执行q程中生的ActionError集合的内?/span>

具体详细的内容请参见对应?/span>javaDoc?/span>





kelly 2005-06-03 15:53 发表评论
]]>
վ֩ģ壺 þһѵ| ŷձ߹ۿ| þwww˳_Ƭ| ͺˬӲƵ| av| ޹˾þ99Ʒ| ޾ƷҹӰ| һɫþ88ۺ޾Ʒ| й߹ۿѸ| Ƶ߹ۿ| һձaѲ| Ʒ޾Ʒ2021| Ʒ޾Ʒۿ| þþƷAV͵ | þþƷa޹v岻| ޹Ʒһҳ| ҹѸվ| ëƬAëƬѲ| ѾƷԲ߹ۿͼƬ | ۾aëƬѹۿ| ޾ƷAAƬ| sss߲| Ůbbbbbbbbb| ձ߿Ƭ| þù޹ۿ| þþƷav| ޹˸߹ۿ| Ļպ| ŮƷþþ| ˾Ʒ޾Ʒ| Ʒ˳| ͵͵޸պ| ۺAV߲| ޾Ʒھþ| av޹av| ëƬ߹ۿ| 337pձŷ޴| ޹Ʒһ| ۺɫɫ| һAVٸӰ| ޱרwww|