Redirect Servlet Call to Another URL

import java.io.*;

import javax.servlet.*;
import javax.servlet.http.*;

public class ExampleServlet extends HttpServlet {

/**
* Processes requests for both HTTP GET and POST methods.
* @param request servlet request
* @param response servlet response
*/
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

//Redirect call to another url
response.sendRedirect("http://www.java.com");
}

}

0 comments:

                                                                

Site Meter