`
java_my_life
  • 浏览: 259022 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
在jsp和class文件中调用的相对路径不同。在jsp里,根目录是WebRoot 在class文件中,根目录是WebRoot/WEB-INF/classes 当然你也可以用System.getProperty("user.dir")获取你工程的绝对路径。 1.jsp中取得路径: 以工程名为TEST为例 (1)得到包含工程名的当前页面全路径: request.getRequestURI() 结果:/TEST/test.jsp (2)得到工程名: request.getContextPath() 结果:/TEST (3)得到当前页面所在目录下全名称: requ ...

HTML防止重复提交

    博客分类:
  • HTML
1 在你的表单页里HEAD区加入这段代码: <META HTTP-EQUIV="pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"> <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"> 2 <inp ...
Enumeration allNetInterfaces = NetworkInterface.getNetworkInterfaces(); InetAddress ip = null; while (allNetInterfaces.hasMoreElements()) { NetworkInterface netInterface = (NetworkInterface) allNetInterfaces .nextElement(); // System.out.println(netInterface.getName()); En ...
1.返回当前JAVA类的绝对路径 getClass().getResource(getClass().getSimpleName() + ".class").getPath(); 2.查找指定文件的绝对路径(仅限src目录下)。如fileName="bean.xml"; Thread.currentThread().getContextClassLoader().getResource(fileName).getPath();
Global site tag (gtag.js) - Google Analytics