JSP application(return String)用法詳例
更新時間:2009年10月04日 15:34:43 作者:
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
復制代碼 代碼如下:
<%--
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
相關文章
JSP中Servlet的Request與Response的用法與區(qū)別
這篇文章主要介紹了JSP中Servlet的Request與Response的用法與區(qū)別的相關資料,希望通過本文能幫助到大家,需要的朋友可以參考下2017-09-09web開發(fā)中添加數(shù)據(jù)源實現(xiàn)思路
這篇文章主要介紹了 web開發(fā)中添加數(shù)據(jù)源實現(xiàn)思路的相關資料,需要的朋友可以參考下2017-04-04Apache+Servlet+Jsp環(huán)境設置(下)
Apache+Servlet+Jsp環(huán)境設置(下)...2006-10-10jsp中頁面之間的跳轉(zhuǎn)forward與sendRedirect的區(qū)別
頁面之間的跳轉(zhuǎn)可以通過兩種方式實現(xiàn):forward和sendRedirect;forward:可以在JSP頁面中使用,可以在Servlet中實現(xiàn),需要的朋友可以了解下2012-12-12