09 2012 档案
List遍历的4种方法
摘要:import java.util.ArrayList;import java.util.Iterator;import java.util.List;/*** 遍历数组四种方法** @author JRunner** 2009-10-26** Email:JRunner@126.com*/class Test {/** * * 注:Iterator 迭代器 * * @param args */public static void main(String[] args) {Test1 t = new Test1();Test1 t1 = new Test1();List list = new A
阅读全文
java web中的监听器
摘要:Java中Listener监听器作用1.1 Listener对象分类Servlet的Listener监听器包括三种类型:1、ServletContextListener 监听ServletContext对象Java代码publicvoidcontextInitialized(ServletContextEvent event); publicvoidcontextDestoryed(ServletContextEvent event);Java代码publicvoidcontextInitialized(ServletContextEventevent);publicvoidcontextDe
阅读全文
Hibernate关于时间的操作
摘要:1、hibernate很大的一个特点就是屏蔽了数据库的差异,使用了hibernate就应该尽量用HQL来操作数据库(除非不得不用数据库本身的一些特性),而对于时间类型的比较hibernate也是支持的。HQL: and acceptDate<=:end用一个时间类型来替换参数end:query.setDate("end",endDate);2、顺便在提一个问题,我们经常碰到查询从A(起始时期)到B(结束日期)的纪录。如果数据库中字段类型为timestamp,那么查询2005-11-23到2005-11-23的纪录时不会出现2005-11-23那一天的纪录,哪怕你的比较
阅读全文
java web中常见乱码问题
摘要:最基本的乱码问题这个乱码问题是最简单的乱码问题。一般新会出现。页面编码不一致导致的乱码Html代码: <%@ page language="java" pageEncoding="UTF-8"%><%@ page contentType="text/html;charset=iso8859-1"%><html> <head> <title>中文问题</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
阅读全文
浙公网安备 33010602011771号