Building Web Applications with JSP: Customizing Responses with Servlets
Java
| Intermediate
- 10 videos | 1h 20m 48s
- Includes Assessment
- Earns a Badge
Java servlets are server-side programs that manage clients' requests and return a customized response for each of them. Use this course to gain some hands-on experience in customizing responses in your web application with HttpServlets. Discover how to build simple web pages that accept user input in a form, develop a servlet that can process the inputs, and add complexity to your app by introducing multiple pages. This course will also help you examine the use of a RequestDispatcher and the ServletConfig and ServletContext classes and recognize how attributes are stored at different scopes in a JSP app. Having completed this course, you'll be able to use servlets to process requests and produce customized responses in a JSP application.
WHAT YOU WILL LEARN
-
Discover the key concepts covered in this courseDefine a servlet class to process a simple get requestRecognize the power of the webservlet annotation when it comes to mapping servlets to url endpointsUse an httpservletrequest object to access the parameters submitted by an end-user of a web applicationForward a request to a different endpoint in an application using the requestdispatcher
-
Transfer processed data from a servlet to a jsp file for display in a web appRecognize the power and scope of the servletconfig and servletcontext classes when working with servletsSet attributes at the request, session, and application-level using the corresponding setter methodsDescribe the process of retrieving attributes from various scopes in your app, and recognize the limitations of each scopeSummarize the key concepts covered in this course
IN THIS COURSE
-
2m 19sHere, you’ll learn more about your instructor and this course. This course provides hands-on experience with customizing responses in your web application by means of HTTP servlets. You’ll learn to build a simple web page to accept user input in a form. Then, you’ll develop a servlet which can process the input supplied. You'll add complexity to your app by introducing multiple pages. FREE ACCESS
-
12m 19sHere, you’ll learn about servlets. A servlet, in a Java application, is a component that can handle an incoming HTTP request, process that request, generate a response, and then send that response back to the client, via the webserver. JSP applications are converted to servlets when deployed to Tomcat. Now, you’ll make use of servlets directly. This allows you to harness their full potential. FREE ACCESS
-
7m 54sIn this demo, you’ll package your application and deploy it to Tomcat. You’ll head to index.jsp where you’ll confirm that your hyperlink points to the my-servlet URL. This is mapped to the MyServlet class. You’ll then pull up the Terminal. You’ll generate the WAR file for your app by running the mvn clean package. Once the WAR file has been generated, you’ll copy it and drop it into the webapps folder of Tomcat. FREE ACCESS
-
8m 50sHere, you’ll watch a demo on coding your servlet. You’ll start by importing IOException and PrintWriter from java.io. You’ll use the WebServlet annotation, which can be obtained from jakarta.servlet.annotation. You’ll now learn to process inputs in a servlet. FREE ACCESS
-
10m 9sIn this demo, you’ll make use of a RequestDispatcher to partially process an incoming request in one servlet and then dispatch it to another servlet where more processing can be performed. While doing so, you’ll explore how the web.xml file can be used to map servlets to URL endpoints, and how these are analogous to a WebServlet annotation. FREE ACCESS
-
9m 12sIn this demo, you’ll learn to forward a request from a servlet to a JSP page. You’ll change the application so that it uses the WebServlet annotation instead of the web.xml. You’ll need to head back over to the IDE and include a new import. You'll add in the WebServlet annotation and apply it to your servlet. You’ll add in the annotation just before the class definition and then set its urlPatterns property to "/bookinfo". FREE ACCESS
-
9m 18sIn this demo, you’ll take a look at the ServletConfig and ServletContext objects available to HttpServlets. These are both useful when accessing servlet specific information. There’s a clear distinction between the two. A ServletConfig is servlet-specific, whereas the ServletContext has to do with the application as a whole. You’ll see how these can be accessed. You’ll also look at some of their properties. FREE ACCESS
-
11m 7sIn this demo, you’ll explore how to set attributes at various levels or various scopes within a JSP application. You’ll create and modify several files. Each of these files represents a different stage in a user's interaction with your website. You’ll go over each of these files in sequence, starting with index.jsp. This is defined within the webapp folder. This is where you’ll simulate a user sign-in form. FREE ACCESS
-
7m 35sIn this demo, you’ll retrieve attributes from different scopes. Onscreen, you’ll see this demo looks similar to the last. You’ll once again invoke getAttribute from the request level. Then, you’ll use the ServletContext when you call request.getServletContext. There’s a difference here, though. The original request object is no longer accessible since it has already been processed and has generated a response on the signinconfirm page. FREE ACCESS
-
2m 4sIn this video, you’ll summarize what you’ve learned in this course. You’ve gained hands-on experience with Customizing Responses in your web application by means of HTTP Servlets. You saw how information can be extracted from request objects and then processed either within a servlet or over multiple servlets and JSPs. You built a simple web page to accept user input in a form and then developed a servlet that could process the input supplied. FREE ACCESS
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.
Digital badges are yours to keep, forever.