Pages
From LongJump Support Wiki
A Page is a standard JSP (JavaServer Page) page. It can be used to create highly customized user interface elements as well as completely independent tabs.- Learn more: Pages in the Developer Suite
In most cases, a page communicates with a worker class through a controller class. For details, see Working with Pages and Classes.
Users in Roles with Customize Objects permission rights enabled can add, edit or delete pages
Contents |
About APIs
You can make Java API calls in the Java code in a page. The following Java API classes are implicitly imported into pages:
You can also make AJAX API calls in the JavaScript in a page. The AjaxAPI, LongJump.Record, and AjaxInfo objects are implicitly imported into pages.
A page has these restrictions:
- The maximum number of loop iterations is 10000
- You cannot make a database connection
A complete list of restrictions is available in the Governors section.
Manage Pages
Pages can be Added, Edited or Deleted. Before editing, a page must be checked out (Checkout), and should be checked in (Commit) after Editing.
Add a Page
To add a page:
- Click Setup | Develop | Pages
- Click the [New Page] button, and complete the following information:
- Title
- Enter a title for the page
- *.jsp extension is required
- Display with Tab Header
- Checkbox
- If checked, display the page with a tab header
- Enter the code in the text area
- Click the [Save] button to continue, or [Cancel] to stop the action
Edit a Page
Before editing a page, the page must be checked out. To edit a page:
- Click Setup | Develop | Pages
- Click the name of the page to edit
- Click the [Edit] button
- Edit the code in the text area
- Click the [Save] button to continue, or [Cancel] to stop the action
Checkout a Page
Before editing a page, the page must be checked out.
- Learn more: Version Control
To checkout a page:
- Click Setup | Develop | Pages
- Click the name of the page to edit
- Click the [Checkout] button
Any of the following actions can be taken on a page that is checked out:
- Edit
- Delete
- Commit
- Back (Cancel)
The following information is displayed when a page is checked out:
- Page Information
-
- Title
- pagetitle.jsp
- Display with Tab Header
- Yes
- Version Information
-
- Version
- 4
- Locked
- No
- Last Commit By
- Elaine Yoder
- Last Commit Date
- 01/13/2010 10:55 AM
- Last Checkout By
- Elaine Yoder
- Last Checkout Date
Commit a Page
After editing a page, the changes should be committed to the working copy. To commit a page:
- After editing a page, click the [Save] button
- Click the [Commit] button
- The Item Type and Name cannot be modified
- Add Comments about the changes
- The following Commit Details are displayed:
- Item Type
- Page
- Item Name
- pagename.jsp
- Comment
- Description of the changes to the page
- The following Commit Details are displayed:
- Click the [Save] button to continue, or [Cancel] to stop the action
Delete a Page
To delete a page:
- Click Setup | Develop | Pages
- Click the name of the page to delete
- Click the [Delete] button to continue, or [Cancel] to stop the action
Editing Pages in Eclipse
Use the Eclipse Plug-In to add, edit or delete pages.
Invoke a Page from an Action
- Click Setup | Customize | Objects.
- Click an object
- Click the Actions tab
- Click the [Add Action] button
- Enter a title
- Specify Invoke Custom Page as the Type
- Select a page you have defined
- Click the [Save] button to continue, or [Cancel] to stop the action
Invoke a Page from a URL
If you have written your page in a way that does not require a controller to display it, you can directly invoke it using:
https://www.longjump.com/networking/pages/MyJSP.jsp
If your page depends on a controller to display it, you can use this type of URL:
https://www.longjump.com/networking/controller/MyService?action=myService
where MyService is a class that implements the Controller interface and action is a parameter that you can use in the controller.
For more about controllers, see see Working with Pages and Classes.
Create a Tab using Pages
See Web Tabs for information on creating tabs using pages.
About Static Resources in Pages
See the Static Resources article for information on how to load image files, stylesheets, JavaScript files or compressed files as Page resources.
Print Templates Using Pages
Print templates in pages can be used to print records in any object. See Print Templates for an overview of print templates in the user interface.
Examples
- Create an Expense Report to be used in expense management application
- Print an Employee Benefit Form
Using print templates in pages is a two-step process:
- Create a Page that includes the desired print formatting
- Create a Print Template using a Page as the template type
Create a Page
- Click Setup | Customize | Pages
- Click the [New Page] button
- Click the [Edit] Button
- Enter a Title (filename) for the print template; Include .jsp as the file extension
- Uncheck the Display with Tab Header checkbox
- Add appropriate code; This example includes a typical "Hello World" example:
- Click [Save] to save your changes, or [Cancel] to stop the action
Create a Print Template
This print template uses Page as the type of template, instead of HTML
- Click Setup | Customize | Object | <object name>
- Add a new Print Template, select Page type and select the .jsp print template file
Extras
Object ID and Record ID are available in the Request Object, and can be accessed from the Page:
String object_id = request.getParameter("object_id");
String record_id = request.getParameter("record_id");
Example: Add a Contact using a Page and a Class
This example describes how to Add a Contact using a Page and Class.
Create a Page
- To create a page, follow the instructions at Adding a Page
- Copy and paste the following code into the page, and name it AddContact.jsp
<body>
<form name = "mainForm" action="/networking/controller/AddContact" method="POST">
<table width="100%" border="10" cellspacing="0" cellpadding="0">
<tr>
<td><table width="50%" border="0" cellspacing="0" cellpadding="2">
<tr>
<LABEL for="addFirstName"> First Name: </LABEL>
<INPUT type="text" id="addFirstName" name="addFirstName" value="CPFirst"><BR>
<LABEL for="addLastName"> Last Name: </LABEL>
<INPUT type="text" id="addLastName" name="addLastName" value="CPLast"><BR>
<INPUT type="submit" value="Add"> <INPUT type="reset">
</tr>
</table>
</form>
</td>
</tr>
</body>
</html>
Create a Class
- To create a class, follow the instructions at Adding a Class
- Copy and paste the following code into the class, and name it AddContact
import java.util.*;
import com.es.mvc.*;
import com.es.api.scripting.*;
public class AddContact implements Controller
{public ControllerResponse execute(HashMap params) throws Exception
{String action = (String)params.get("action");
if(action == null || action.equals(""))
{debug("Action - null?");
action = "Add";
}if(action.equals("Add"))
{debug("Action - not null?" + action);
return addContact(params);
}else{}return null;
}private ControllerResponse addContact(HashMap params) throws Exception
{ControllerResponse cr = new ControllerResponse();
Result result = null;
try{Parameters addOptions = getParametersInstance();
addOptions.add("object_id", "CONTACT");
String addFirstName = (String)params.get("addFirstName");
String addLastName = (String)params.get("addLastName");
if(addLastName != null && !addLastName.equals("")
&& addFirstName != null && !addFirstName.equals(""))
{addOptions.add("first_name", addFirstName);
addOptions.add("last_name", addLastName);
}else{addOptions.add("first_name", "CPfirst"+new Date());
addOptions.add("last_name", "CPLast" + new Date());
addOptions.add("account_id", "1593373443");
}result = addRecord("CONTACT", addOptions);
debug("Message:" + result.getMessage());
cr.setData(result);
cr.setTargetPage("AddContact.jsp");
}catch(Exception e)
{cr.setTargetPage("AddContact.jsp");
cr.setMessage(e.getMessage());
debug("Message:");
}return cr;
}}
Now the page is ready to be invoked from browser or web tab.
Pages in Lookup Fields
Lookup fields can be based on Pages, which display customized Lookup Windows. These pages are launched in the usual way, with the lookup
icon, from within a record.
When a Lookup Window search is successful, these parameters are used to identify and return Lookup Fields in Pages:
Paramter Name Description object_id Object Identifier keyword String value, entered by the user in the lookup field. If the user types ABC in the lookup field, then the keyword is ABC.
target_field Used to store the Record Identifier target_name_field Used to store the contents of the field (text string format, contents of the field)
- The Lookup Field is rendered using two HTML elements:
- target_field
- target_name_field
- See the .jsp sample code files for more information.
- Considerations
- Lookup Record Selection Criteria is not supported
- Lookup Post Selection Javascript is not supported
- Ajax Auto-Completion for Lookup Fields is not supported
Lookup Examples
Search based on Lastname
This example performs a search action in a lookup window based on "Lastname" as the Record Identifier Field in Record Locator:
Add a Page:
- From the Account object, Add a Page
- Use this file name: AccountPopup.jsp
- Use this code sample: AccountPopup.jsp
Add a AccountPopup.java Class:
- From the Account object, Add a Class
- Use this file name: AccountPopup.java
- Use this code sample: AccountPopup.java
Add a AccountPopupController.java Class:
- From the Account object, Add a Class
- Use this file name: AccountPopupController.java
- Use this code sample: AccountPopupController.java
Search based on multiple fields
This example performs a search action in a lookup window using Multiple Fields in the Record Locator:
Prerequisite: In the Directory object, define the Record Identifier field to include "First name" and "Last name".
- Add a Page
- From the Directory object, Add a Page
- Use this file name: DirectoryPopup.jsp
- Use this code sample: DirectoryPopup.jsp
- Add a DirectoryPopup.java Class
- From the Directory object, Add a Class
- Use this file name: DirectoryPopup.java
- Use this code sample: DirectoryPopup.java
- Add a DirectoryPopupController.java Class
- From the Directory object, Add a Class
- Use this file name: DirectoryPopupController.java
- Use this code sample: DirectoryPopupController.java
Multiple Fields in the Record Locator
If the Record Identifier Field in Record Locator is a combination fields, then the the Record Locator must be created by concatenating the field names.
For example, the record locator for the Employee object is a combination of First name, Last name. Then the record locator value is formed as: [First name value][space][-][space][Last name value]
First name Last Name Record Locator Value John Smith John - Smith Peter Peter - Jones - Jones
Global Pages
ISVs and MSPs can create custom pages at global level for distribution to Tenants. This feature gives Service Providers the ability to design and build pages once, then make the custom work available to multiple tenants, as the default Home Page for Tenants, or added as Web Tabs.
- Global Page access
Global Page access is defined by {namespace}, as shown in this URI:
- http://{domainname}.com/networking/isv/{namespace}/{globalpage.jsp}
- where:
- {domainname} is the Service Domain of the Service Provider
- {namespace} is the namespace of the Service Provider, defined in Company Information
- {globalpage.jsp} is the the name of the Page
- Considerations
- Usage is hierarchical, meaning that:
- ISVs can create Global Pages, which can be used by MSPs and Tenants of that ISV
- MSPs can create Global Pages, which can be used by Tenants of that MSP
Create a Global Page
- Click Setup | Develop | Pages
- Click the [New Page] button, and complete the following information:
- Title
- Enter a title for the page, for example: pagename.jsp
- '.jsp' extension is required
- Display with Tab Header
- Checkbox
- Uncheck the Display with Tab Header option
- Enter the code in the text area
- Click the [Save] button to continue, or [Cancel] to stop the action
Using Global Pages
- To select a Global Page as the Home Page for tenants, see: Application Container URL
- To use a Global Page as a Web Tab:
- Create a New Web Tab
- Choose URL as the Web Tab Type
- Paste the Global Page URI into the edit area:
- http://{domainname}.com/networking/isv/{namespace}/{globalpage.jsp}
- Remember to substitute actual values for the {arguments}
