91-9990449935 0120-4256464 |
SendRedirect in servletThe sendRedirect() method of HttpServletResponse interface can be used to redirect response to another resource, it may be servlet, jsp or html file. It accepts relative as well as absolute URL. It works at client side because it uses the url bar of the browser to make another request. So, it can work inside and outside the server. Difference between forward() and sendRedirect() methodThere are many differences between the forward() method of RequestDispatcher and sendRedirect() method of HttpServletResponse interface. They are given below:
Syntax of sendRedirect() methodExample of sendRedirect() methodFull example of sendRedirect method in servlet
DemoServlet.java
Creating custom google search using sendRedirectIn this example, we are using sendRedirect method to send request to google server with the request data. index.html
MySearcher.java
Output
Next TopicServletconfig Example
|