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 files\netbeans 6.7.1\www\testmethod\build\web\application.jsp
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!!
点击进行留言回复
网友评论