HowTo:Create a JSP Page and Java Controller

From AgileApps Support Wiki
Revision as of 01:54, 28 July 2012 by imported>Aeric

For:   Developers
Level: Intermediate
Time: 15 minutes

See more:
    ◾ HowTo Guides

This example shows how a JSP Page and a Controller Class interact to let the user:

  • add records to a Mailing List object
  • do a SQL search for (one or more) records
  • update records

The following files are used:

  1. Class AddUpdateController.java
  2. Page AddUpdate.jsp
Prerequisites
  • A "Mailing List" object must be created, with two fields: contact_name and contact_email

To add the Pages and Classes:

  1. To create the Java class:
  2. Follow the instructions at Add a Class
  3. Copy and paste the contents of AddUpdateController.java into the Class
  4. Save the class
  5. To create the JSP Pages
  6. Follow the instructions at Add a Page to create AddUpdate.jsp
  7. Copy and paste the contents of AddUpdate.jsp
  8. Save the JSP page
  9. 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

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

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