
Java
iteye_8127
这个作者很懒,什么都没留下…
展开
-
Servlet 的生命周期 (摘自JSP2.0技术手册)
(1) 产生 Servlet,加载到Servlet Engine中,然后调用 init( )这个方法来进行初始化工作。(2) 以多线程的方式处理来自Client 的请求。 (3) 调用 destroy( )来销毁Servlet,进行垃圾收集 (garbage collection)。 Servlet 生命周期的定义,包括如何加载、实例化、初始化、处理客户端请求以及如何被移除。这个生命周期由...原创 2008-09-09 15:25:07 · 111 阅读 · 0 评论 -
Java Exception 继承关系图
[img]/upload/attachment/42963/5ca6873d-8bac-3f18-a2ec-b967a224ee56.gif" alt="" width="568" height="404[/img]原创 2008-10-16 17:43:45 · 494 阅读 · 0 评论 -
Jdbc demo
String url = "jdbc:mysql://127.0.0.1:3306/mysql";String username = "root";String password = "123456";try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection(url...2008-10-24 16:02:54 · 142 阅读 · 0 评论 -
对给定的数字(float)四舍五入到小数点后两位
float f = 123.456f;float f1 = new BigDecimal(f).setScale(2,BigDecimal.ROUND_HALF_UP).floatValue();float f2 = Math.round(f * 100) / 100f;float f3 = new Float(new DecimalFormat(".##").format...原创 2010-02-03 13:29:59 · 207 阅读 · 0 评论 -
"Page Encoding","contentType"的区别
SUN官方解释(见《The Java EE 5 Tutorial 》)Response and Page EncodingYou also use the contentType attribute to specify the encoding of the response. For example, the date application specifies that the...2009-09-14 10:16:53 · 214 阅读 · 0 评论 -
character encodings in the Java 2 platform(Java2 平台的字符编码)
Web components usually use PrintWriter to produce responses; PrintWriter automatically encodes using ISO-8859-1. Servlets can also output binary data using OutputStream classes, which perform no encod...2009-09-14 10:53:12 · 125 阅读 · 0 评论 -
Html元素<textarea>内回车的处理
做事从小事入手,从细节入手. Html元素<textarea></textarea>文本域标签,里面可以输入文字,当然回车换行也是允许的。当我们往数据库存储的时候,回车换行被转换为"\r\n"如果不注意,可能会出现这样的情况,数据取出来,直接window.write(string) 或者 element.value = string回车换行会自动折行,像...2010-04-08 09:08:33 · 360 阅读 · 0 评论 -
SCJP拾遗(一) 默认构造函数的访问权限
Java 类(1)如果没有指定构造函数,编译时会自动创建一个默认的构造函数,如果指定,则不会自动创建默认构造函数(2)如果在类的修饰前是public 则默认构造函数访问权限是 public ,如果 没有显示采用public修饰,则 默认构造函数的访问权限是 friendly(3)子类继承父类,子类的构造函数执行前总是会调用父类的构造函数,如果没有显示的调用父类的构造函数,则会调用父类...原创 2010-06-02 14:10:33 · 346 阅读 · 0 评论 -
转载 web.xml元素:常见设定值一览
本文对web.xml元素中的常见设定值进行了介绍。每一个站的WEB-INF下都有一个web.xml的设定文件,它提供了我们站台的配置设定。web.xml元素介绍 每一个站的WEB-INF下都有一个web.xml的设定文件,它提供了我们站台的配置设定. web.xml元素定义: ◆站台的名称和说明 ◆针对环境参数(Context)做初始化工作 ◆Servl...原创 2010-08-05 19:40:24 · 146 阅读 · 0 评论 -
Log4j 总结(六) log4j 之 WriterAppender
public class WriterAppender extends AppenderSkeletonWriterAppender() This default constructor does nothing.WriterAppender(Layout layout, java.io.OutputStream os) Instantiate a Wr...原创 2008-10-16 10:33:36 · 347 阅读 · 0 评论 -
Log4j 总结(五) log4j 之 配置文件
前面几个都是概念,现在是实战Log4j支持两种格式的配置文件:XML格式和Java的property格式.log4j.properties 置于classes下 # rootlog4j.rootLogger=debug, stdout, Rlog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdo...原创 2008-10-16 10:21:30 · 113 阅读 · 0 评论 -
Tomcat 各版本支持的Servlet规范
Servlet/JSP SpecApache Tomcat version2.5/2.16.0.182.4/2.05.5.272.3/1.24.1.372.2/1.13.3.2 (archived)2008-09-09 15:43:17 · 976 阅读 · 0 评论 -
Servlet 2.4 对比 2.3 的改变
2003年11月底,J2EE 1.4规范正式发布,Servlet也从原本的 2.3版升级至 2.4版。其中主要新增的功能有以下三点: (1) web.xml DTD 改用XML Schema; (2) 新增 Filter四种设定; (3) 新增 Request Listener、Event 和 Request Attribute Listener、Event。 1,web.xml D...原创 2008-09-09 15:56:09 · 157 阅读 · 0 评论 -
Jsp的执行过程
JSP 的执行过程(1) 客户端发出Request (请求); (2) JSP Container 将JSP转译成Servlet的源代码; (3) 将产生的Servlet 的源代码经过编译后,并加载到内存执行; (4) 把结果Response (响应)至客户端。在执行 JSP 网页时,通常可分为两个时期:转译时期(Translation Time)和请求时期(Request Time)...原创 2008-09-09 16:03:50 · 298 阅读 · 0 评论 -
检测指定URL是否有效连接的JAVA代码
try{ URL url = new URL(url_s); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); /** * public int getResponseCode()throws IOException * 从 HTTP 响应消息获取状态码。 * 例如,就以下状态行来说: * H...原创 2008-09-09 17:26:57 · 165 阅读 · 0 评论 -
Log4j 总结(二) log4j主要的三个组件
Log4j has three main components: loggers,appenders and layouts. Log4j中有三个主要的组件,它们分别是 Logger、Appender和Layout。 1,Logger是记录日志的主体,描述它可以改变日志记录的表现。Log4j允许开发人员定义多个Logger,每个Logger拥有自己的名字。有一个Logger...原创 2008-10-07 14:12:12 · 721 阅读 · 0 评论 -
Log4j 总结(一) log4j特色
One of the distinctive features of log4j is the notion of inheritancein loggers. Using a logger hierarchy it is possible to control whichlog statements are output at arbitrarily fine granularity but...2008-10-16 08:47:12 · 308 阅读 · 0 评论 -
Log4j 总结(三) log4j 之 Logger
Loggers are named entities. Logger names are case-sensitive andthey follow the hierarchical naming rule: Named HierarchyA logger is said to be an ancestor of another logger if its name...2008-10-16 09:36:37 · 164 阅读 · 0 评论 -
Log4j 总结(四) log4j 之 Appenders and Layouts
LoggerName AddedAppenders AdditivityFlag Output Targets Comment root A1 not applicable A1The root logger is anonymous but can be accessed with the Logger.getRootL...2008-10-16 09:49:44 · 124 阅读 · 0 评论 -
【转载】cpu 硬件同步原语(compare and swap)
cpu 硬件同步原语(compare and swap)支持并发的第一个处理器提供原子的测试并设置操作,通常在单位上运行这项操作。现在的处理器(包括 Intel 和 Sparc 处理器)使用的最通用的方法是实现名为 比较并转换或 CAS 的原语。(在 Intel 处理器中,比较并交换通过指令的 cmpxchg 系列实现。PowerPC 处理器有一对名为“加载并保留”和“条件存储”的指令,它...原创 2012-03-13 08:38:36 · 576 阅读 · 0 评论