A servlet forwards a request to a JSP page for rendering the view. Which method does it use, and what happens to the URL in the browser?
- request.getRequestDispatcher().forward()
- request.sendRedirect()
- response.forward()
- response.sendRedirect()
The correct method for forwarding a request to a JSP page is request.getRequestDispatcher().forward(). The URL in the browser remains the same as the original request URL.
Loading...
Related Quiz
- What is the function of FilterMapping in a web application?
- Consider a scenario where a request needs to be authenticated and then logged. How should the filters be arranged in the filter chain?
- To prevent XSS attacks, it is essential to _________ user input and _________ user output.
- If a filter needs to perform different actions based on whether the request is an HTTP GET or POST, where should this logic be implemented?
- What is the impact of synchronization on servlet performance?