Show TOC

Writing JSP PagesLocate this document in the navigation structure

Use

The Portal Runtime enables you to run JSP pages in the portal, and to write portal components as JSP pages.

Note

The portal has its own implementation of JSP, so not all previously written JSP pages can be run in the portal. For more information on differences in the portal implementation of JSP, see JSP Objects and Directives .

The following shows the JSP versions used by the Portal Runtime and the AS Java for different versions of the portal:

Portal/NetWeaver Version

Portal Runtime

AS Java

SAP Enterprise Portal 6.0 SP2

J2EE 1.2 (JSP 1.1)

J2EE 1.2 (JSP 1.1)

SAP NetWeaver 04, 7.0

J2EE 1.2 (JSP 1.1)

J2EE 1.3 (JSP 1.2)

SAP NetWeaver 7.1

JEE 5.0 (JSP 2.1)

JEE 5.0 (JSP 2.1)

All JSP files must be placed in the private area ( PORTAL-INF folder) of the PAR in which they are packaged.

When the JSP is first accessed, the portal creates a .java file that defines a class that extends AbstractPortalComponent that is based on the JSP page, and then compiles the file into a .class file. When the JSP is called, it is this class that is executed, not the JSP. The name of the java file is _sapportalsjsp_[name of JSP file].java .

The package name of the new portal component class is based on the folder in which the JSP is placed. For example, for a JSP page whose path is PORTALINF/jsp/select/customer/default/entry.jsp , the java class _sapportalsjsp_myJSP in package jsp.select.customer.default is created in the file _sapportalsjsp_myJSP.java .

The portal places the .java and .class files in a new folder called work in the /WEB-INF/portal/portalapps/<application name> folder, where application name is the portal application in which the JSP is packaged.

Development Vs. Production Mode

In production mode, a change in the JSP page on the file system of the portal does not cause the JSP to be recompiled. For performance reasons, the page is recompiled, if necessary, only when the application in which the page is packaged is redeployed.

During development and testing, it may be easier to make changes to a JSP on the file system than to make changes in SAP NetWeaver Developer Studio and then redeploy the application. Therefore, in development mode, the JSP page is checked to see if it was modified each time the page is called.

Encoding

When a portal application uses a JSP resource that contains double-byte characters, the portal needs to know the character set used to create the file. The portal can then parse the file in the correct encoding and generate the corresponding output in UTF-8 encoding (or in the encoding specified in the runtime.doubleByteSupport.encoding property in the prtcentral.properties configuration file).

Specify the encoding in the pageEnconding attribute of the page directive in the JSP file:

<%@page pageEncoding="shift_JIS" %>