Tag Library
To make coding of Pages easier, the AgileApps Cloud platform provides a set of custom JSP tags. Similar to JSTL (Java Standard Tag Library), these tags make development of pages easier and make a clear separation between View, business logic (Controller) and Model of a use case. Learn more: MVC (Model-View-Controller). To successfully use these tags, include a taglib directive in any Page used to build the Site.
- taglib Directive Syntax
- <%@taglib prefix="lj" uri="/LJTagLib"%>
- Available Tag Types
-
- HTML Tags
- Used to map to different HTML elements. These can be used standalone or can be enclosed within DetailData and Form tags. These tags Handle the View Part.
- Platform-specific Action Tags
- Used to map to server-side actions, and handle the Business Logic/Controller Part. Learn more: Included Server-Side Actions
- Platform-specific Data Tags
- Used to retrieve data from the server. These tags handle the Model Part.
- Miscellaneous tags
- Utility Tags to provide Utility.
HTML Tags
- 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}"/>
Action Tags
These tags directly map to various platform actions specified in the Actions section. These action tags render an HTML form element.
Common Attributes for Action Tags
All the action tags have some common attributes.
Common Attributes for Action Tags Attribute Type Description onError String Complete or partial relative URL to execute on error of the operation onSuccess String Complete or partial relative URL to execute on success of the operation method String maps to the HTML form element's method attribute name String Name of the HTML form element which is rendered as a result of this tag 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 specifically used for error handling.
Login and Registration Tags
Login tags and Registration tags have slightly different behavior:
- Registration tags - Allow the site user to register and login using a remote ID, like Facebook. When site users are already registered, they are automatically logged in. With this option, anyone can become a site user, and the only information available to the Site are the details captured in the remote registration process (at Facebook, for example).
- Login Tags - Allow the user to login using a remote ID, but require them to have registered with the site to do so. You can use that registration process to a) capture additional information from the user and/or, b) restrict access in some way (for example, to restrict access to an otherwise-public company payroll site).
Typically, you will choose to use either registration tags or login tags. But whichever style you choose, you will typically provide site users with multiple options so they can choose how they want to log in.
Note:
For Login tags to work, the user ID at the site must be identical to the remote user ID. One way to do that is simply to require the user to enter their ID, and trust that it will match. (Typically, it will, since a user's email address is the most common form of ID. Another, more "bulletproof" mechanism is to check to see if users are registered when they login. If they aren't, send them to the registration page with the user ID pre-filled. That mechanism is more complex, but doesn't depend on users' typing ability or memory.
Action Tag Description Syntax Facebook Registration Tag Let a site user register and login using their Facebook ID <lj:facebookregister onError="pages/home.jsp" onSuccess="pages/ticketList.jsp?fieldList=..." /> Facebook Login Tag Let a site user login using their Facebook ID, but require site registration <lj:facebooklogin onError="pages/home.jsp" onSuccess="pages/ticketList.jsp?fieldList=..." /> Login Tag Renders an HTML form element whose action attribute is assigned to the Login action <lj:login name="loginForm" onError="pages/login.jsp" onSuccess="pages/home.jsp" method="POST" id="loginForm"> Logout Tag Renders a URL which points to the Logout action <a href="<lj:logout />">Logout</a> Register Tag Renders an HTML form element whose action attribute is assigned to the Register User action <lj:register name="" onError="pages/register.jsp" onSuccess="pages/home.jsp" prefill="true" method="POST">
- Note for Self-Hosted Installations of the Platform
- In a self hosted installation of the Platform, additional setup is required to support registration and authentication using Facebook. The Administrator needs to set up a Facebook Application and configure details about the application in the platform.
- To set up a Facebook Application:
- Go to https://developers.facebook.com and create a new Application.
- Modify the Application to set the App Domain to point to your domain.
- Specify the Site URL in "Website with Facebook Login", so it points to your Domain URL
- Note the App ID and the App Secret
- To configure the platform:
- Update the Facebook App ID and the App Secret in the Platform using SQL:
- UPDATE relationals.NETWORK_GLOBAL_PROPERTIES
- SET facebook_app_id = 'facebook App ID' , facebook_app_secret='App Secret';
- UPDATE relationals.NETWORK_GLOBAL_PROPERTIES
- Update the Facebook App ID and the App Secret in the Platform using SQL:
Facebook Registration Tag
Generates a button that allows a site user to register and login using their Facebook ID. Users who are already registered with the Site are simply logged in.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <a href="<lj:facebookregister onError="pages/home.jsp" onSuccess="pages/ticketList.jsp?fieldList=number,type,subject&sortBy=number&sortOrder=desc&page=0&pageSize=25" />" > Login using Facebook</a>
Facebook Login Tag
Generates a button that allows a site user to login using their Facebook ID, but only if they are a registered site user.
- Requirement
-
- The Site user's username must be the same as their Facebook Email address.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <a href="<lj:facebooklogin onError="pages/home.jsp" onSuccess="pages/ticketList.jsp?fieldList=number,type,subject&sortBy=number&sortOrder=desc&page=0&pageSize=25" />" > Login using Facebook</a>
Login Tag
Renders an HTML form element whose action attribute is assigned to "login" action.
User is expected to supply all the form elements that are expected for this action. Refer to login action.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:login name="loginForm" onError="pages/login.jsp" onSuccess="pages/home.jsp" method="POST" id="loginForm"> <table border="0" cellspacing="0" cellpadding="5"> <tr> <td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} </td> </tr> <tr> <td align="left"><b>Username</b></td> <td align="left"><lj:text name="login" id="login" /></td> </tr> <tr> <td align="left"><b>Password</b></td> <td align="left"><lj:password name="password" id="password" /></td> </tr> <tr> <td align="right"><lj:button submit="true" name="submit" id="submit" value="Submit" /></td> <td align="left"><input type="button" name="cancel" value="Cancel" onClick="window.location='<lj:url resource="pages/home.jsp" />';" /></td> </tr> <tr> <td colspan="2" align="left"><a href="<lj:url resource="pages/forgot.jsp" />"> Forgot Your Password</a></td> </tr> </table> </lj:login>
Logout Tag
Renders a URL which points to the logout action.
User is expected to supply all the form elements that are expected for this action. Refer to logout action.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <a href="<lj:logout />">Logout</a>
Register Tag
Renders an HTML form element whose action attribute is assigned to "register" action.
User is expected to supply all the form elements that are expected for this action. Refer to register action.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:register name="" onError="pages/register.jsp" onSuccess="pages/home.jsp" prefill="true" method="POST"> <table width="100%" border="0" cellpadding="0" cellspacing="5"> <tr> <td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} </td> </tr> <tr> <td align="left"><b>First Name</b></td> <td align="left"><lj:text name="first_name" value="${first_name}"/> </td> </tr> <tr> <td align="left"><b>Last Name</b></td> <td align="left"><lj:text name="last_name" value="${last_name}"/></td> </tr> <tr> <td align="left"><b>Email</b></td> <td align="left"><lj:text name="email" value="${email}"/></td> </tr> <tr> <td align="left"><b>User Name</b></td> <td align="left"><lj:text name="username" value="${username}"/></td> </tr> <tr> <td align="left"><b>Password</b></td> <td align="left"><lj:password name="password"/></td> </tr> <tr> <td align="left"><b>Confirm Password</b></td> <td align="left"><lj:password name="password2"/></td> </tr> <tr> <td align="left"><b>Security Question</b></td> <td align="left"><lj:text name="custom_security_question" value="${custom_security_question}"/></td> </tr> <tr> <td align="left"><b>Security Answer</b></td> <td align="left"><lj:text name="security_answer" value="${security_answer}"/></td> </tr> <tr> <td align="right"><lj:button submit="true" name="submit" value="Register"/></td> <td align="left"><input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/></td> </tr> </table> </lj:register>
Other Action Tags
Action Tag Description Syntax Change Password Tag Renders an HTML form element whose action attribute is assigned to Change Password action <lj:changePassword name="" onError="pages/changePassword.jsp" onSuccess="pages/home.jsp"> Reset Password Tag Renders an HTML form element whose action attribute is assigned to Reset Password action <lj:resetPassword name="" onError="pages/resetPassword.jsp" onSuccess="pages/home.jsp"> Update Profile Tag Renders an HTML form element whose action attribute is assigned to Update Profile action <lj:updateProfile name="" onError="pages/updateProfile.jsp" onSuccess="pages/home.jsp" prefill="true"> Validate Security Question Tag Renders an HTML form element whose action attribute is assigned to the Validate the Security Question action. <lj:validateSecurityQuestion name="" onError="pages/secQuestion.jsp" onSuccess="pages/resetPassword.jsp" prefill="true">
Change Password Tag
Renders an HTML form element whose action attribute is assigned to "change_password" action.
User is expected to supply all the form elements that are expected for this action. Refer to changePassword action.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:changePassword name="" onError="pages/changePassword.jsp" onSuccess="pages/home.jsp"> <table cellpadding="5" cellspacing="0"> <tr> <td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} </td> </tr> <tr> <td align="left"><b>Old Password</b></td> <td align="left"><lj:password name="old_password" value=""/> </td> </tr> <tr> <td align="left"><b>New Password</b></td> <td align="left"><lj:password name="password" /></td> </tr> <tr> <td align="left"><b>Confirm Password</b></td> <td align="left"><lj:password name="password2" /></td> </tr> <tr> <td align="right"><lj:button submit="true" name="submit" value="Change"/></td> <td align="left"><input type="button" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/></td> </tr> </table> </lj:changePassword>
Reset Password Tag
Renders an HTML form element whose action attribute is assigned to "reset_password" action.
User is expected to supply all the form elements that are expected for this action. Refer to Reset Password action.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:resetPassword name="" onError="pages/resetPassword.jsp" onSuccess="pages/home.jsp"> <table cellpadding="5" cellspacing="0"> <tr> <td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} </td> </tr> <tr> <td align="left"><b>New Password</b></td> <td align="left" width="50%"><lj:password name="password" /></td> </tr> <tr> <td align="left"><b>New Password Again</b></td> <td align="left" width="50%"><lj:password name="password2" /></td> </tr> <tr> <td align="right"><lj:button submit="true" name="submit" value="Reset" /></td> <td align="left" width="50%"><input type="button" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/login.jsp"/>'; return false;"/></td> </tr> </table> </lj:resetPassword>
Update Profile Tag
Renders an HTML form element whose action attribute is assigned to "update_profile" action.
User is expected to supply all the form elements that are expected for this action. Refer to Update Profile action.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:updateProfile name="" onError="pages/updateProfile.jsp" onSuccess="pages/home.jsp" prefill="true"> <table border="0" cellpadding="0" cellspacing="5"> <lj:detailData object="USER_PROFILE" controller="Platform" recordVariable="profile"> <tr> <td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} </td> </tr> <tr> <td align="left"><b>First Name</b></td> <td align="left"><lj:text name="first_name" value="${profile.parameters.first_name}" /> </td> </tr> <tr> <td align="left"><b>Last Name</b></td> <td align="left"><lj:text name="last_name" value="${profile.parameters.last_name}" /> </td> </tr> <tr> <td align="left"><b>Email</b></td> <td align="left"><lj:text name="email" value="${profile.parameters.email}" /> </td> </tr> <tr> <td align="left"><b>Street</b></td> <td align="left"><lj:text name="street" value="${profile.parameters.street}" /> </td> </tr> <tr> <td align="left"><b>City</b></td> <td align="left"><lj:text name="city" value="${profile.parameters.city}" /> </td> </tr> <tr> <td align="left"><b>State</b></td> <td align="left"><lj:text name="state" value="${profile.parameters.state}" /> </td> <tr> <td align="left"><b>Zip</b></td> <td align="left"><lj:text name="zip" value="${profile.parameters.zip}" /> </td> </tr> <tr> <td align="left"><b>Country</b></td> <td align="left"><lj:text name="country" value="${profile.parameters.country}" /> </td> </tr> <tr> <td align="left"><b>Company</b></td> <td align="left"><lj:text name="company" value="${profile.parameters.company}" /> </td> </tr> <tr> <td align="left"><b>Title</b></td> <td align="left"><lj:text name="title" value="${profile.parameters.title}" /> </td> </tr> <tr> <td align="left"><b>Division</b></td> <td align="left"><lj:text name="division" value="${profile.parameters.division}" /> </td> <tr> <td align="left"><b>Phone</b></td> <td align="left"><lj:text name="phone" value="${profile.parameters.phone}" /> </td> </tr> <tr> <td align="left"><b>Fax</b></td> <td align="left"><lj:text name="fax" value="${profile.parameters.fax}" /> </td> </tr> <tr> <td align="left"><b>Mobile</b></td> <td align="left"><lj:text name="mobile" value="${profile.parameters.mobile}" /> </td> </tr> <tr> <td align="left"><b>Security Question</b></td> <td align="left"><lj:text name="custom_security_question" value="${profile.parameters.custom_security_question}" /> </td> </tr> <tr> <td align="left"><b>Security Answer</b></td> <td align="left"><lj:text name="security_answer" value="${profile.parameters.security_answer}" /> </td> </tr> </lj:detailData> <tr> <td align="right"><lj:button submit="true" name="submit" value="Update" /></td> <td align="left"><input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/></td> </tr> </table> </lj:updateProfile>
Validate Security Question Tag
Renders an HTML form element whose action attribute is assigned to "validate_security_question" action.
User is expected to supply all the form elements that are expected for this action. Refer to Validate Security Question action.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:validateSecurityQuestion name="" onError="pages/secQuestion.jsp" onSuccess="pages/resetPassword.jsp" prefill="true"> <table border="0" cellpadding="5" cellspacing="0"> <tr> <td colspan="2" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} </td> <td> </td> </tr> <lj:detailData object="USER_PROFILE" controller="Platform" recordVariable="user" recordId="${param['username']}"> <tr> <td ${empty user ? "" : (user.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty user ? "" : user.message} </td> </tr> <tr> <td align="left"><b>Username</b></td> <td align="left">${user.parameters.username}<lj:hidden name="username" value="${user.parameters.username}"/></td> </tr> <tr> <td align="left"><b>Security Question</b></td> <td align="left">${user.parameters.custom_security_question} <lj:hidden name="custom_security_question" value="${user.parameters.custom_security_question}"/></td> </tr> <tr> <td align="left"><b>Security Answer</b></td> <td align="left"><lj:text name="security_answer" value="${security_answer}"/></td> </tr> <tr> <td align="right"><lj:button submit="true" name="submit" value="Submit"/></td> <td align="left"><input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/login.jsp"/>'; return false;"/></td> </tr> </lj:detailData> </table> </lj:validateSecurityQuestion>
Data Tags
Platform specific Data Tags. These map to the Java APIs getRecord (for getting a single record by Id) and searchRecords (for getting a collection of records for a search criteria, with paging support) calls. These tags have some common attributes that are specified below.
Common attributes for data tags
Attribute Type Description object String id or name of the user defined object fieldList String A comma-separated list with the names of fields to retrieve. controller String If value is "Platform", platform will retrieve the values in a data structure. Any other value will be treated as a user written controller class. controllerMethod String The controller method to execute. (Required when using a custom controller.) name String Name of the HTML form element which is rendered as a result of this tag. onError String Relative URL to execute on error of the operation. onSuccess String Relative URL to execute on success of the operation. 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 specifically used for error handling. recordVariable String PageContext variable name. The result of the execution of controller (Platform/User Written) is returned as this PageContext variable. In case of Platform controller, the result object is always an instance of Result Class from Java API. arg1 - arg10 String 10 Custom arguments that you can pass from the JSP to the controller. Especially useful when you are handling the data retrieval part using custom Controllers.
- Considerations
-
- The following reserved words cannot be used as the name of the recordVariable:
applicationScope cookie header headerValues initParam
pageContext pageScope param paramValues request
requestScope response servletContext session sessionScope
- Learn more: Implicit Objects in JSP expressions.
Available Data Tags
Action Tag Description Syntax Detail Data Tag Retrieves a single record from the database for an object <lj:detailData controller="Platform" object="ticket" recordId="${empty param.id? \"-1\" : param.id}" List Data Tag Retrieves a list of records from the database for an object <lj:listData object="jobPost" controller="JobController" controllerMethod="search" arg1="${param.search}"
Detail Data Tag
Retrieves a single record from the database Can be used standalone, or with a form tag to pre-populate some fields.
Attribute Type Description recordId String Id of the record being retrieved from the Platform.
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:form action="${empty param.action ? \"add\" : param.action}" controller="Platform" object="ticket" onSuccess="pages/ticketList.jsp" onError="pages/ticket.jsp" prefill="true" method="POST"> <lj:detailData controller="Platform" object="ticket" recordId="${empty param.id? \"-1\" : param.id}" recordVariable="ticket" fieldList="subject,description,type,status"> <table border="0" cellspacing="0" cellpadding="5"> <tr><td ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} </td></tr> <input type="hidden" name="id" value="${empty param.id ? "-1" : param.id}" /> <tr> <td align="right" valign="top"><b>Subject</b></td> <td align="left"><lj:text name="subject" id="subject" size="50" value="${ticket.parameters.subject}"/></td> </tr> <tr> <td align="right" valign="top"><b>Description</b></td> <td align="left"><lj:textArea name="description" cols="50" rows="3" id="description" value="${ticket.parameters.description}"/></td> </tr> <tr> <td align="right" valign="top"><b>Type</b></td> <td align="left"> <lj:select name="type" id="Type"> <lj:option value="fr" source="${ticket.parameters.type}" displayValue="Feature Request" /> <lj:option value="ti" source="${ticket.parameters.type}" displayValue="Technical Issue" /> <lj:option value="tq" source="${ticket.parameters.type}" displayValue="Technical Question" /> <lj:option value="bi" source="${ticket.parameters.type}" displayValue="Billing Issue" /> <lj:option value="bq" source="${ticket.parameters.type}" displayValue="Billing Question" /> <lj:option value="ot" source="${ticket.parameters.type}" displayValue="Other" /> </lj:select> </td> </tr> <lj:hidden name="status" id="status" value="${empty ticket.parameters.status ? \"ne\" : ticket.parameters.status}" /> <tr> <td align="right"> ${(empty param.action || param.action == "view")? "" : "<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Submit\" />" } </td> <td align="left"><input type="button" name="cancel" value="Cancel" onClick="window.location = '<lj:url resource="pages/ticketList.jsp"/>?fieldList=number,type,subject,status,date_modified,description&sortBy=number&sortOrder=desc&page=0&pageSize=25';" /></td> </tr> </table> </lj:detailData> </lj:form>
List Data Tag
Retrieves a list of records from the database for a Platform object. This tag acts as a loop. It gives an implicit variable "loopIndex" which acts as the loop index/counter.
Attribute Type Description filter String A filter to get records from the platform. Please see Filter Language. page Integer Number of the page/offset required for paging of records. Default is 0 (which is the first page) pageSize Integer Size of the page required for paging of records. Default is taken from ISV settings. sortBy String Name of the field to sort the data first. sortBy2 String Name of the field to sort the data second. sortOrder String Sort order for the sortBy field. Possible values are asc/desc sortOrder2 String Sort order for the sortBy2 field. Possible values are asc/desc
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:listData object="jobPost" controller="com.platform.{namespace}.{package}.{ControllerClass}" controllerMethod="search" arg1="${param.search}" recordVariable="jobPost" page="<%=pageNum%>" pageSize="<%=pageSize%>"> <tr> <td valign="top"> <a href='<lj:url resource="pages/jbPost.jsp"/>?id=${jobPost.record_id}&search=${param.search}'>${jobPost.jrNumber}</a></td> <td valign="top"> <a href='<lj:url resource="pages/jbPost.jsp"/>?id=${jobPost.record_id}&search=${param.search}'>${jobPost.title}</a></td> <td valign="top">${jobPost.location}</td> <td valign="top">${jobPost.date_created}</td> <td valign="top">${jobPost.description}</td> </tr> </lj:listData>
Utility Tags
Message Tag
Retrieves custom label or message from Translation Workbench's Custom Label elements. User can specify up to 10 arguments. Attributes
Attribute Type Description key String Key of the message/label from the Translation Workbench arg1 String First argument if needed for the key from Translation Workbench arg2 String Second argument if needed for the key from Translation Workbench arg3 String Third argument if needed for the key from Translation Workbench arg4 String Fourth argument if needed for the key from Translation Workbench arg5 String Fifth argument if needed for the key from Translation Workbench arg6 String Sixth argument if needed for the key from Translation Workbench arg7 String Seventh argument if needed for the key from Translation Workbench arg8 String Eighth argument if needed for the key from Translation Workbench arg9 String Ninth argument if needed for the key from Translation Workbench arg10 String Tenth argument if needed for the key from Translation Workbench
- Example
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:message key="#user.login_attempts" arg1="${attempts}" />
URL Tag
Forms a URL from the resource given. The URL points to the User given site address. If site address is not present, it points to the default Web Address.
Attribute Type Description type String if type is blank or not populated, resource tag is assumed to be either pages or a controller link, otherwise if type="FILE", download_file action is rendered with id=[resource attribute value] resource String if type is blank, it forms a URL by concatenating Base URL and the value of resource attribute. if type is "FILE", URL is formed by concatenating Base URL and string "download_file" for download_file action.
- Examples
- Used in an anchor <a> tag
<a href="<lj:url resource="pages/jbSearchResults.jsp"/>?search=${param.search}">Back to List</a>
- Used in a JavaScript event
<input type="button" name="cancel" value="Cancel" onClick="window.location='<lj:url resource="pages/home.jsp" />';" />
- Used for downloading a file. Note resource is pointing to a documentId.
<a href="<lj:url type="FILE" resource="<%=documentId%>" />" target="_blank">More info</a>