`
fengzhaoyang
  • 浏览: 34705 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表

servlet原理

    博客分类:
  • Java
 
Servlet工作原理 Servlet运行在Servlet容器中,由容器负责Servlet实例的查找及创建工作,并按照Servlet规范的规定调用Servlet的一组方法,这些方法也叫生命周期的方法。具体调用过程如下图所示: Servlet生命周期详解     如上图所示,Servlet的生命周期可以分为四个阶段,即装载类及创建实例阶段、初始化阶段、服务阶段和实例销毁阶段。下面针对每个阶段的编程任务及注意事项进行详细的说明。 (1)装载类及创建实例     客户端向Web服务器发送一个请求,请求的协议及路径必须遵守如下的格式:    
//检查必填字段 //(通用的校验必填项不能为空(包括input框,单选框,复选框,文本域)) var elem = document.getElementById("age"); function checkRequired(elem){ var name = elem.name; if(elem.type == "checkbox" || elem.type == "radio"){ var results=[]; results.numChecked = 0; var input = ...
//getCookie 得到指定名称的cookie的值 var bikky = document.cookie; function getCookie(name) { var index = bikky.indexOf(name + "="); if (index == -1) return null; index = bikky.indexOf("=", index) + 1; var endstr = bikky.indexOf(";", index); if (endst ...
//-----------------------------方式一--------------------------------------------- <html> <head> <script type="text/javascript"> function startTime(){ var today=new Date(); var strDate=(" "+today.getYear()+"年"+(today.getMonth()+1)+"月&qu ...
<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false" onbeforecopy="return false" onmouseup=document.selection.empty() oncopy=document.selection.empty() onselect=document.selection.empty()></body> onselects ...
String.prototype.trim = function() { return (this.replace(/^\s+|\s+$/g,"")); } //调用方法 function check(){ var fn = document.getElementById("fileName").value; document.getElementById("fileName").value = fn.trim(); }
//当载入这个页面的时候 光标会自动放在id="username"的input框里,不需要你去点击后才出现光标 if(window.attachEvent){ window.attachEvent('onload',init); }else if(window.addEventListener){ window.addEventListener('load',init,false); } function init(){ document.getElementById('username').focus(); }
Html代码 1.<button onclick="window.location.reload();">reload</button> <!--这种方式刷新会回到顶部--> 2.<button onclick="window.document.execCommand('Refresh');">reload</button> <!--这种方式会记住当前点击事件的位置。-->
//obj是一个js对象。 for(var s in obj){ alert(obj[s]); }
<script type="text/javascript"> var xmlhttp; function loadXMLDoc(url) { xmlhttp=null; if (window.XMLHttpRequest) {// code for all new browsers xmlhttp=new XMLHttpRequest(); } else if (window.ActiveXObject) {// code for IE5 and IE6 xmlhttp=new ActiveXObject(" ...
不用引其他js包 encodeURI方法是js底层有的方法 js方法 var url="<%=request.getContextPath()%>/laPlanForm/forUpdate4DistributeDepart.so?planId="+planIds+"&departName="+encodeURI(encodeURI(departName))+"&struId="+struId+"&batch=true"; var param=""; ...
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStre ...
获取文件路径 String path=this.getClass.getClassLoader().getResource("").getPath().substring(1);//如:D:/workspaces/zemo/build/classes/ String path=path+fileName;//如:fileName="模板.doc";则结果为:D:/workspaces/zemo/build/classes/模板.doc 通过此路径就可以获得文件流 如:InputStream in = new BufferedInputStream(new ...
Global site tag (gtag.js) - Google Analytics