Referencing the url tag in a JSP

The following code is excerpted from the catalogManageCurriculumEntryManage.jsp:

<script language="javascript"> function openUserSearchPopup()

{

var href = "<lms:url>/searchUserPopup.do?formName=<%= formName %></lms:url>";

<lms:window href="href" title="UserSearch" width="600" height="700" scrollbars="true" resizable="true" />

}

</script>

When called, the openUserSearchPopup() script opens a popup window and populates it with the searchUserPopup JSP, which displays a standard search form. The searchUser.jsp file, which is included in the searchUserPopup.jsp file contains the following code:

String formName = request.getParameter("formName");

This code sets a new variable called formName equal to the formName variable passed to it from the lms:url tag. Essentially, the lms:url tag is formatting the text in its body as a valid URL, which is passed to the lms:window tag as the content of its href attribute. The lms:window tag does the work of opening a window and displaying the content referenced by the URL.

Defining the url tag in the TLD file

The following XML-formatted text is an excerpt from the lms.tld:

<tag>

<name>url</name>

<tagclass>com.lotus.elearn.taglib.UrlTag</tagclass>

<bodycontent>Jsp</bodycontent>

<attribute>

<name>encodeURL</name>

<required>false</required>

<rtexprvalue>false</rtexprvalue>

</attribute>

<attribute>

<name>useCustomDsPath</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

<attribute>

<name>useCustomLmmPath</name>

<required>false</required>

<rtexprvalue>true</rtexprvalue>

</attribute>

<attribute>

<name>id</name>

<required>false</required>

Chapter 5: Customizing JavaServer Pages 21

Page 26
Image 26
IBM R1 manual Referencing the url tag in a JSP, String formName = request.getParameterformName