Difference between revisions of "Sites"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 14: Line 14:
:;Interactive business applications: Use {{enterprisebrand}} Dynamic Sites to create interactive web applications where users can interact with complex business processes. For example, you may create a job posting and resume submission application or create an application for mobile updates to {{enterprisebrand}} data.
:;Interactive business applications: Use {{enterprisebrand}} Dynamic Sites to create interactive web applications where users can interact with complex business processes. For example, you may create a job posting and resume submission application or create an application for mobile updates to {{enterprisebrand}} data.
:;Community and social networking: {{enterprisebrand}} Dynamic Sites can be used to design websites that engage a community of users to submit and vote on ideas, exchange information, or securely collaborate on projects.
:;Community and social networking: {{enterprisebrand}} Dynamic Sites can be used to design websites that engage a community of users to submit and vote on ideas, exchange information, or securely collaborate on projects.
===Login Options===
Users can always create a new username and password. But by including the appropriate tags, the site can also allow users to login:
:* Using a Facebook ID ([[]])
:* Using a Google ID ([[]])
:* Using their Gmail account ([[]])


===Sample Sites===
===Sample Sites===

Revision as of 21:37, 8 June 2012

The Sites feature enables designers and web developers to build and deploy public web sites and web-based applications using the AgileApps Cloud platform. These Dynamic Sites leverage the backend data and content that reside within a user account. Dynamic Sites eliminate the need for a specific web server or database and instead leverage the robust administration and presentation capabilities of the AgileApps Cloud platform, as well as its relational database.

Dynamic Sites are defined by Java Server Pages (JSPs) and any included static resource files (images, CSS, etc.). The web pages can be accessed by both authenticated (registered) and unauthenticated (anonymous) users. They can be customized using both CSS and Template:JQuery widgets. (You can can also upload other JavaScript libraries as static resources, and use them in your pages.)

In addition to Pages, a developer can use Classes/Controllers to write business logic, adhering to the industry standard MVC architecture, where Pages handle the View, Classes and Controllers handle the Controller level, both of which interact with data stored on the platform (the Model) using the platform's Java API and REST API.

Sites are accessed using URLs that point to pages, controllers, and Action Tags.

Template:TenantFeatureByName

About Sites

Dynamic Sites can be used to build many kinds of web sites:

Portal web sites
Run your entire public corporate web site on AgileApps Cloud platform Dynamic Sites, or create intranet sites by IP restricting the sites. In addition, Dynamic Sites enable you to create authenticated and unauthenticated pages and data to be served directly to your audience, making it ideal for portals.
Interactive business applications
Use AgileApps Cloud platform Dynamic Sites to create interactive web applications where users can interact with complex business processes. For example, you may create a job posting and resume submission application or create an application for mobile updates to AgileApps Cloud platform data.
Community and social networking
AgileApps Cloud platform Dynamic Sites can be used to design websites that engage a community of users to submit and vote on ideas, exchange information, or securely collaborate on projects.

Login Options

Users can always create a new username and password. But by including the appropriate tags, the site can also allow users to login:

  • Using a Facebook ID ([[]])
  • Using a Google ID ([[]])
  • Using their Gmail account ([[]])

Sample Sites

These sites are running on the AgileApps Cloud platform. You can interact with them to see them in action, or install the applications and take them apart to see how they work:

  • Employers can post jobs, including job type, category, location, experience, requirements and education
  • Potential candidates can view and search the job list, and apply for jobs
  • Clients can post questions or issues, receive automated email messages, communicate with support agents and review conversations.
  • Support agents can prioritize and process tickets, assign tickets to individual agents or departments, track ticket status and conversations.

Terms Used in Sites

Site User

  • A Site User is any user that registers with the site.
  • When a Site User registers, a User record is created for them, so they are guaranteed to have a unique identity in the platform instance.
  • That identity can be used to store profile information. Operations they perform are undertaken with that identify.
  • However, that identity does not have the ability to log into the platform.
  • A Site User therefore does not count as a "platform user", from the standpoint of tenant billing. (From that standpoint, only platform users count. So if you have 5 people in your organization, and 100,000 Site Users, your tenancy is considered to have only 5 billable "users".)

Anonymous Site User

  • Someone can use the site without registering, as well.
  • In that case, they perform operations using the default identity configured for the site.
  • Using Roles, you determine which operations require registration, and which do not.

Base URL

  • The Base URL is the default web address of the site
  • Includes the domain part of the URL, for example: yourcompany.com
  • Learn more: Building Site URLs

Add or Edit a Site

  1. Designer > Logic > Sites
  2. Click [New Site], or
    Select a Site and click [Edit]
  3. Fill in the Site properties.

Site Properties

Site Information

Name
Site name
A unique site name within a tenant. This name is part of the Base URL/Default Web Address.
Default Web Address
Read Only
Created from the Site Name. This is the default unsecured URL generated for this site.
https://{yourDomain}/networking/sites/123456/mysite
Default Secure Web Address
Read Only
Created from the Site Name. This is the default secured URL generated for this site.
https://{yourDomain}/networking/sites/123456/mysite
User Web Address
Vanity URL
A "pretty" URL, used as a redirect from the Default URL. Site developer can add a CNAME entry, which will redirect www.mysite.com to the platform. (The platform's Site tags rewrite URLs in a page to point to this User Web Address.)
Is Site Active
Checkbox, checked by default
  • If checked, this site is active. A single click interface to activate/deactivate a site.
Start Page
A predefined Page that appears as the landing page when the site is launched.
Inactive Page
A predefined Page that is displayed if the Active checkbox is unchecked. This page can be used as an Under Construction/Maintenance page.
Error Page
The default page to display when an error occurs.
File Not Found Page
The page to display when a 404 - File Not Found error occurs.
Site Template Page
A predefined JSP page that will act as a Site Template.
Considerations
  • Only JSP pages for which Include header files is disabled are shown. (JSP pages that include header files will not work, as the header files include libraries that are incompatible with site operations.)
  • For sophisticated sites that use a library like jQuery to nest pages, the Site Template feature won't be of much value. In such circumstances the Site Template will be applied to the main page, as desired, but it will also be applied to subsidiary pages as they are loaded into subsections of the main page--behavior which is generally undesirable.

Access Type

Login As User for Unauthenticated Access
Use the lookup Lookupicon.gif icon to select a User. If a page does not need authentication, and if a Site User is not logged in, Platform will log in the selected User for doing any operations on the server.
Register Site Users with this Role
Use the lookup Lookupicon.gif icon to select a Role. Newly registered users will take the selected Role.
Register Site Users with this Team
Use the lookup Lookupicon.gif icon to select a Team. Newly registered users will belong to the selected Team.
Login Page
Any unauthenticated access of a page which requires authentication, will be redirected to this page. Typically this page will have the login box.

Manage Pages

List of Pages Available to the Site
Pages available to the Site
A list of pages available to the site
Authentication Required?
Checkbox, unchecked by default
  • If checked, this page requires authentication. Unauthenticated access of this page will redirect user to the page denoted by Login Page property.
Delete
Optionally, click the trashcan Trashcanicon.gif icon to remove the page from the site. The page is only removed from use in the site, and is still present in the Pages repository.

Building Site URLs

One of the most important features of Site functionality is the way URLs are handled in a Site page.

  • After you configure the URL forwarding (redirect) from your web address to the Site's Default Web URL/Base URL, the Platform is ready to serve your site
  • In any typical web application, URLs include the site domain
  • In the case of Sites, the user will have to write absolute URLs pointing the User's web address, since the content is being served from Platform's server
  • URLs can be hard-coded with the Site URL or the Platform URL JSP tags can be used
Learn more: Tags

Sites are built using a combination of Pages, Classes, Controllers.

Learn more: Working with Pages and Classes

URL Types

URL types supported in Sites include Pages, Controllers and Actions.

Pages Example

For this Base URL and User Vanity Web Address:

Base URL (Default Web Address)
https://{yourDomain}/networking/sites/1234567/mysite,
where mysite is derived from the User Vanity Web Address, http://www.mysite.com
Page URL
Base URL + /pages/{page}
Page Name
home.jsp
URL displayed in the page
http://www.mysite.com/pages/home.jsp
URL forwarded to the Platform Server
https://{yourDomain}/networking/sites/1234567/mysite/pages/home.jsp

Controller Example

For this Base URL and User Vanity Web Address:

Base URL (Default Web Address)
https://{yourDomain}/networking/sites/1234567/mysite,
where mysite is derived from the User Vanity Web Address, http://www.mysite.com
Controller URL
Base URL + /controller/{controller_path}
Controller Path
com/platform/demo/samples/JobsController
URL forwarded to the Platform Server
https://{yourDomain}/networking/sites/1234567/mysite/controller/com/platform/demo/samples/JobsController

Action Example

For this Base URL and User Vanity Web Address:

Base URL (Default Web Address)
https://{yourDomain}/networking/sites/1234567/mysite,
where mysite is derived from the User Vanity Web Address, http://www.mysite.com
Action URL
Base URL + /{action}
Standard Action
login
URL displayed in the page
http://www.mysite.com/login
URL forwarded to the Platform Server
https://{yourDomain}/networking/sites/1234567/mysite/login

Using Controllers and Pages

Used to customize the business logic for the Site. In this case, all the responsibility of the data model, business logic and display part is written by the user.


URI Base URL + "/controller/{controller}"
Base URL + "/pages/{page}"
Examples: https://{yourDomain}/networking/sites/123456/{site}/controller/JobsController
https://{yourDomain}/networking/sites/123456/{site}/pages/MyPage.jsp
Parameters
{parameter_name}
Any parameter needed for any controller/page written by the user. Please refer to the Classes/Pages documentation on how to write controller/pages.

Included Server-Side Actions

The AgileApps Cloud platform includes a number of built-in server-side actions. These actions are typically useful for an authenticated site. Common actions for a typical Web Application which supports authentication are listed here, and are used with the Common Parameters.

Considerations
  • Each action is available as a service through a URL and expects certain parameters for a successful execution.
  • Both HTTP GET and HTTP POST are supported for these actions.
Action Description URL
Login to the site Login to the AgileApps Cloud platform as a Site User Base URL + "/login"
Register a New User Create a new Site User Base URL + "/register"
Change Password Change the Site User's password Base URL + "/change_password"
Update Profile Update a User Profile Base URL + "/update_profile"
Validate the Security Question Validate the security question, as part of the Forgot my Password process Base URL + "/validate_security_question"
Reset Password Reset a Site User's password Base URL + "/reset_password"
Manage Objects Add/update/delete a record in an Object Base URL + "/service"
Download File Download a document Base URL + "/download_file"
Logout from the Site Logout from the AgileApps Cloud platform Base URL + "/logout"

Common Parameters

The following common parameters are required for all Server-Side Actions:

Parameter Required Description
__oe Yes On Error, a relative URL which is executed when an error occurs
__os Yes On Success, a relative URL which is executed when a successful action is executed. Example URL for __os and __oe will be "pages/home.jsp" or "controller/com/platform/{namespace}/{package}/GetRecords"
__pc No This is the class that is executed before the action is executed. This can be used for validations before a controller or a server side action is executed. This can be used to execute some code before server side action is executed, when the controller is Platform.
__pcm No Method of class identified by __pc, that is executed before the action is executed. This can be used for validations before a controller or a server side action is executed. This can be used to execute some code before server side action is executed, when the controller is Platform.

Login to the site

Performs same behavior as Login. Requires following HTML parameters to be submitted:

URL
Syntax: Base URL + "/login"
Example: https://{yourDomain}/networking/sites/123456/[MySiteName]/login
Parameters
login
Username of the user logging in to the site
password
Password associated with the username

Register a New User

Used for registering a new site user. Requires following HTML parameters to be submitted.

URL
Syntax: Base URL + "/register"
Example: https://{yourDomain}/networking/sites/123456/[siteName]/register
Parameters
first_name
First Name of the user
last_name
Last Name of the user
email
Email of the user
username
Username of the user
password
Password of the user
password2
Password of the user for confirmation
custom_security_question
Security question of the user, in case the user forgets the password
security_answer
Security answer in case the user forgets the password

Change Password

Used for changing user's password. The user is required to be logged in for this action to take place.

URL
Syntax: Base URL + "/change_password"
Example: https://{yourDomain}/networking/sites/123456/[siteName]/change_password
Parameters
old_password
Old password of the user
password
New password of the user
password2
New password of the user, for confirmation

Update Profile

Used for updating user's profile. The user is required to be logged in for this action to take place.

URL
Syntax: Base URL + "/update_profile"
Example: https://{yourDomain}/networking/sites/123456/[siteName]/update_profile
Parameters
first_name
First Name of the user
last_name
Last Name of the user
email
Email of the user
street
Street part of the user's address
city
City part of the user's address
state
State part of the user's address
zip
Zip part of the user's address
country
Country part of the user's address
company
Company of the user
title
title of the user
division
Division of the user. Generally used for different departments within a company
phone
Phone number of the user
fax
Fax number of the user
mobile
Mobile number of the user
custom_security_question
Security Question in case user forgets the password
security_answer
Security Answer in case user forgets the password

Validate the Security Question

Used for validating the Security Question entered by the user. This action is particularly used for the Forgot My Password use case.

URL
Syntax: Base URL + "/validate_security_question"
Example: https://{yourDomain}/networking/sites/123456/[siteName]/validate_security_question
Parameters
username
Username of the user
custom_security_question
Security Question, in case user forgot the password
security_answer
Security Answer, in case user forgot the password

Reset Password

Used for resetting user's password. This action is particularly used for forgot password use case.

URL
Syntax: Base URL + "/reset_password"
Example: https://{yourDomain}/networking/sites/123456/[siteName]/reset_password
Parameters
password
new password of the user
password2
new password of the user for confirmation

Manage Objects

Used to add/update/delete a record in a Custom Object.

URL
Syntax: Base URL + "/service"
Example: https://{yourDomain}/networking/sites/123456/[siteName]/service
Parameters
action
action is one of add/update/delete for a custom object.
object
Name/Id of the object user wants to take action upon.
[fieldName]
Any field that is part of the object. Field list is same as that is being used for Java APIs. Please refer to the Java API documentation on how to retrieve the field names. For update and delete operation, id is the required attribute.

Download File

Used for downloading a file for an id. It can download any document that is uploaded in the Documents tag.

URL
Syntax: Base URL + "/download_file"
Example: https://{yourDomain}/networking/sites/123456/[siteName]/download_file
Parameters
id
id of the file that is to be downloaded
Learn more: Tags

Logout from the Site

Used for logging out from the Site.

URL
Syntax: Base URL + "/logout"
Example: https://{yourDomain}/networking/sites/123456/[siteName]/logout
Parameters
None
Learn more: Tags

Tags

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:
  • ${_page} in a Site Template
  • pages/{pageName} in other pages, where pagename includes ".jsp"
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.

Notepad.png

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:
  1. Go to https://developers.facebook.com and create a new Application.
  2. Modify the Application to set the App Domain to point to your domain.
  3. Specify the Site URL in "Website with Facebook Login", so it points to your Domain URL
  4. 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';
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}"/>
Email <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}" />
Email <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>

Site API

Site API is a group of Java APIs related to Sites functionality. You can use these API's within a Page, Data Policy, or Class.

isUserLoggedIn
Determines whether a site user is logged in or not.
Method Signature
public static boolean isUserLoggedIn()
Returns
true if the user is logged in, false otherwise
Example
<syntaxhighlight lang="java" enclose="div">

<% if(!SiteAPI.isUserLoggedIn()) { %>

<a href="<lj:url resource="pages/login.jsp"/>">Login</a> <a href="<lj:url resource="pages/register.jsp"/>">Register</a>

<% } %> <% if(SiteAPI.isUserLoggedIn()) { %>

<a href="<lj:url resource="pages/ticketList.jsp"/>?fieldList=number,type,subject,status,date_modified,description&sortBy=number&sortOrder=desc&page=0&pageSize=25">List of Tickets</a> | <a href="<lj:url resource="pages/ticket.jsp"/>?action=add">Add New Ticket</a> | <a href="<lj:url resource="pages/ticketList.jsp"/>?fieldList=number,type,subject,status,date_modified,description&sortBy=number&sortOrder=desc&page=0&pageSize=25&filter=status not equal to 'cl'">Hide Closed Tickets</a> | <a href="<lj:url resource="pages/updateProfile.jsp"/>">Update My Profile</a> | <a href="<lj:url resource="pages/changePassword.jsp"/>">Change Password</a> | <a href="<lj:logout />">Logout</a>

<% } %> </syntaxhighlight>

isUserValid
Determines whether a username is valid or not. Common use case is forgot password, where you need to validate if user entered username is valid or not.
Method Signature
public static boolean isUserValid(String username)
Returns
true if the username is valid, false otherwise.
Example
<syntaxhighlight lang="java" enclose="div">

import com.platform.api.*;


public class ValidateUser implements Controller {

 public ControllerResponse execute(HashMap params) throws Exception
 {
   String username = (String) params.get("username");
   ControllerResponse cr = new ControllerResponse();
   if(username == null || username.equals(""))
   {
     Result res = new Result(-1, "", 
        "Username is blank. Please enter a non-blank value for Username");
     cr.setData(res);
     cr.setTargetPage("forgot.jsp");
   }
   else if(!SiteAPI.isUserValid(username))
   {
     Result res = new Result(-1, "", "Invalid username " + username);
     cr.setData(res);
     cr.setTargetPage("forgot.jsp");
   }
   else
   {
     Result res = new Result(0, "", "Valid User");
     cr.setTargetPage("secQuestion.jsp?username=" + username);
   }    
   return cr;
 }

} </syntaxhighlight>


[[Category:Template:Features]]