Try OpenEdge Now
skip to main content
Customization Guide
Customizing the Home module : JSPs
 

JSPs

If you want to use the API within a JSP, then the API bean must be included in the code. Once this has been done, it is possible to access the API methods. This can be accomplished using the following JSP tag:
<jsp:useBean id="bizSite" class="com.savvion.sbm.bpmportal.bizsite.api.BizSiteBean" scope="session"/>
You need to properly specify the scope of the bean. In this case the scope is "session" and it is valid over multiple HTTP requests. "Request" might be used if it was desired that the bean remain valid only within the context of the current request. A more elaborate example follows.

Example of API use within a JSP

This example uses a variety of API methods to display data about the current available applications and tasks for the user.
<title> BizSite API Example JSP </title>
  <p><font face="Arial, Helvetica, sans-serif">
    <b> BizSite API Example JSP </b></font>
  <hr>
  <jsp:useBean id="bizSite" class="com.savvion.sbm.bpmportal.bizsite.api.BizSiteBean" scope="request"/>
  <!-- DISPLAY THE SERVER'S TIME -->
  <%= bizSite.getTime().toString() %><br><br>
  <!-- LOG IN AS USER 'EBMS' -->
  <b>Logging in:&nbsp;</b>
  <%= bizSite.login( "ebms", "ebms", request ) %>
  <br><br>
  <% bizSite.log( "starting new BPM CustomUI API JSP test page" ); %>
  <!-- GET INFORMATION ABOUT THE CURRENT USER AND SESSION -->
  <b>The current user is:&nbsp;</b>
  <%= bizSite.getCurrentUser() %><br>
  &nbsp;&nbsp;<i>groups:</i>&nbsp;<br>
  <%
    String[] groups = bizSite.getGroups();
    for( int i=0; i < groups.length; i++ ) {
  %>
      &nbsp;&nbsp;&nbsp;&nbsp;<%= groups[i] %><br>
  <%
    }
  %>
  &nbsp;&nbsp;<i>session:</i>&nbsp;
  <%= bizSite.getSession() %><br>
  &nbsp;&nbsp;<i>request:</i>&nbsp;
  <%= request.getRequestedSessionId() %><br>
  <hr>
  <!-- APPLICATION INFORMATION -->
  <br>
  <b><u>APPLICATIONS</u></b><br>
  (sorted by name)<br>
  <%
    com.savvion.sbm.bpmportal.bizsite.api.BizSiteApp[] p;
    p = bizSite.getAppsSorted( "name" );
  %>
  <%
    for ( int i = 0; i < p.length; i++ ) {
  %>
  <br>
  <b>Application ( <%= i %> ) is:&nbsp;</b>
  <%= p[i].getName() %><br>
  &nbsp;&nbsp;<i>description:</i>&nbsp;
  <%= p[i].getDescription() %><br>
  &nbsp;&nbsp;<i>FYI:</i>&nbsp;
  <%= p[i].getFYI() %><br>
  &nbsp;&nbsp;<i>info:</i>&nbsp;
  <%= p[i].getInfo() %><br>
  &nbsp;&nbsp;<i>category:</i>&nbsp;
  <%= p[i].getCategory() %><br>
  &nbsp;&nbsp;<i>url:</i>&nbsp;
  <%= p[i].getURL() %><br>
  &nbsp;&nbsp;<i>full url:</i>&nbsp;
  <%= p[i].getURL( request ) %><br>
  &nbsp;&nbsp;<i>tasks:</i>&nbsp;
  <% com.savvion.sbm.bpmportal.bizsite.api.BizSiteTask[] tasks = p[i].getTasks(); %><br>
  <%
    if (tasks.length ==0 )
  %>
&nbsp;&nbsp;&nbsp;&nbsp;none<br>
  <% else
    for ( int j=0; j < tasks.length; j++ ) {
  %>
  &nbsp;&nbsp;&nbsp;&nbsp;<%= tasks[j].getName() %><br>
  <%
    }
  %>
  <% } %>
  <!-- TASK AND DATASLOT INFORMATION -->
  <hr>
  <br>
  <b><u>TASKS</u></b><br>
  (sorted by name)<br>
  <%
    com.savvion.sbm.bpmportal.bizsite.api.BizSiteTask[] t;
    t = bizSite.getTasks();
  %>
  <%
    for ( int j = 0; j < t.length; j++ ) {
  %>
  <br>
  <b>Task ( <%= j %> ) is:&nbsp;</b>
  <%= t[j].getName() %><br>
  &nbsp;&nbsp;<i>application:</i>&nbsp;
  <%= t[j].getAppName() %><br>
  &nbsp;&nbsp;<i>creator:</i>&nbsp;
  <%= t[j].getCreator() %><br>
  &nbsp;&nbsp;<i>priority:</i>&nbsp;
  <%= t[j].getPriority() %><br>
  &nbsp;&nbsp;<i>start date:</i>&nbsp;
  <%= t[j].getStartDate() %><br>
  &nbsp;&nbsp;<i>end date:</i>&nbsp;
  <%= t[j].getEndDate() %><br>
  &nbsp;&nbsp;<i>assignee:</i>&nbsp;
  <%= t[j].getAssignee() %><br>
  &nbsp;&nbsp;<i>dataslots:&nbsp;(sorted by name)</i><br>
  <%
    com.savvion.sbm.bpmportal.bizsite.api.BizSiteDataslot[] slots;
    slots = t[j].getDataslotsSorted( "name" );
    for( int k=0; k < slots.length; k++ ) {
  %>
      &nbsp;&nbsp;&nbsp;&nbsp;<%= k %>)&nbsp;
      <%= slots[k].getName() %>&nbsp;
      ( <%= slots[k].getType() %> )&nbsp;
      :&nbsp; <%= (java.lang.String) slots[k].getValue() %>
      <br>
  <%
    }
  %>
<br>
<% } %>
<hr>
<br>
  <!-- LOG OUT -->
  <b>Logging out:&nbsp;</b>
  <%= bizSite.logout() %>
  <br>