Review Error Pages Expression Language JSP Tag Libraries

tieplantlimabeansΛογισμικό & κατασκευή λογ/κού

28 Οκτ 2013 (πριν από 3 χρόνια και 11 μήνες)

59 εμφανίσεις

Review
Review how we separated HTML and Java code by using Java Beans
Error Pages
Applicant3.jsp defines error page
Default error pages for application can be specified in deploytool
Select WAR file
Go to File Ref’s tab
Specify error mapping

Demonstrate how /applicant-2 doesn’t have an error page for 500 errors
Add a default error page for 500 errors
Redeploy and show how /applicant-2 now has an error page for 500 errors
Expression Language
Applicant3.jsp still has Java code in it, which is bad for the web designers

Show Applicant4.jsp

Show expressions written in Expression Language (EL), and show how they’re
equivalent to JSP expressions in Applicant3.jsp

EL is simpler to use for web designers than JSP expressions
JSP Tag Libraries
Even with EL, there is still a fair amount of Java code in the JSP (again, undesirable for
web designers)

Show Applicant5.jsp, and show how tags have replace Java code AND the helper Bean

Explain that JSP Tag Libraries can be used to define new application-specific tags for our
JSPs

JSP comes with several standard tag libraries already built in (called the JSTL, for JSP
Standard Tag Libraries)
Examples c:choose, c:if

Show how to import a tag library

ApplicantListTag.java
ApplicantInfoTag.java
agency.tld (in the config directory)

Deploy tag library by including .class files in WAR, and then mapping taglib URI in
deploytool under the File Ref’s tab on the WAR file