客户端路径:我们查看网页源码时,他已经被解析了,例如网页的头文件尾文件
客户端绝对路径:http://localhost:8080/
服务器路径:服务器端查看源码可以看见,
服务器端绝对路径:http://localhost:8080/web04/
这里的web04/使用request.getContextPath()代替
相对路径:css/style.css css与path.jsp 同级可以直接用
绝度路径:/web04/css/style.css 绝对路径最前面必须是 /然后加上自己的项目名
request.getContextPath() 获取自己的项目名
单例模式:public class JDBCUtil {
//设置一个静态实例
public static JDBCUtil instance=new JDBCUtil();
//私有化构造方法
private JDBCUtil() {
}
public void getConnection() {
System.out.println("得到一个数据库连接");
}
public static void main(String[] args) {
JDBCUtil.instance.getConnection();
}
}