AgileApps Support Wiki Pre Release

HTML Tags

From AgileApps Support Wiki
About HTML Tags
All HTML form element tags e.g. Button Tag, Text tag etc. have some common attributes. These attributes apply to all HTML element tags, unless specified otherwise. All attribute names follow the CamelCase/Hungarian notation.

Common Attributes for HTML Tags

Common Attributes for all HTML form element tags
Tag Type Description
alt String alt attribute applicable to the element
accessKey String accessKey attribute applicable to the element
altKey String altKey attribute applicable to the element
disabled Boolean Disables the element. Accepts true/false as the input
id String id of the element
name String name of the element
onBlur String maps to the JavaScript onBlur event of the element
onChange String maps to the JavaScript onChange event of the element
onClick String maps to the JavaScript onClick event of the element
onDblClick String maps to the JavaScript onDblClick event of the element
onFocus String maps to the JavaScript onFocus event of the element
onKeyDown String maps to the JavaScript onKeyDown event of the element
onKeyPress String maps to the JavaScript onKeyPress event of the element
onKeyUp String maps to the JavaScript onKeyUp event of the element
onMouseDown String maps to the JavaScript onMouseDown event of the element
onMouseMove String maps to the JavaScript onMouseMove event of the element
onMouseOut String maps to the JavaScript onMouseOut event of the element
onMouseOver String maps to the JavaScript onMouseOver event of the element
onMouseUp String maps to the JavaScript onMouseUp event of the element
readOnly Boolean Make the element read only
style String maps to the style attribute of the element
styleClass String maps to the class attribute of the element
tabIndex String maps to the tabIndex attribute of the element
title String maps to the title attribute of the element
value String maps to the value attribute of the element

Available HTML Tags

HTML Tag Description Syntax
Base Tag Renders the HTML BASE tag with HREF pointing to the Base URL <lj:base />
Button Tag Used to render the input submit element or the HTML button element <lj:button submit="true" name="Find Jobs" id="Find Jobs" value="Find Jobs" />
CheckBox Tag Used to render the HTML Checkbox element

How many siblings do you have?

1<lj:checkbox name="siblings" id="siblings" value="1" source="1,2,3" checked="${siblings}"/>

2<lj:checkbox name="siblings" id="siblings" value="2" source="1,2,3" checked="${siblings}"/>

3<lj:checkbox name="siblings" id="siblings" value="3" source="1,2,3" checked="${siblings}"/>

Form Tag Used to render the HTML form element

<lj:form object="jobApplication"

onSuccess="pages/jbPost.jsp?id=${param.id}&search=${param.search}"

onError="pages/jbPost.jsp?id=${param.id}&search=${param.search}" />

Hidden Tag Used to render the HTML input type hidden element <lj:hidden name="jobPost" value="${param.id}" />
Include Tag Used to include a Page <lj:include file="${_page}" /> in a Site template

<lj:include file="pages/{pagename}" /> in other pages
    (where pagename includes ".jsp")

Option Tag Used to render the HTML option element, and should be used with the Select Tag as the parent tag

<lj:select name="state" id="state">

<lj:option value="AL" source="${state}" displayValue="AL" />

<lj:option value="AK" source="${state}" displayValue="AK" />

...

...

</lj:select>

Password Tag Used to render the HTML input type password element <lj:password name="password" id="password" />
Radio Tag Used to render the HTML input type radio element

Yes <lj:radio name="isAvailable" id="isAvailable" value="yes" source="yes,no" checked="${isAvailable}"/>

No <lj:radio name="isAvailable" id="isAvailable" value="no" source="yes,no" checked="${isAvailable}"/>

Select Tag Used to render the HTML select element, and should be used with the Option Tag

<lj:select name="state" id="state">

<lj:option value="AL" source="${state}" displayValue="AL" />

<lj:option value="AK" source="${state}" displayValue="AK" />

...

...

</lj:select>

TextArea Tag Used to render the HTML text area element <lj:textArea name="resume" id="resume" cols="45" rows="15" value="${resume}"/>
TextField Tag Used to render the HTML input type text element <lj:text name="city" id="city" size="15" value="${city}"/>
File Tag Used to render the HTML file input element <lj:file name="attachment" id="attachment" size="15" value="${attachment}"/>
Base Tag

Used to render the HTML Base element. It prints out user's web address as specified in the field "Your Web Address" property on Site Management Screen.

Attributes
None
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:base />

The above code snippet will render the HTML BASE tag with HREF pointing to the User Web Address of the Site.

Button Tag

Used to render the input submit element or the HTML button element.

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
submit Boolean true value renders <input type="submit"> element, otherwise it renders an HTML <button> element
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:button submit="true" name="Find Jobs" id="Find Jobs" value="Find Jobs" />

This will render an HTML <input type="submit"> element.

CheckBox Tag

Used to render the HTML checkbox element

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
checked Boolean true value renders marks the checkbox as checked, otherwise it is not marked.
source String a comma separated string of all possible values.
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
How many siblings do you have? <BR/>
1<lj:checkbox name="siblings" id="siblings" value="1" source="1,2,3" checked="${siblings}"/>
2<lj:checkbox name="siblings" id="siblings" value="2" source="1,2,3" checked="${siblings}"/>
3<lj:checkbox name="siblings" id="siblings" value="3" source="1,2,3" checked="${siblings}"/>

Note the use of JSP's Expressions Language syntax ${siblings}

Form Tag

Used to render the HTML form element.

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
action String One of add/update/delete
controller String Specifies which controller will handle this form. If the value is "Platform", Platform will handle the action, otherwise it will assume that it is a user written controller class and forward the request to the controller class
object String Object name or id to take the action on
onSuccess String A URL or a relative URL to go to on success of the operation.
onError String A URL or a relative URL to go to on error of the operation.
method String Maps to the method attribute of HTML form element.
name String maps to HTML form element name attribute
preController String Name of the class whose method is executed before the controller is executed
preControllerMethod String Method of the class identified by preController, that is executed before the controller is executed. Useful in validations or some pre actions when controller is Platform.
prefill Boolean Specifies whether the values should be prefilled for the form elements within this form. Prefill logic first looks at the HttpServletRequest.getParameter("form element"), if the value is present it will render it from there, otherwise it will take it from the value attribute of the form element. This is typically useful in case an error happens and you want to show user entered input.
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:form object="jobApplication" onSuccess="pages/jbPost.jsp?id=${param.id}&search=${param.search}" onError="pages/jbPost.jsp?id=${param.id}&search=${param.search}"
        action="add" controller="com.platform.{namespace}.{package}.JobApplicationController" 
        prefill="true" method="POST">
	<table>
	<tr>
		<td ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2">
      ${empty __response ? "" : __response.message}
		</td>
	<tr>
  ...
  ...
	<tr>
		<td align="right" valign="top"><strong>Phone Number</strong></td>
		<td>
      <lj:text name="phoneNumber" id="phoneNumber" size="15" value="${phoneNumber}"/>
		</td>
	</tr>
	<tr>
		<td align="right" valign="top"><strong>City, State, ZIP</strong></td>
<lj:text name="city" id="city" size="15" value="${city}"/>
	<label>
		<lj:select name="state" id="state">
		<lj:option value="AL" source="${state}" displayValue="AL" />
		<lj:option value="AK" source="${state}" displayValue="AK" />
		<lj:option value="AS" source="${state}" displayValue="AS" />
		<lj:option value="AZ" source="${state}" displayValue="AZ" />
		<lj:option value="AR" source="${state}" displayValue="AR" />
		<lj:option value="CA" source="${state}" displayValue="CA" />
		<lj:option value="CO" source="${state}" displayValue="CO" />
		<lj:option value="CT" source="${state}" displayValue="CT" />
		</lj:select>
    </label>
	</tr>
	<tr>
		<td align="right" valign="top"><strong>Please paste text<br />resume here</strong></td>
		<td>
		<label><lj:textArea name="resume" id="resume" cols="45" rows="15" value="${resume}"/></label>
		</td>
	</tr>
	<tr>
		<td><lj:button submit="true" name="Submit Resume" id="Submit Resume" value="Submit Resume" /></td>
		<td><lj:button submit="false" name="Cancel" id="Cancel" value="Cancel" onClick="showHide(document.getElementById('application'));return false;"/></td>
	</tr>
</lj:form>
Hidden Tag

Used to render the HTML input type hidden element

Attributes
Common Attributes for HTML Tags are available
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:hidden name="jobPost" value="${param.id}" />
Include Tag

This tag has two uses:

  • It is used in a Site Template (a wrapper page) to indicate where to include the content of the page being visited.
  • It is used to include another JSP page stored on the platform. In that case, it can help to organize your pages. For example, common libraries can be declared on a single page--say, common.jsp. If that page is included everywhere, a new library can be added to every page simply by declaring in the common page.
Attributes
Tag Type Description
file String Specifies the content to include:
  • ${_page} in a Site Template
  • pages/{pageName} in other pages, where pagename includes ".jsp"
Examples
Usage in a Site Template
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:include file="${_page}" />
${_page} is dynamically replaced by the content of the page that is being visited.
Usage in other pages
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:include file="pages/jbSearch.jsp" />
jbSearch.jsp is now included in the page.
Option Tag

Used to render the HTML option element. Should be used with the SelectTag as the parent tag.

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
displayValue String Value to be displayed for this option.
selected Boolean Specifies whether this option should be marked selected.
source Boolean a comma separated string of all possible values.
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
	<lj:select name="state" id="state">
	<lj:option value="AL" source="${state}" displayValue="AL" />
	<lj:option value="AK" source="${state}" displayValue="AK" />
	<lj:option value="AS" source="${state}" displayValue="AS" />
	<lj:option value="AZ" source="${state}" displayValue="AZ" />
	<lj:option value="AR" source="${state}" displayValue="AR" />
	<lj:option value="CA" source="${state}" displayValue="CA" />
	<lj:option value="CO" source="${state}" displayValue="CO" />
	<lj:option value="CT" source="${state}" displayValue="CT" />
	...
	...
	</lj:select>
Password Tag

Used to render the HTML input type password element.

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
size Integer Size of the password element. Maps to the size attribute of HTML password element
maxLength Integer maxLength of the password element. Maps to the maxLength attribute of HTML password element
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<tr>
	<td align="left"><b>Password</b></td>
	<td align="left"><lj:password name="password" id="password" /></td>
</tr>
Radio Tag

Used to render the HTML input type radio element.

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
checked Boolean Specifies whether this radio button is checked or not
source String A comma separated list of all possible values for this radio button group
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
Yes <lj:radio name="isAvailable" id="isAvailable" value="yes" source="yes,no" checked="${isAvailable}"/>
No <lj:radio name="isAvailable" id="isAvailable" value="no" source="yes,no" checked="${isAvailable}"/>
Select Tag

Used to render the HTML select element. Should be used with the OptionTag

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
size String Size of this select element. Default is 1, which signifies a drop down. Otherwise a list is rendered.
multiple Boolean Specifies whether this select element can have multiple selections at a time.
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
	<lj:select name="state" id="state">
	<lj:option value="AL" source="${state}" displayValue="AL" />
	<lj:option value="AK" source="${state}" displayValue="AK" />
	<lj:option value="AS" source="${state}" displayValue="AS" />
	<lj:option value="AZ" source="${state}" displayValue="AZ" />
	<lj:option value="AR" source="${state}" displayValue="AR" />
	<lj:option value="CA" source="${state}" displayValue="CA" />
	<lj:option value="CO" source="${state}" displayValue="CO" />
	<lj:option value="CT" source="${state}" displayValue="CT" />
	...
	...
	</lj:select>
TextArea Tag

Used to render the HTML textarea element

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
rows String row size of the HTML TextArea Element
cols String cols size of the HTML TextArea Element
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:textArea name="resume" id="resume" cols="45" rows="15" value="${resume}"/>
TextField Tag

Used to render the HTML input type text element

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
size Integer Size of the text element. Maps to the size attribute of HTML text element
maxLength Integer maxLength of the text element. Maps to the maxLength attribute of HTML text element
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:text name="city" id="city" size="15" value="${city}"/>
File Tag

Used to render the HTML file input element. Note that the form's "encType" attribute should be "multipart/form-data" for proper handling of the file element.

Attributes
In addition to Common Attributes for HTML Tags, the following attributes are available:
Tag Type Description
accept String Maps to the accept attribute of HTML input file element.
size Integer Maps to the size attribute of HTML input file element.
Example
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:file name="attachment" id="attachment" size="15" value="${attachment}"/>