Answer Posted / sonam
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.http.RequestDispatcher;
public class dispatcher extends HttpServlet throws
IOException, ServletException {
public void doGet(HttpServletRequest request,
HttpServletResponse response) {
RequestDispatcher dis=
request.getRequestDispatcher("welcome.jsp");
dis.forward(request, response);//it will go to ur
desired page.
dis.include("Hello java");//it will display ur
message also to ur desired page.
}
}
| Is This Answer Correct ? | 10 Yes | 5 No |
Post New Answer View All Answers
What is servlet initializer?
What is the difference between Difference between doGet() and doPost()?
What's the difference between servlets and applets?
What is the dispatcher servlet?
Which exception is thrown if the servlet is not initialized properly?
What’s the difference between genericservlet and httpservlet?
What is the use of httpservletrequestwrapper?
What is the difference between using getSession(true) and getSession(false) methods?
What is the difference between forward () and sendredirect () functions in servlet? Explain
Can we use threads in Servlets?
What is httpservlet class?
What is servlet instance?
Can we override servlet service method?
What are the steps involved in placing a servlet within a package?
What are the differences between forward() method and sendredirect() methods?