If no value attribute were supplied, the hidden input tag would retrieve a value for the destination property from the form Bean.

The following lms:hidden tag, which is used in the catalogCourseMasterDetail.jsp keeps a copy of the current form’s keywords in the form Bean by supplying values for the name and property attributes.

<lms:hidden name="<%=formName%>" property="unmodifiedKeywords" />

This is useful because, if a user encounters an error or otherwise leaves the form temporarily, the keywords can be repopulated with the values saved in the form Bean.

The following lms:hidden tag, which is used in the catalogCreateCourseConfirm.jsp, creates an HTML hidden input tag that captures the userEvent property.

<lms:hidden property="userEvent" />

This property can be modified by JavaScript triggered by user actions. For instance, JavaScript in the catalogTrailHeader.jsp, which is included in the catalogCreateCourseConfirm.jsp, can reassign a value to the userEvent property when a user clicks a button to initiate a new event.

Removing JSP tags

You can remove a JSP tag from a JavaServer Page by deleting the tag and its associated HTML formatting tags from the page. Removing JSP tags does not only remove elements like buttons and fields from the page, but also removes associated functionality. For example, if you want to remove the ability for users to add custom fields to a Course Details page, you can eliminate the labels, fields and buttons that support this functionality.

The JSP that represents the Course Catalog>Register Course Entry>Course>Course Master>Course Details page in the Administrator interface is the catalogCourseEntryDetails.jsp. This page contains code that displays a popup window in which you can add, delete, or edit custom fields. The source code resides in the WEB-INF>classes>resources>lmm> catalogCourseEntryDetails.jsp directory and begins at line 167 with the following commented out text:

<%--

//////////////////////////////////////

//custom fields

//////////////////////////////////////

--%>

The section of code that displays the Custom Fields section of the page ends with line 283, which contains the code:

</logic:iterate>

Removing the 115 lines of code between these two points removes the “Custom Fields” section header, the Edit button with its Custom Fields label, and the list of existing custom fields from the Course Details page.

The Custom Field Header section of the code uses an lms:message tag to reference the appropriate .properties file to supply the header label:

<lms:message key="catalog.createEntry.details.customFieldDetails"/>

The next section of code, Manage Custom Fields, uses the lms:message tag to supply the text in the customFields resource key of the appropriate .properties file and the lms:label tag to situate the label in the correct place on the page:

<lms:label for="customFields"><lms:message key="catalog.attrib.course.customFields"/></lms:label>

It then includes an lms:button tag. This tag displays a button on the page. The “captionKey” attribute defines the text to display as a label on the button by retrieving the button.edit resource

Chapter 5: Customizing JavaServer Pages 41

Page 46
Image 46
IBM R1 manual Removing JSP tags, Lmshidden name=%=formName% property=unmodifiedKeywords, Lmshidden property=userEvent