1、页面关闭之前执行js.(使用了js的onunload事件)
demo1:   
 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
   <title>onunload测试</title>
   <script>
   function checkLeave(){
    alert("欢迎下次再来!");
在这里可以写你要执行的那个函数
   }
   </script>
   </head>
   <body onunload="checkLeave()">
   </body>
   </html>
demo2:

判断是刷新还是离开:
<HTML>
<HEAD>
<TITLE>判断是刷新还是关闭</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Author" CONTENT="onunload">
<META NAME="Description" CONTENT="test js onunload event">
</HEAD>
<script>
function CloseOpen() {
if(event.clientX<=0 && event.clientY<0) {
alert("关闭");
}
else
{
alert("刷新或离开");
}
}
</script>
<body onunload="CloseOpen()">
</BODY>
</HTML>
2、当jsp页面完全加载完成后执行一个js函数(使用onload事件,js里有多种写法,了解一下)
方法1.如下程序,当页面完全加载后执行openTheIndexPage()方法
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Telecommunications Data Collection System</title>
<script type="text/javascript" src="<%=contextPath%>/js/baseframe.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/cookies.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/tag/tag.js"></script>
<script language="javascript" for="window" event="onload">
function openTheIndexPage() {
openMyURIWithCid(true, 'root', 'IDX', "iframe/dispatch.jsp?url=tdc/zhk/impctrlobjinf/index/index.jsp", '首页',
'top.tagmenu', 'top.maintop', true,
'system/accessPaths.do?currentModuleCode=IDX',
'mainmenu', true);
};
if(document.readyState=="complete"){
openTheIndexPage();
}
</script>
</head>
<body>
</body>
</html>
方法2:可以是以下几种,但是效果不如方法1.
<body onload="function name()"> </body > 
<script>window.onload=function name </script>
<script language="javascript" for="window" event="onload">function name(); </script>
方法3:<body onload="xxx()"> </body> xxx()为你要执行的函数
.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }补充:
<script language= "javascript " for= "window " event= "onload " /> 的问题解读
EVENT event 设置或获取脚本编写用于的事件
FOR htmlFor 设置或获取绑定到事件脚本的对象。
<script   language= "javascript "   for= "window "   event= "onload ">
.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }相当于
<script   language= "javascript "> 
// 绑定
window.attachEvent( "onload ",function() {
})
</script>
3、js更改class
html:

<div id="a" class="dbl"> a content </div>
<div id="b" class="dno"> b content </div>
<div id="c" class="">c content</div?

css:
<style type="text/css">
.dbl{display:block;}
.dno{display:none;}
</style>

js:

<script language="javascript">
document.getElementById("a").onmouseover = function(){
document.getElementById("a").className = "dno";
document.getElementById("b").className = "dbl";
}
document.getElementById("b").onmouseout = function(){
document.getElementById("a").className = "dbl";
document.getElementById("b").className = "dno";
}

</script>

注意:js要放在最后面,css,html的位置随便

补充:

function change(obj,cal){

var ok;
if(document.all)
{ ok=obj.getAttribute("className")';
}//for IE
else
{ ok=obj.getAttribute("class");
}//for FF
obj.className=ok;

}

 

更改其它属性:.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }
<div>
<a href="javascript:changeBody(1)">模块A</a>
<a href="javascript:changeBody(2)">模块B</a>
<a href="javascript:changeBody(3)">模块C</a>
</div>

<div style="display: none" id="iDBody1"></div>
<div style="display: none" id="iDBody2"></div>
<div style="display: none" id="iDBody3"></div>.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }
function changeBody(index){
switch(index){
case 1:{
document.getElementById('iDBody1').style.display = "";
document.getElementById('iDBody2').style.display = "none";
document.getElementById('iDBody3').style.display = "none";
} break;
case 2:{
document.getElementById('iDBody1').style.display = "none";
document.getElementById('iDBody2').style.display = "";
document.getElementById('iDBody3').style.display = "none";
} break;
case 3:{
document.getElementById('iDBody1').style.display = "none";
document.getElementById('iDBody2').style.display = "none";
document.getElementById('iDBody3').style.display = "";
} break;
}
}.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }

 

参考资料:
5、更改tomcat接收请求的线程数


更改CATALINA_HOME(tomcat安装目录)/conf/server.xml文件中的以下节点中的maxThreads属性的值即可

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxThreads="800" acceptCount="1000"/>.csharpcode, .csharpcode pre { font-size: small; color: rgba(0, 0, 0, 1); font-family: consolas, "Courier New", courier, monospace; background-color: rgba(255, 255, 255, 1) }
.csharpcode pre { margin: 0 }
.csharpcode .rem { color: rgba(0, 128, 0, 1) }
.csharpcode .kwrd { color: rgba(0, 0, 255, 1) }
.csharpcode .str { color: rgba(0, 96, 128, 1) }
.csharpcode .op { color: rgba(0, 0, 192, 1) }
.csharpcode .preproc { color: rgba(204, 102, 51, 1) }
.csharpcode .asp { background-color: rgba(255, 255, 0, 1) }
.csharpcode .html { color: rgba(128, 0, 0, 1) }
.csharpcode .attr { color: rgba(255, 0, 0, 1) }
.csharpcode .alt { background-color: rgba(244, 244, 244, 1); width: 100%; margin: 0 }
.csharpcode .lnum { color: rgba(96, 96, 96, 1) }
相关信息:
tomcat6.x中Servlet容器的结构:
Server(容器)下有一个或多个Service,Service下有一个或多个Connector、一个engine,一个engine可以有多个host(虚拟主机,可以配域名和别名,可以决定是否识别新添加的web项目),一个host中可以包括多个Context(web应用程序)

maxThreads:tomcat起动的最大线程数,即同时处理的任务个数,默认值为200
acceptCount:当tomcat起动的线程数达到最大时,接受排队的请求个数,默认值为100

这两个值如何起作用,请看下面三种情况
情况1:接受一个请求,此时tomcat起动的线程数没有到达maxThreads,tomcat会起动一个线程来处理此请求。
情况2:接受一个请求,此时tomcat起动的线程数已经到达maxThreads,tomcat会把此请求放入等待队列,等待空闲线程。
情况3:接受一个请求,此时tomcat起动的线程数已经到达maxThreads,等待队列中的请求个数也达到了acceptCount,此时tomcat会直接拒绝此次请求,返回connection refused


6、java和c#将String逐字母输出示例:
java:

public static void main(String[] args) {
// TODO Auto-generated method stub
String str="Chinese123";
for (int i = 0; i < str.length(); i++) {
System.out.println(str.charAt(i));
}

char[] charArray=str.toCharArray();
for (int i = 0; i < charArray.length; i++) {
System.out.println(charArray[i]);
}
}

c#:

static void Main(string[] args)
{
String str = "Chinese123";
for (int i = 0; i < str.Length; i++)
{
Console.WriteLine(str[i]);
}
Console.ReadKey();
}

7、



 

 

待续......................