Servlet Request Interface

Servlet Request Interface:

A challenge of ServletRequest is used to give the client request information to a servlet, for instance, content sort, content length, parameter names and qualities, header informations, attributes.

Servlet Request Interface Methods

Example of ServletRequest to display the name:

index.html

  1. <form action=”welcome”method=”get”>
  2. Enter your name<input type=”text”name=”name”><br>
  3. <input type=”submit”value=”login”>
  4. </form>

DemoServ.java

  1. importservlet.http.*;
  2. importservlet.*;
  3. importio.*;
  4. publicclass DemoServ extends HttpServlet{
  5. publicvoid doGet(HttpServletRequest req,HttpServletResponse res)
  6. throwsServletException,IOException
  7. {
  8. setContentType(“text/html”);
  9. PrintWriter pw=res.getWriter();
  10. String name=req.getParameter(“name”);//will return value
  11. println(“Welcome “+name);
  12. close();
  13. }}

RequestDispatcher:

A challenge of ServletRequest is used to give the client request information to a servlet, for instance, content sort, content length, parameter names and qualities, header informations, attributes.
Methods of RequestDispatcher interface:
  1. public void forward(ServletRequest request,ServletResponse response)throws ServletException,java.io.IOException.
  2. public void include(ServletRequest request,ServletResponse response)throws ServletException,java.io.IOException.

forward( ) method:

forward( ) methodInclude( ) method:include ( ) methodSyntax of getRequestDispatcher method:

  1. publicRequestDispatcher getRequestDispatcher(String resource);
Drop Us A Query

Trending Courses
  • Python and Django Online Training
  • Python is a dynamic interrupted language which is used in wide varieties of applications. It is very interactive object oriented and high-level programming language.

  • Tableau Online Training
  • Tableau is a Software company that caters interactive data visualization products that provide Business Intelligence services. The company’s Head Quarters is in Seattle, USA.

  • MicroStrategy Online Training
  • Micro Strategy is one of the few independent and publicly trading Business Intelligence software provider in the market. The firm is operational in 27 Countries around the globe.

  • PEGA (PRPC) 7.2 Certification Online Training
  • Pega Systems Inc. is a Cambridge, Massachusetts based Software Company. It is known for developing software for Customer Relationship Management (CRM) and Business process Management (BPM).

  • Workday Online Training
  • Workday specialises in providing Human Capital Management, Financial Management and payroll in online domain.It is a major web based ERP software vendor.

  • Power BI Online Training
  • Power BI is business analytics service by Microsoft. With Power BI, end users can develop reports and dashboards without depending on IT staff or Database Administrator.


100% Secure Payments. All major credit & debit cards accepted.