From the course: Jakarta EE Servlets
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Solution: Handling Servlet requests - Jakarta EE Tutorial
From the course: Jakarta EE Servlets
Solution: Handling Servlet requests
(punchy music) - [Instructor] So, how did it go? Were you able to get the product information updated? Let me show you how I approached it. The first thing that I did was I removed the doPost method from my servlet. That's because, when performing an update operation, we typically use an HTTP PUT, that meant I needed to override the doPut method on the HTTP servlet type. To do that, I right-clicked on the class, went to Source, and then Override Implement Methods. And within this dialogue, I found the doPut method, which I checked, and hit OK. You'll notice that this added the doPut method into my servlet where I could override its implementation. Now, I noticed a lot of the logic within the doGet method could be used in the implementation of our doPut method. So the first thing I did was copied that logic, and pasted it within the body of the doPut method. Now, the compiler didn't like these parameter names, so I…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
HTTP request messages5m 14s
-
(Locked)
Mapping requests to a Servlet4m 38s
-
(Locked)
Advanced Servlet mappings6m 4s
-
(Locked)
Request handler methods5m 19s
-
(Locked)
Obtaining data from query parameters8m
-
(Locked)
Obtaining data from the path4m 33s
-
(Locked)
Obtaining data from headers5m 53s
-
(Locked)
Obtaining form data from the request body5m 15s
-
(Locked)
Obtaining JSON data from the request body5m 46s
-
(Locked)
Challenge: Handling Servlet requests1m 32s
-
(Locked)
Solution: Handling Servlet requests6m 5s
-
-
-
-
-