The first block of executable code is a page directive that applies to the entire page and specifies the language of the page as Java and sets the MIME type and character encoding to use for the response:
<%@ page language="java"
Including tag library descriptor files
The next block of code is made up of taglib directives. These identify the names of the tag libraries associated with the page. They also identify the prefixes to use before tags from each library.
<%@ taglib | prefix="bean" %> |
<%@ taglib | prefix="html" %> |
<%@ taglib | prefix="logic" %> |
<%@ taglib | prefix="lms" %> |
Referencing Struts tags
The next line of code is an html tag from the
<html:html locale="true">
The value “true” in the locale attribute indicates to set the current locale for the user if needed. This prompts the servlet to retrieve the locale from the requesting browser. The value returned determines which
Localizing page content
The next group of tags makes up the head HTML tag. The META tag defines the character set to use for the HTTP response message header. In the next line, we see another JSP tag at work. The message tag in the lms tag library is programmed to retrieve the resource key specified in the key attribute from the .properties resource file and display it on the page. Since the content of the application.title resource key in the ApplicationResource.properties file for the LMM application contains the text, “IBM Lotus Learning Management System,” this is text that displays as the title on the adminTemplate page. See “Updating page text.”
<head>
<META
Including standard JSP actions
The next line of code is a standard JSP action called the getProperty tag. This tag and any others that have a jsp prefix are standard JSP actions and are available for use in all JSPs. See the JavaServer Pages 1.2 Specification downloadable from http://www.jcp.org/aboutJava/communityprocess/final/jsr053/for more details. The getProperty tag initializes a JavaBean, which is a reusable Java component, and retrieves a property from it.
Determining the user’s browser type and language preference
The property being requested, the “styleSheetLink” property, contains the name of the appropriate CSS file to apply to the page based on the type of browser that is submitting the user request.
<jsp:getProperty name="BrowserSniffer" property="styleSheetLink"/>
24 IBM Lotus Learning Management System Release 1 Customization Guide