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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:base /> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:button submit="true" name="Find Jobs" id="Find Jobs" value="Find Jobs" /> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%>
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}"/>
</syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@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"><td ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} ... ...
<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></lj:form> </syntaxhighlight>
Hidden Tag
Used to render the HTML input type hidden element
- Attributes
- Common Attributes for HTML Tags are available
- Example
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:hidden name="jobPost" value="${param.id}" /> </syntaxhighlight>
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
Phone Number |
<lj:text name="phoneNumber" id="phoneNumber" size="15" value="${phoneNumber}"/> |
City, State, ZIP | |
Please paste text resume here |
<label><lj:textArea name="resume" id="resume" cols="45" rows="15" value="${resume}"/></label> |
<lj:button submit="true" name="Submit Resume" id="Submit Resume" value="Submit Resume" /> | <lj:button submit="false" name="Cancel" id="Cancel" value="Cancel" onClick="showHide(document.getElementById('application'));return false;"/> |
Tag | Type | Description |
---|---|---|
file | String | Specifies the content to include:
|
- Examples
- Usage in a Site Template
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:include file="${_page}" /> </syntaxhighlight>
- ${_page} is dynamically replaced by the content of the page that is being visited.
- Usage in other pages
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:include file="pages/jbSearch.jsp" /> </syntaxhighlight>
- 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
- <syntaxhighlight lang="java" enclose="div">
<%@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> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%>
Password <lj:password name="password" id="password" /> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@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}"/> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@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> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:textArea name="resume" id="resume" cols="45" rows="15" value="${resume}"/> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:text name="city" id="city" size="15" value="${city}"/> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:file name="attachment" id="attachment" size="15" value="${attachment}"/> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:login name="loginForm" onError="pages/login.jsp" onSuccess="pages/home.jsp" method="POST" id="loginForm">
<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message}Username | <lj:text name="login" id="login" /> |
Password | <lj:password name="password" id="password" /> |
<lj:button submit="true" name="submit" id="submit" value="Submit" /> | <input type="button" name="cancel" value="Cancel" onClick="window.location='<lj:url resource="pages/home.jsp" />';" /> |
<a href="<lj:url resource="pages/forgot.jsp" />"> Forgot Your Password</a> |
</lj:login> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <a href="<lj:logout />">Logout</a> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:register name="" onError="pages/register.jsp" onSuccess="pages/home.jsp" prefill="true" method="POST">
<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message}First Name | <lj:text name="first_name" value="${first_name}"/> |
Last Name | <lj:text name="last_name" value="${last_name}"/> |
<lj:text name="email" value="${email}"/> | |
User Name | <lj:text name="username" value="${username}"/> |
Password | <lj:password name="password"/> |
Confirm Password | <lj:password name="password2"/> |
Security Question | <lj:text name="custom_security_question" value="${custom_security_question}"/> |
Security Answer | <lj:text name="security_answer" value="${security_answer}"/> |
<lj:button submit="true" name="submit" value="Register"/> | <input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/> |
</lj:register> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:changePassword name="" onError="pages/changePassword.jsp" onSuccess="pages/home.jsp">
<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message}Old Password | <lj:password name="old_password" value=""/> |
New Password | <lj:password name="password" /> |
Confirm Password | <lj:password name="password2" /> |
<lj:button submit="true" name="submit" value="Change"/> | <input type="button" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/> |
</lj:changePassword> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%>
<lj:resetPassword name="" onError="pages/resetPassword.jsp" onSuccess="pages/home.jsp">
<td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message}New Password | <lj:password name="password" /> |
New Password Again | <lj:password name="password2" /> |
<lj:button submit="true" name="submit" value="Reset" /> | <input type="button" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/login.jsp"/>'; return false;"/> |
</lj:resetPassword> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:updateProfile name="" onError="pages/updateProfile.jsp" onSuccess="pages/home.jsp" prefill="true">
<lj:detailData object="USER_PROFILE" controller="Platform" recordVariable="profile"> <td class="side-link" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} </lj:detailData>First Name | <lj:text name="first_name" value="${profile.parameters.first_name}" /> |
Last Name | <lj:text name="last_name" value="${profile.parameters.last_name}" /> |
<lj:text name="email" value="${profile.parameters.email}" /> | |
Street | <lj:text name="street" value="${profile.parameters.street}" /> |
City | <lj:text name="city" value="${profile.parameters.city}" /> |
State | <lj:text name="state" value="${profile.parameters.state}" /> |
Zip | <lj:text name="zip" value="${profile.parameters.zip}" /> |
Country | <lj:text name="country" value="${profile.parameters.country}" /> |
Company | <lj:text name="company" value="${profile.parameters.company}" /> |
Title | <lj:text name="title" value="${profile.parameters.title}" /> |
Division | <lj:text name="division" value="${profile.parameters.division}" /> |
Phone | <lj:text name="phone" value="${profile.parameters.phone}" /> |
Fax | <lj:text name="fax" value="${profile.parameters.fax}" /> |
Mobile | <lj:text name="mobile" value="${profile.parameters.mobile}" /> |
Security Question | <lj:text name="custom_security_question" value="${profile.parameters.custom_security_question}" /> |
Security Answer | <lj:text name="security_answer" value="${profile.parameters.security_answer}" /> |
<lj:button submit="true" name="submit" value="Update" /> | <input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/home.jsp"/>'; return false;"/> |
</lj:updateProfile> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:validateSecurityQuestion name="" onError="pages/secQuestion.jsp" onSuccess="pages/resetPassword.jsp" prefill="true">
<td colspan="2" ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} <lj:detailData object="USER_PROFILE" controller="Platform" recordVariable="user" recordId="${param['username']}"> <td ${empty user ? "" : (user.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty user ? "" : user.message} </lj:detailData>Username | ${user.parameters.username}<lj:hidden name="username" value="${user.parameters.username}"/> |
Security Question | ${user.parameters.custom_security_question} <lj:hidden name="custom_security_question" value="${user.parameters.custom_security_question}"/> |
Security Answer | <lj:text name="security_answer" value="${security_answer}"/> |
<lj:button submit="true" name="submit" value="Submit"/> | <input type="submit" name="button2" id="button2" value="Cancel" onclick="window.location='<lj:url resource="pages/login.jsp"/>'; return false;"/> |
</lj:validateSecurityQuestion> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@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"><td ${empty __response ? "" : (__response.code < 0 ? "style=\"color:red\"" : "")} colspan="2"> ${empty __response ? "" : __response.message} <input type="hidden" name="id" value="${empty param.id ? "-1" : param.id}" /> <lj:hidden name="status" id="status" value="${empty ticket.parameters.status ? \"ne\" : ticket.parameters.status}" />
Subject | <lj:text name="subject" id="subject" size="50" value="${ticket.parameters.subject}"/> |
Description | <lj:textArea name="description" cols="50" rows="3" id="description" value="${ticket.parameters.description}"/> |
Type |
<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> |
${(empty param.action || param.action == "view")? "" : "<input type=\"submit\" name=\"submit\" id=\"submit\" value=\"Submit\" />" } |
<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';" /> |
</lj:detailData>
</lj:form> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@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%>">
<a href='<lj:url resource="pages/jbPost.jsp"/>?id=${jobPost.record_id}&search=${param.search}'>${jobPost.jrNumber}</a> <a href='<lj:url resource="pages/jbPost.jsp"/>?id=${jobPost.record_id}&search=${param.search}'>${jobPost.title}</a> ${jobPost.location} ${jobPost.date_created} ${jobPost.description} </lj:listData> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<%@taglib prefix="lj" uri="/LJTagLib"%> <lj:message key="#user.login_attempts" arg1="${attempts}" /> </syntaxhighlight>
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
- <syntaxhighlight lang="java" enclose="div">
<a href="<lj:url resource="pages/jbSearchResults.jsp"/>?search=${param.search}">Back to List</a> </syntaxhighlight>
- Used in a JavaScript event
- <syntaxhighlight lang="java" enclose="div">
<input type="button" name="cancel" value="Cancel" onClick="window.location='<lj:url resource="pages/home.jsp" />';" /> </syntaxhighlight>
- Used for downloading a file. Note resource is pointing to a documentId.
- <syntaxhighlight lang="java" enclose="div">
<a href="<lj:url type="FILE" resource="<%=documentId%>" />" target="_blank">More info</a> </syntaxhighlight>