码迷,mamicode.com
首页 > Web开发 > 详细

2014-9-17二班----9 web project

时间:2014-09-17 20:23:32      阅读:240      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   io   os   java   ar   strong   

 http://localhost:8080/rwkj1/indexServlet             跳转                    http://localhost:8080/rwkj1/index.jsp

 

浏览器地址栏  会变化    重定义

 

package cn.rwkj.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class IndexServlet extends HttpServlet{
    
public void    doGet(HttpServletRequest re,HttpServletResponse res) throws ServletException, IOException{
    
System.out.println("odget");

//re.getRequestDispatcher("index.jsp").forward(re, res);
res.sendRedirect("index.jsp");
}

public void doPost(HttpServletRequest re,HttpServletResponse res){
    System.out.println("odget");
}
    
}

 

2014-9-17二班----9 web project

标签:style   blog   http   color   io   os   java   ar   strong   

原文地址:http://www.cnblogs.com/fantasy12436109/p/3977933.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!