当前位置:首页 > JSP教程 > JSP常见问题

JSP application(return String)用法详例

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 filesnetbeans 6.7.1wwwtestmethodbuildwebapplication.jsp

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐