全面解析jsp路径问题

2008-04-08 10:48:30 来源:中国自学编程网 作者:佚名 点击:

 
<%

String path = request.getContextPath();
System.out.println(path);

%>

如果在一个项目中 的jsp中加入以上代码 那么输出的结果 会是什么呢?

结果:/项目名 

 呵呵 自己原来以为只 是得到项目名 或者只是得到"/"看了 真是不试不知道呵呵

还有 今天在做项目的时候无意中发现的 

还有“/” 代表的是web项目的根目录 如果在根目录下建了文件夹 直接 写成href="page/index.html"即可访问页面 而不是"/page/index.html"

在js里这样写

document.write(’<a href="’);
document.write(’mailto:’);
document.write(’netai’);
document.write(
’@’);
document.write(’safemore.com’);
document.write(’">’);
document.write(’netai’);
document.write(’{at}’);
document.write(’safemore.com’);
document.write(’</a>’);

在页面上把js 引人后 会发现出现一个 链接 点击该链接会直接链接到您设置的outlook上 直接如果设置过 那么就直接发信给这个邮箱了 好玩吧。



logo

本类最新行业评测技巧教程学院
本类热点本日本周本月
本类推荐本日本周本月

广告联系 | 版权说明 | 意见建议 | 加入收藏 | 军网站群 [ 军软件园 - 军软件商城 - 军软件园论坛 ]

电信与信息服务业务经营许可证:京ICP证050203