欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

JSP application(return String)用法详例

程序员文章站 2023-11-26 19:50:52
1.jsp代码: 复制代码 代码如下: <%-- document : application created on : 2009-10-4, 13:18:53 au...
1.jsp代码:
复制代码 代码如下:

<%--
document : application
created on : 2009-10-4, 13:18:53
author : lucifer
--%>
<%@page contenttype="text/html" pageencoding="utf-8"%>
<!doctype html public "-//w3c//dtd html 4.01 transitional//en"
"http://www.w3.org/tr/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>jsp page</title>
</head>
<body>
get server info:
<%=application.getserverinfo()%>
<br>
get context path:
<%=application.getcontextpath()%>
<br>
get real path:
<%=application.getrealpath("/application.jsp")%>
<br>
</body>
</html>

2.输出:
复制代码 代码如下:

get server info: apache tomcat/6.0.18
get context path: /testmethod
get real path: d:\program files\netbeans 6.7.1\www\testmethod\build\web\application.jsp