|
用户名:shiweiyu 笔名:小施 地区: 福建-晋江 行业:其他 |
| 日 | 一 | 二 | 三 | 四 | 五 | 六 |
需要Gmail邮箱的朋友们来吧。100个邀请。
(作者置顶)
现在这里已经不再更新了。我的BLOG转移到http://shi.i0595.net
总算把页面正常化了。。。
研究了老半天才发现原来是上次那个图片太大了。撑爆了整个页面才引起的。呵呵。
新版本的BLOGCHINA更让人喜欢。这次更新增加了很多可以个性化的设置。实在是太好了。
WINDWOS98的开机音乐
禁止tomcat目录浏览
tomcat默认是允许目录浏览的,通常不希望有这个功能,而要禁止目录浏览,可以通过配置web.xml文件实现。
增加红色部分.
<servlet>
<servlet-name>default</servlet-name>
<servlet-class>
org.apache.catalina.servlets.DefaultServlet
</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>false</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
tomcat5.5.7的一些配置
因为工作需要.用到了tomcat了.
我用的版本是5.5.7的,下载地址访问这里可以看到很多镜像:http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
其实最新的版本是5.5.8,可是我访问的时候.5.5.8是测试版,所以我下了5.5.7
下面开始:
1.Tomcat虚拟目录设置.
在Tcomcat目录里的,默认配置情况下.你可以知道把你的程序放到webapps目录里面.默认配置中.webapps就像是站点的根目录一样.但是.如果你程序很多.放多了会觉得混乱.那么我们这里的情况就是要把程序放在另外一个地方.但是又要做成Tomcat的虚拟目录.
这里给出三个方法:
第一个:(不推荐):更改server.xml.用记事本打开该文件.在<Host>和</host>之间加上
<Context path="/site" docBase="c:\site" reloadable="true" debug="0">
</Context>
参数:path 表示在浏览器中输入http://localhost:8080/site
docBase表示你的程序包的物理绝对路径,默认的相对路径是$Tomcat_Home$/webapps
第二个:(推荐,便与维护)直接在$tomcat_home$/conf/catalina/localhost目录下写配置文件文件名任意取,最好是跟你的web应用相同便于管理,如site.xml内容为
<Context path="/site" docBase="c:\site" reloadable="true" debug="0">
</Context>
第三个:更改整个根目录:
找到<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">
将appBase的设置成期望的路径(绝对路径)
出现的问题:输入:http://localhost:8080/没有出现默认的页面
原因当然是更改了路径造成的。解决是把文件拷过来,或者再把原来默认的设成虚拟路径。
2.配置JDBC连接池
直接在我们之前配置虚拟目录中的<Context path="/site" docBase="c:\site" reloadable="true" debug="0">
</Context>
加入下面这些内容
<Resource name="jdbc/MySqlDS" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="DBusername" password="DBpassword" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/DBNAME?autoReconnect=true&useUnicode=true&characterEncoding=gb2312"/>
整个配置变为如下:
<Context path="/site" docBase="c:\site" reloadable="true" debug="0">
<Resource name="jdbc/MySqlDS" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="DBusername" password="DBpasswrod" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://127.0.0.1:3306/DB?autoReconnect=true&useUnicode=true&characterEncoding=gb2312"/>
</Context>
根据实际情况可以自己更改上面斜体的部分.
一些特效代码
这两天因为修改一个OA界面.用到了许多的特效代码.在这收集一下.
分时问候(放在body中):
<script language="javaScript">
<!--
now = new Date(),hour = now.getHours()
if(hour < 6){document.write("凌晨好!")}
else if (hour < 9){document.write("早上好!")}
else if (hour < 12){document.write("上午好!")}
else if (hour < 14){document.write("中午好!")}
else if (hour < 17){document.write("下午好!")}
else if (hour < 19){document.write("傍晚好!")}
else if (hour < 24){document.write("晚上好!")}
else {document.write("夜里好!")}
// -->
</script>
显示年月日星期的代码(放在BODY中):
<script language="JavaScript">
<!--
tmpDate = new Date();
date = tmpDate.getDate();
month= tmpDate.getMonth() + 1 ;
year= tmpDate.getYear();
document.write(year);
document.write("年");
document.write(month);
document.write("月");
document.write(date);
document.write("日");
// -->
</script><script language="JavaScript">
<!--
myArray=new Array(6);
myArray[0]="星期日"
myArray[1]="星期一"
myArray[2]="星期二"
myArray[3]="星期三"
myArray[4]="星期四"
myArray[5]="星期五"
myArray[6]="星期六"
weekday=tmpDate.getDay();
if (weekday==0 | weekday==6)
{
document.write(myArray[weekday])} else
{document.write(" " + myArray[weekday]) };
//--></script>
鼠标指向单元格变色:
onmouseout="this.style.backgroundColor=''" 鼠标离开效果onmouseover="this.style.backgroundColor='#FFcccc'"鼠标放上去的
效果,
可以修改#FFcccc的值来改变颜色
<table width="200" border="1" cellspacing="0" cellpadding="0" height=25>
<tr>
<td onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#FFcccc'" ></td>
</tr>
<tr>
<td onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#FFccaa'"></td>
</tr>
</table>
(待续)