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
Whats the advantages using servlets over using CGI?
How to find whether a parameter exists in the request object?
Why do we need a constructor in a servlet if we use the init method?
What are the difference between session and cookies in servlet? Explain
why we should override only no-agrs init() method.
What are the types of protocols supported by httpservlet ?
What is the use of send redirect () method?
What are the uses of servlet
Explain their methods? Tell me their parameter names also have you used threads in servlet?
What is a servlet engine?
Explain is servlet mapping?
How many objects of a servlet is created?
What is the difference between the servlets and cgi programs?
What are the jobs performed by servlets?
What is lazy loading and what is Generic Servlet Class?