Java Reference
In-Depth Information
26.<jsp:useBean id="bookAttrib" class="com.apress.chapter03.model.Book"
27.scope="request" />
28.<tr>
29.<td>Author's Name using <b> jsp:getProperty action </b>
30.</td>
31.<td>
32.<table border="1">
33.<tr>
34.<td>${fn:escapeXml("<jsp:getProperty name = \"bookAttrib \" property= \"author \" />")}</td>
35.</tr>
36.<tr>
37.<td>${fn:escapeXml("<jsp:getProperty name = \"bookAttrib \" property= \"author.name \" />")}</td>
38.</tr>
39.</table>
40.
41.</td>
42.<td>
43.<table border="1">
44.<tr>
45.<td><jsp:getProperty name="bookAttrib" property="author" />
46.</td>
47.</tr>
48.<tr>
49.<td>
50.<%-- <jsp:getProperty name ="bookId" property="author.name" /> - this code will yield run time
exception --%>
51.Not possible
52.</td>
53.</tr>
54.</table>
55.</td>
56.</tr>
57.<tr>
58.<td>Author's Name using<b> EL </b></td>
59.<td>${fn:escapeXml("${bookAttrib.author.name}")}</td>
60.<td>${bookAttrib.author.name}</td>
61.</tr>
62.</table>
63.</body>
64.</html>
Line 23 : This outputs the name of the author using expressions.
Line 50 : This shows that it is not possible to output the name of the author using
a JSP standard action.
Line 60 : This outputs the name of the author using EL.
Figure 3-7 illustrates what you will see when you run this application ( http://localhost:8080/
chapter03/book ). Essentially, it is just not possible to display the value of the name property of Author
using a standard JSP action; scripting elements would have been the only way to do it, had it not
been for EL.
Search WWH ::




Custom Search