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

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…

Contents