
To execute a JSP file within a component and include the output in the output of a component, specify the JSP page in the include() method of the portal request object.
The following shows how to include the output from a JSP page contained in the same application as the calling component:
public class CheckBoxComponent extends AbstractPortalComponent {
public void doContent(
IPortalComponentRequest request,
IPortalComponentResponse response) {
if (request!=null && response!=null) {
IResource jspResource =
request.getResource(IResource.JSP, "jsp/checkres.jsp");
response.include(request, jspResource);
}
}
Above, the JSP page checkres.jsp in the directory /PORTAL-INF/jsp is executed.
The following shows how to include a JSP page that is packaged in a different application:
IResource jspResource =
request.getResource(
"JSPValidation", IResource.JSP, "/jsp/include/checkres.jsp");
response.include(request, jspResource);
Above, the JSP page checkres.jsp in the directory /PORTAL-INF/jsp/include of the application JSPValidation is executed.