Person is a JavaBean, so we’ll use the bean-related standard actions

With a couple of standard actions, we can eliminate all the scripting code in our JSP (remember: scripting code includes declarations, scriptlets, and expressions) and still print out the value of the person attribute’s name property. Don’t forget that name is not an attribute— only the person object is an attribute. The name property is simply the thing returned from a Person’s getName() method.

Without standard actions (using scripting)

<html><body>

<% foo.Person p = (foo.Person) request.getAttribute("person"); %>
Person is: <%= p.getName() %>

</body></html>

Note

The way we’ve been doing it.

With standard actions (no scripting)

<html><body>

<jsp:useBean id="person" class="foo.Person" scope="request" />

Person created by servlet: <jsp:getProperty name="person" property="name" />

</body></html>

Note

NO Java code here! No scripting, just two standard action tags.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset