script language="javascript"> var pos,str,para,parastr,tempstr1; tempstr=""; //接收url str = window.location.href; pos = str.indexOf("?") parastr = str.substring(pos+1); document.write(" 文件路径:"+str); if (pos>0){ document.write(" 所有参数:"+parastr); } else { document.write ("无参数"); } if (str.indexOf("&")>0){ para = parastr.split("&"); for(i=0;iscript> 本文来自ChinaUnix博客,如果...
by leaslie - php文档中心 - 2006-03-29 14:39:18 阅读(583) 回复(0)
jsp中获得当前应用的相对路径和绝对路径 根目录所对应的绝对路径:request.getRequestURI() 文件的绝对路径 :application.getRealPath(request.getRequestURI()); 当前web应用的绝对路径 :application.getRealPath("/"); 取得请求文件的上层目录:new File(application.getRealPath(request.getRequestURI())).getParent() Servlet中获得当前应用的相对路径和绝对路径 根目录所对应的绝对路径:request.getServletPath(); 文件...
System.out.println("根目录所对应的绝对路径:" + request.getServletPath() + ""); String strPathFile = request.getSession().getServletContext().getRealPath(request.getRequestURI()); System.out.println("文件的绝对路径:" + strPathFile + ""); String strDirPath = new File(request.getSession().getServletContext().getRealPath(request.getRequestURI())).getParent(); System.out.println("目录的绝对路径...
OS 是 Solaris Web 服务器是 iPlanet 请问 jsp 中怎么得到Web 的根目录在系统中的绝对路径? 比如得到 "/usr/opt/SUNWapp/roothome/" 这个字符串 谢谢
script language="javascript"> function chk(){ var obj = document.getElementsByName('imgposition'); for (i=0;iobj.length;i++){ if (obj.checked){ alert(obj.value); return; } } alert('你没选'); } //--> /script> form name=form1> input type="radio" name="imgposition" value="1"> inpu...
Date now = new Date(); out.println(DateFormat.getTimeInstance().format(now)); jsp to display the current time The current time is: 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/7965/showart_55812.html
对于tomcat的容器,尝试这个容器的编码改一下 在server.xml的 中加入 URIEncoding="UTF-8" 修改后是这样 (上述出自: http://zhidao.baidu.com/question/48824138.html ) 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/65478/showart_1078631.html
1. % java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); java.util.Date currentTime = new java.util.Date();//得到当前系统时间 String str_date1 = formatter.format(currentTime); //将日期时间格式化 String str_date2 = currentTime.toString(); //将Date型日期时间转换成字符串形式 %> 2. SCRIPT LANGUAGE="javascript"> var myDate = new Date(); myDate.getY...
我在jsp程序中做了一个bean供页面调用, 在这个bean中我用 java.io.File 读取外部文件, 此外部文件用相对路径如何给出, 放到什么地方合适? 我用绝对路径,正常, 用相对路径提示系统找不到这个外部文件! 哪位指点一下, 谢谢!!