request对象和response对象(16)
来源:未知 责任编辑:责任编辑 发表时间:2014-05-10 12:18 点击:次
p> <meta http-equiv="description" content="this is my page">
p> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
p> </head>
p>
p> <body>
p> <h1>LOGO</h1>
p> </body>
p></html>
p>复制代码
p>footer.html
p>
p>复制代码
p><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
p><html>
p> <head>
p> <title>footer.html</title>
p> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
p> <meta http-equiv="description" content="this is my page">
p> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
p> </head>
p>
p> <body>
p> <h1>@COPY</h1>
p> </body>
p></html>
p>复制代码
p>复制代码
p>package cn.lsl.request;
p>
p>import java.io.IOException;
p>
p>import javax.servlet.ServletException;
p>import javax.servlet.http.HttpServlet;
p>import javax.servlet.http.HttpServletRequest;
p>import javax.servlet.http.HttpServletResponse;
p>
p>public class MainServlet1 extends HttpServlet {
p>
p> public void doGet(HttpServletRequest request, HttpServletResponse response)
p> throws ServletException, IOException {
p> request.getRequestDispatcher("/logo.html").include(request, response);
p> response.getOutputStream().write("<h1>Main 1</h1>".getBytes());
p> request.getRequestDispatcher("/footer.html").include(request, response);
p> }
p>
p> public void doPost(HttpServletRequest request, HttpServletResponse response)
p> throws ServletException, IOException {
p> doGet(request,response);
p> }
p>
p>}
p>复制代码
p>复制代码
p>package cn.lsl.request;
p>
p>import java.io.IOException;
p>import javax.servlet.ServletException;
p>import javax.servlet.http.HttpServlet;
p>import javax.servlet.http.HttpServletRequest;
p>import javax.servlet.http.HttpServletResponse;
p>
p>public class MainServlet2 extends HttpServlet {
p>
p> public void doGet(HttpServletRequest request, HttpServletResponse response)
p> throws ServletException, IOException {
p> request.getRequestDispatcher("/logo.html").include(request, response);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>