HowTo:Create a JSP Page and Java Controller

From AgileApps Support Wiki
Revision as of 20:05, 30 March 2012 by imported>Aeric

For:   Developers
Level: Intermediate
Time: 15 minutes

See more:
    ◾ HowTo Guides

This example describes how to use a Page to perform the following actions on records in the Directory object:

  • search for records based on specified criteria
  • add records
  • update records
Considerations
It is important to create the Classes files first, then create the Pages. Five files are provided, including two Classes, and three Pages. The files should be created in this order:
  1. Class Directory.java
  2. Class DirectoryController.java
  3. Page AddUpdate.jsp
  4. Page Directory.jsp
  5. Page SearchPage.jsp

To add the Pages and Classes:

  1. To create the (.java) Java pages, follow the instructions at Add a Class
    Create the class Directory.java from: Directory.java
    • Copy and paste the contents into the Class
    • Save the file as Directory.java
    Create the class DirectoryController.java from: DirectoryController.java
    • Copy and paste the contents into the Class
    • Save the file as DirectoryController.java
  2. To create the (.jsp) Java Server Pages, follow the instructions at Add a Page
    Create the page AddUpdate.jsp from: AddUpdate.jsp
    • Copy and paste the contents into the Page
    • Save the file as AddUpdate.jsp
    Create the page Directory.jsp from: Directory.jsp
    • Copy and paste the contents into the Page
    • Save the file as Directory.jsp
    Create the page SearchPage.jsp from: SearchPage.jsp
    • Copy and paste the contents into the Page
    • Save the file as SearchPage.jsp
  3. To invoke the Directory page from the URL, copy and paste the following into a web browser. A valid username and password is required to log in to the platform.
https://{yourDomain}/networking/pages/Directory.jsp</nowiki>

After logging in, the user can perform these actions in the Directory object:

  • search for records based on specified criteria
  • add records
  • update records