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);
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • cocos2d-x学习笔记(19)--label 、label atlas
  • cocos2d-x学习笔记(23)--地图的使用3--CCTMXLayer
  • Cocos2d-x学习(一):HelloWorld
  • cocos2dx在xcode下开发,编译到android上(2)
  • cocos2d 设置屏幕默认方向
  • Cocos2d-x 2.0 之 Actions “三板斧” 之一
  • cocos2d-x学习笔记(22)--地图的使用2(TMX) --Z-Order、AnchorPoi
  • cocos2d-x学习笔记(18)--游戏打包(windows平台)
  • cocos2d-x学习笔记(16)--spritesheet(精灵表单)
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1