Entering content frame

Example JSP Selected Programmatically Locate the document in its SAP Library structure

The JSP file is selected programmatically in the code of the portal component by including it as a resource in the response:

The first example shows how you access a JSP file packaged in the caller portal component.

public class CheckBoxComponent extends AbstractPortalComponent {

   public void doContent(

      IPortalComponentRequest request,

      IPortalComponentResponse response) {

      response.write("calling pagelet checkresult.jsp");

      IResource jspResource =

         request.getResource("jsp", "jsp/checkresult.jsp");

      response.include(request, jspResource);

   }

In this case, the PRT will find a JSP called checkresult in the directory jsp.

The second example shows how to access JSP files that belong to another Portal Application.

 public class CheckBoxComponent extends AbstractPortalComponent {

   public void doContent(

      IPortalComponentRequest request,

      IPortalComponentResponse response) {

      response.write("calling pagelet checkresult.jsp");

      IResource jspResource =

         request.getResource("JSPValidation", "jsp", "/jsp/include/foo.jsp");

      response.include(request, jspResource);

   }

In this case, the PRT will find a JSP called foo under the directory jsp in the component JSPValidation.

 

 

Leaving content frame