1.得到相对路径
URL url = ServiceFactory.class.getResource("/config/log4j.properties");
Properties properties = new Properties();
try {
properties.load(new InputStreamReader(url.openStream()));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
PropertyConfigurator.configure(properties);
2 简单数据库连接池使用:
1.加入要用到的数据库包:mysql-connector-java-3.1.13-bin.jar
2.加入proxool-cglib.jar,proxool-0.9.1.jar和commong-logging-1.1.jar
3.加入如下代码:
PropertyConfigurator.configure("src/Proxool.properties");(只在加载时使用一次)
Connection connection = DriverManager.getConnection("proxool.proxool-sipity");(获得连接)
3.IntelliJ一款java 编译工具(才知道)
4.JAVA字符串转日期或日期转字符串
SimpleDateFormat sdf = new SimpleDateFormat( " yyyy-MM-dd HH:mm:ss " );
1.字符串转日期
2008-07-10 19:20:00 要把它转成日期,可以用 Date date = sdf.parse( " 2008-07-10 19:20:00 " );
2.日期转字符串
String str = sdf.format(new Date());字符串内容的格式类似2008-07-10 19:20:00。
SimpleDateFormat sdf = new SimpleDateFormat( " yyyy年MM月dd日 " );
String str = sdf.format(new Date());
5使用JSP大约有下列三种跳转方式:
1. response.sendRedirect();
2. response.setHeader("Location","");
3. <jsp:forward page="" />
5.JfreeChart使用:http://www.itpub.net/archiver/tid-628960.html