March 2008
Intermediate to advanced
911 pages
20h 31m
English
Remember in the original MVC beer app, the Servlet controller talked to the model (Java class with business logic), then set an attribute in the request scope before forwarding to the JSP view.
The JSP had to get the attribute from the request scope, and use it to render a response to send back to the client. Here’s a quick, simplified look at how the attribute goes from controller to view (just imagine the servlet talks to the model):
Servlet (controller) code

JSP (view) code
<html><body>
Hello
<%= request.getAttribute("name") %>
</body></html>Use a scripting expression to get the attribute and print it to the response.
(Remember: scripting expressions are ALWAYS the argument to the out.print() method.)

Read now
Unlock full access