And not just a Person, but a Person with a “name” property. We’re using the term “property” in the non-enterprise JavaBean[7] way—the Person class has a getName() and setName() method pair, which in the JavaBean spec means Person has a property called “name”. Don’t forget that the “name” property means a change in case for the first letter, “n”. In other words, the name of the property is what you get when you strip off the prefix “get” and “set”, and make the first character after that lower case. So, getName/setName becomes name.
We can tell from the getter/setter pair that Person has a property called “name” (note the lowercase “n”).
Servlet code
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { foo.Person p = new foo.Person(); p.setName("Evan"); request.setAttribute("person", p); RequestDispatcher view = request.getRequestDispatcher("result.jsp"); view.forward(request, response); }
JSP code
[7] We’ll talk about JavaBeans in a few pages, but for now, just know that it’s a plain old Java class that has getters and setters that follow a naming convention.