JSP 中Servlet的自己实现(jsp&servlet)真没想到

随心笔谈1年前 (2023)发布 admin
118 0


<%@ page language=”java” import=”java.util.*” contentType=”text/html; charset=utf-8″%>
<%
String path=request.getContextPath();
String basePath=request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
%>

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<base href=”https://www.jb51.net/article/<%=basePath%>” rel=”external nofollow” >

<title>My JSP ‘index.jsp’ starting page</title>
<meta http-equiv=”pragma” content=”no-cache”>
<meta http-equiv=”cache-control” content=”no-cache”>
<meta http-equiv=”expires” content=”0″>
<meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
<meta http-equiv=”description” content=”This is my page”>
<!–
<link rel=”stylesheet” type=”text/css” href=”https://www.jb51.net/article/styles.css” rel=”external nofollow” >
–>
</head>

<body>
<h1>第一个Servlet小例子</h1>
<a href=”https://www.jb51.net/article/servlet/HelloServlet” rel=”external nofollow” >Get方式请求HelloServlet</a>
<form action=”servlet/HelloServlet” method=”post”>
<input type=”submit” value=”Post方式请求HelloServlet”>
</form>
</body>
</html>

© 版权声明

相关文章