36
1 Oracle Application Server Integrating JavaServer Pages with OracleAS Portal Release 10g (9.0.4) August 2004

Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

1

Oracle Application Server

Integrating JavaServer Pages with OracleAS Portal

Release 10g (9.0.4)

August 2004

Page 2: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

2

About This Document

This document provides instructions for supplementing your OracleAS Portal functionality by adding JavaServer Pages (JSPs).

Information is in these sections:

“Coding your JSP file” on page 5.

“Setting up pages within OracleAS Portal” on page 19.

“Connecting External JSPs via the Configuration File” on page 23.

“Setting up a JAZN file for external communication” on page 30.

“Other JSP Considerations” on page 33.

Page 3: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

3

Introduction

OracleAS Portal gives you the ability to create various kinds of Web pages. You can supplement this ability with JSPs (JavaServer Pages).

You can create two types of JSP pages for use with OracleAS Portal. These are known as "internal" JSP pages and "external" JSP pages:

■ Internal JSP pages. Created within OracleAS Portal using the product’s page mechanisms. Internal JSPs are quick and easy to set up and manage. You create them using the standard page wizards. Internal JSPs are then automatically stored in the OracleAS Portal system, and are managed and secured by OracleAS Portal.

■ External JSP pages. Created outside of OracleASPortal using a text editor or other external tool. You store external JSPs outside of OracleAS Portal. OracleAS Portal does not provide any file management or security.

There are additional requirements for having OracleAS Portal accept and display external JSPs in a page group. You must:

- create a configuration file and install it in the OracleAS Portal environment

- modify the server to allow the external JSPs to log into OracleAS Portal.

You can choose the type of JSP suited to your situation. In general, internal JSPs are much simpler to create and use. External JSPs offer more flexibility, are easier to modify, and usually run faster than internal JSPs.

Page 4: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

4

Overview of Steps

In general, these are the actions to create and install a JSP.

To create and install an external JSP:

1. Code your JSP file.

2. Set up the page group, pages, and portlets.

3. Create a configuration file and server connections.

To create and install an internal JSP:

1. Set up the page group.

2. If you are creating by copying, copy a page and modify its JSP as desired.

3. If you are creating from scratch, code the JSP file and then import it.

Steps for both external and internal JSPs are explained in detail in the remainder of this document.

Page 5: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

5

1 Coding your JSP file

OracleAS Portal provides a set of pre-defined JSP tags that can be used to code JSPs that are able to run in the Portal environment. You use these tags in addition to other standard JSP tags to implement your desired function.

The OracleAS Portal tags are described in the tables below. Some tags are always required: some are optional. Which tags are optional depends on whether your JSP will be internal or external.

1.1 Available JSP Tags

The following tags have been pre-defined and can be used in the OracleAS Portal environment to build and run JSPs.

<portal:usePortal>

<portal:prepare>

<portal:portlet>

<portal:parameter>

<portal:showPortlet>

<portal:useStyle>

<portal:getPageUrl>

Each tag is explained separately below.

Tag Order:

The <portal:usePortal> tag must be the first tag in the JSP. Any of the other tags may then follow.

1.1.1 <portal:usePortal> tag

Page 6: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

6

The usePortal tag is the declaration section of a JSP. It states that the JSP will use the portlets from the identified portal or portals.

Notes:

■ In an external JSP, a default portal can be used only if there was a portal declared as a default in your configuration file, or each and every portal is referenced explicitly, by name.

■ In an internal JSP, there is usually only one portal; that is the portal that stores the internal JSP.

1.1.2 <portal:prepare> tag

The prepare tag is used for bundling portlet content requests for several portlets from the same portal instance. This optimizes the requests.

Table 1 The portal:usePortal tag’s attributes

Attribute Name Required? Description

Internal JSP Usage

External JSP Usage

id optional name of the Portal instance

n/a Portal instance name as specified in the configuration file

pagegroup optional name of the page group

n/a page group name as specified in the configuration file

login optional boolean flag to indicate whether login is required

n/a true is yes, false is no

Page 7: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

7

For example, instead of having to write the following, which results in three round trips to the server:

<showPortlet name="A"/> <showPortlet name="B"/> <showPortlet name="C"/>

you could use the prepare tag and write the following, which results in just a single round trip:

<prepare> <portlet id="A"/> <portlet id="B"/> <portlet id="C"/></prepare>

1.1.3 <portal:portlet> tag

This tag can be used only inside a <portal:prepare> tag. For a single portlet, use the <portal:showPortlet> tag instead.

Table 2 The portal:prepare tag’s attributes

Attribute Name Required? Description

Internal JSP Usage

External JSP Usage

portal optional name of the Portal instance

n/a Portal instance name as specified in the configuration file

portletHeaders

optional Flag indicating whether to show portlet headers for portlets inside the prepare block. This value can be overridden with the "header" attribute value of the <portlet> tag.

True is yes, false is no. True is the default.

True is yes, false is no. True is the default.

Page 8: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

8

1.1.4 <portal:parameter> tag

This tag sets parameters only on portlets, so can only be used within a <portal:portlet> or <portal:showPortlet> tag.

Table 3 <portal:portlet> tag’s attributes

Attribute Name Required? Description

Internal JSP Usage

External JSP Usage

id optional (but required if instance is not specified)

the portlet "reference name," which will be given to a portlet in the JSP scope. (This will be the name of the JSP scripting variable.)

portlet reference name as a string

portlet reference name as a string

instance optional (but required if id is not specified)

the portlet instance name as it exists in the portlet repository. If the id attribute is not set, the instance name will be used as the id.

portlet name as a string

portlet name as a string

header optional flag indicating whether to show the portlet header

True or false. Default is true.

True or false. Default is true.

Table 4 <portal:parameter> tag’s attributes

Attribute Name Required? Description

Internal JSP Usage

External JSP Usage

name required name of the portlet parameter

parameter name as a string

parameter name as a string

value required value of the portlet parameter

parameter value as a string

parameter value as a string

Page 9: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

9

1.1.5 <portal:showPortlet> tag

This tag shows the portlet content (puts the content into the JSP page).

Note:

■ If a prepare tag is used within the same JSP page, your showPortlet tag should be used after the prepare tag. This sequence will improve optimization.

1.1.6 <portal:useStyle> tag

This tag can be used to specify a style name that is defined in OracleAS Portal, and which will be used for this JSP.

This tag must be placed in the <HEAD> section of your JSP document. This is because it will generate a <LINK> tag, and a <LINK> tag should only appear in the <HEAD> section.

Table 5 <portal:showPortlet> tag’s attributes

Attribute Name Required? Description

Internal JSP Usage

External JSP Usage

name required name of the portlet portlet name as a string

portlet name as a string

portal optional name of the Portal instance

n/a Portal instance name as specified in the configuration file

header optional flag indicating whether to show the portlet header

True or false. Default is true.

True or false. Default is true.

Page 10: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

10

1.1.7 <portal:getPageUrl> tag

This tag obtains the URL of the page.

You would use this tag only in certain cases, such as with JSP pages with multiple tabs, or for portlets that need to have the page URL as a parameter. Generally, a JSP does not need to know its page URL.

Table 6 <portal:useStyle> tag’s attributes

Attribute Name Required? Description

Internal JSP Usage

External JSP Usage

name optional name of the style Style name as a string. If name not specified, the default pagegroup style is used.

Style name as a string. If name not specified, the default pagegroup style is used.

portal optional name of the Portal instance

n/a Portal instance name as specified in the configuration file

Table 7 <portal:getPageUrl> tag’s attributes

Attribute Name Required? Description

Internal JSP Usage

External JSP Usage

id required JSP scripting variable name

The name of a JSP variable that will hold the page URL as a string.

The name of a JSP variable that will hold the page URL as a string.

Page 11: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

11

Notes:

■ In the case of an external JSP, the URL returned will be the external JSP page URL.

■ In the case of an internal JSP, the URL returned will be the Portal JSP page URL, which is different from the actual physical location of the JSP page. This is because internal JSP pages are deployed and run from a directory specified by the jspRoot parameter in the web.xml file.

1.2 Accessing Portlets from Your JSP

1.2.1 Types of Portlets

There are two kinds of portlets inside OracleAS Portal that JSPs can access.

■ Externally Published Portlets

■ Portlets on standard portal pages

Portlets are referred to by name in JSPs. The specific technique depends on which kind of portlet it is, as explained below.

1.2.2 How to reference the portlets

Externally Published Portlets

portal optional name of the Portal instance

n/a Portal instance name as specified in the configuration file

Table 7 <portal:getPageUrl> tag’s attributes

Attribute Name Required? Description

Internal JSP Usage

External JSP Usage

Page 12: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

12

Any externally published portlet belongs to a page group. The portlet name is unique within the page group.

(1) Use this coding for portlets from the default page group:

<portlet name>

<portal:showPortlet name="MyReport" />

(2) Use this coding for portlets from a named page group:

/<page group name>/<portlet name>

<portal:showPortlet name="/PAGEGROUP1/MyReport" />

Portlets on standard pages

(1) portlets on a standard page from the default page group:

<page name>/<portlet name>

<portal:showPortlet name="PAGE1/MyReport" />

(2) portlets on a standard sub page or tab from the default page group:

<page name>/<sub page 1 name>/...

/<sub page n name>/<portlet name>

<page name>/<tab name >/.../<sub tab n name>/<portlet name>

<portal:showPortlet name="PAGE1/TAB2/MyReport" />

(3) portlets on a standard page from a named page group:

/<page group name>/<page name>/<portlet name>

<portal:showPortlet name="/PAGEGROUP1/PAGE1/MyReport" />

(4) portlets on a standard sub page or tab from a named page group:

Page 13: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

13

/<page group name>/<page name>/<sub page 1 name>/... /<sub page n name>/<portlet name>

/<page group name>/<page name>/<tab name>/... /<sub tab n name>/<portlet name>

<portal:showPortlet name="/PAGEGROUP1/PAGE1/T2/MyReport" />

All the names (page group names, page names and portlet names) are case sensitive.

Page 14: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

14

1.3 Examples of JSP Code

The examples are arranged from simple to more complex.

1.3.1 Example of the minimum required JSP code

This example shows the minimum requirements for a JSP used to access OracleAS Portal portlet content.

<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib prefix="portal" uri="/WEB-INF/lib/wwjpstag.jar" %>

<portal:usePortal/>

<portal:showPortlet name="helloworld"/>

In this example, the usePortal tag has no Portal name/page group attribute specified. If this JSP is an external JSP, then a Portal with its default flag set to "true" will be located in the configuration file, and any subsequent showPortlet calls will assume this default Portal.

If this JSP is an internal JSP, then it runs within the context of the "default" Portal, which is the OracleAS Portal instance that owns it. Similarly, it runs within the page group to which it belongs. It can, however, reference portlets in other pages groups (if it has access permissions).

If this JSP is an internal JSP, then OracleAS Portal would look for an externally published portlet called helloworld in the same page group in which the internal JSP is located.

1.3.2 Example requiring login to the OracleAS Portal instance

<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib prefix="portal" uri="/WEB-INF/lib/wwjpstag.jar" %>

Page 15: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

15

<portal:usePortal id="Portal1" login="true"/>

<portal:showPortlet name="helloworld"/>

If this is an internal JSP, it functions the same way as the previous example.

If this is an external JSP, the login="true" coding will turn on the OracleAS Portal authentication mechanism.

1.3.3 Example that runs a portlet and passes a parameter

<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib prefix="portal" uri="/WEB-INF/lib/wwjpstag.jar" %>

<portal:usePortal pagegroup="MyPageGroup"/>

<portal:useStyle/>

<portal:showPortlet name="StockQuote">

<portal:parameter name="ticker" value="ORCL"/>

</portal:showPortlet>

1.3.4 Example using multiple portlets on a page

Note that this is an external JSP, since portals are referenced by name.

<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib prefix="portal" uri="/WEB-INF/lib/wwjpstag.jar" %>

<portal:usePortal id="Portal1"/>

<portal:useStyle/>

<portal:prepare>

<portal:portlet id="StockQuote1" instance="StockQuote">

Page 16: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

16

<portal:parameter name="ticker" value="ORCL"/>

</portal:portlet>

<portal:portlet id="StockQuote2" instance="StockQuote">

<portal:parameter name="ticker" value="SUNW"/>

</portal:portlet>

<portal:portlet id="StockQuote3" instance="StockQuote">

<portal:parameter name="ticker" value="ABCD"/>

</portal:portlet>

</portal:prepare>

<portal:showPortlet name="StockQuote1"/>

<portal:showPortlet name="StockQuote2"/>

<portal:showPortlet name="StockQuote3"/>

If the same portlet needs to be displayed more than once on a page, like in the example above, with different input parameters, some unique user-specified id must be present to distinguish each portlet instance usage.

There are 3 variations of the <portlet> tag usage:

■ <portal:portlet id="StockQuote"> will use portlet instance StockQuote and declare a "variable" StockQuote.

■ <portal:portlet instance="StockQuote"> will use portlet instance StockQuote and declare a "variable" StockQuote (same as above).

■ <portal:portlet id="StockQuote2" instance="StockQuote"> will use portlet instance StockQuote and declare a "variable" called StockQuote2.

If neither Portlet id nor instance is specified in the <portlet> tag, an error will be generated at translation time.

1.3.5 Example connecting to multiple portals

<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib prefix="portal" uri="/WEB-INF/lib/wwjpstag.jar" %>

Page 17: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

17

<portal:usePortal id="Portal1"/>

<portal:usePortal id="Portal2"/>

<portal:prepare portal="Portal1">

<portal:portlet id="StockQuote1" instance="StockQuote">

<portal:parameter name="ticker" value="ORCL"/>

</portal:portlet>

<portal:portlet id="StockQuote2" instance="StockQuote">

<portal:parameter name="ticker" value="SUNW"/>

</portal:portlet>

</portal:prepare>

<portal:prepare portal="Portal2">

<portal:portlet instance="foo"/>

<portal:portlet instance="bar"/>

</portal:prepare>

<portal:showPortlet name="StockQuote1"/>

<portal:showPortlet name="StockQuote2"/>

<portal:showPortlet name="foo"/>

<portal:showPortlet name="bar"/>

1.4 Coding your JSP

Using the above tags as appropriate, and any other standard JSP tags, create your JSP file or files.

Page 18: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

18

1.4.1 Coding an external JSPIf you are creating an external JSP, you will do this outside of OracleAS Portal. You code using an editor of your choice.

You store the finished JSP in your file system (outside of Portal). In Release 9.0.2 or higher, you must have the external JSPs on the same machine as the OracleAS middle tier.

1.4.2 Coding an internal JSP

There are two ways to create an OracleAS Portal internal JSP:

■ The easiest way is to create an internal JSP by copying a standard page. Once you have the JSP copy, you can edit that JSP file and expand or adjust it as desired. The specific steps to do this are listed in the next section.

■ The other way to create an internal JSP is a two-step process:

■ First create and code the JSP file outside of Portal), using whatever editor you wish. This is exactly the same as creating an external JSP.

■ Then create a Portal page, with a page type of JSP. When the page wizard asks for the name of your JSP file, you identify the file you just created. The finished page is then an internal JSP.

Page 19: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

19

2 Setting up pages within OracleAS Portal

To make your JSP available to users in Portal, you need to do some page-related set-up.

2.1 Creating a Page Group

Whether you are using internal or external JSPs, you need to have a Portal page group with which the JSPs will be associated. Also, that page group needs to have several JSP-related properties.

To set up a page group for use with a JSP, first log in to Portal, and then follow these steps:

1. Choose a page group to which your new page will belong. Or create a new page group for that purpose.

2. Edit the page group’s properties to allow JSP access: - select the Configure tab- find the heading JSP Access- edit that heading to bring up a page called JSP Access Properties- check the box labelled Allow External Access.

Checking Allow External Access is required even if your JSP is an internal JSP.

3. Create an access key for the page group. In order for your external JSP to access the page group. you will need to specify this key in the configuration file you create to support your external JSP.

The access key must contain only alphanumerics, and be no longer than 200 characters.

Page 20: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

20

(Even if the page group will be used only by internal JSPs, you still need to create an access key here for the page group.)

2.2 Creating internal JSP pages

As noted earlier, there are two ways to create an internal JSP page in this page group: making a page copy as a JSP, and importing an external JSP file into a page.

2.2.1 Making a JSP Copy of an OracleAS Portal Page

To create the internal JSP by copying a standard page:

1. In the Navigator, locate the page you want to copy. In the choices listed next to that page, click Copy as JSP.

2. In the Name field, enter a name for the page. Note: The name is used internally and for direct access URLs. The name is limited to 40 characters and can contain only alphanumeric characters (A-Z, a-z, 0-9) and the underscore (_) character. Do not use spaces or other special characters.

3. In the Display Name field, enter a descriptive name for the page. Note: The display name is limited to 40 characters.

4. Select one of these choices:

■ Use Original Page's Portlet Instances if you want any future customizations made to the portlets on the original page to also be applied to the portlets on your JSP page.

■ Create Externally Published Portlets to create an externally published portlet for each portlet on the original page and use the externally published portlets on the JSP page. If you select this option, any future customizations made to the portlets on the original page will not affect the portlets on your JSP page.

5. Click OK to create the JSP page. The finished JSP is automatically stored for you within the OracleAS Portal system.

Page 21: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

21

If the standard page you are copying contains portlets, then the finished JSP page will also contain those portlets.

With the Portal page now in a JSP format, you can edit the JSP code using whatever tool you choose. You can augment or alter the JSP code as desired, although you need to retain the basic JSP tags.

To edit the JSP code:

1. Using the Navigator, locate your JSP page in the page group.

2. Click Download as JSP.

3. You browser displays the JSP file. Save it somewhere on your machine.

4. Use an editing tool to edit that saved copy.

5. Return to OracleAS Portal, and again use the Navigator to locate the JSP page.

6. Click on Properties.

7. Click the JSP Source tab.

8. In the area called JSP Source, enter the name and location of the file copy you have just edited. (You can browse to locate it.)

9. Click OK. This uploads the edited version into your OracleAS Portal JSP page.

2.2.2 Creating an internal JSP by importing an external JSP file

The following procedure assumes the external JSP file already exists, and that the JSP code follows the rules noted in the previous section.

1. In the Navigator, find the page group, and click Contents next to it.

2. Click Create in the Pages row.

3. In the Page Type list, choose JSP.

If you don’t see JSP as a choice in this list, it is because JSP access was not enabled for the page group, or the JSP page type has been excluded from the page group.

Page 22: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

22

4. Follow the steps in the page creation wizard. In Step 2 of the wizard, supply the name of your external JSP file. (You can browse to locate it.)

5. Click OK. The created page becomes an internal JSP that is an OracleAS Portal page incorporating your JSP file.

Notice that the name of this page is the name you gave it in the wizard; it is not the name of the JSP file.

2.3 Setting up Portlet Access

There are two types of portlets that your JSPs can access:

■ Externally published portlets

■ Standard portlets (portlets on standard pages)

Externally published portlets are specifically identified as being for JSP access. Standard portlets are shared; both standard OracleAS Portal pages and JSPs within the page group can access a single instance of the portlet.

Portlets are referred to by name in your JSP. Remember that these names are case-sensitive.

There is nothing special you need to do to make a standard portlet accessible. However, you need to do the following to make a portlet accessible as an Externally Published portlet:

1. In the Navigator, find the target page group, and click Contents in that row.

2. Click Create in the Externally Published Portlets row. (If you don’t see this choice, then JSP access has not been enabled for this page group.)

3. In the Portlet Name field, enter a name to identify the portlet. (This is the name you will use in the portlet call in your JSP.)

4. Drill down in the Portlet Repository area and click the desired portlet.

5. Click OK. The portlet has now been made an externally published portlet in this page group.

If you are unsure of the name of a standard portlet, you can edit the page on which it appears, and find the portlet name on the Edit Portlet Instance screen.

Page 23: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

23

In certain circumstances, the generated portlet name can be quite long. You can edit this name (in the list of externally published portlets in the Navigator) and create a shorter and more meaningful name. However, if you change the name, remember to also change the corresponding references in your JSP file.

3 Connecting External JSPs via the Configuration File

Because almost any JSP using the tag library can request OracleAS Portal portlet content, there is a need for a secure way to ensure that only approved JSPs obtain access. You control access through two mechanisms:

■ the usePortal tag in the JSP file

■ an external JSP configuration file.

The configuration file identifies the Portal instances, and page groups within those instances, to which an external JSP will be allowed to have access.

The specific coding requirements of a configuration file are explained below.

Your completed configuration file must then be identified to OracleAS Portal. This step is also explained below.

3.1 Contents of your JSP Configuration File

The required tags are:

- <jsp>

- <portal>

- <database>

- <url>

- <cookie>

- <pageGroups>

- <pageGroup>

Page 24: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

24

Tag contents and usage is as follows:

3.1.1 <jps>

A container tag that provides a list of portal instances to which external JSPs can have access.

Opening tag: <jps version="1.0">

Closing tag: </jps>

Version must be set to "1.0" for the current OracleAS Portal release.

3.1.2 <portal>

A tag to describe an individual portal instance.

Opening tag <portal name="MyPortal" default="true">

Closing tag </portal>

Tag attribute values:

Note: only ONE default portal is allowed per configuration file.

attribute value

name Any descriptive name given to a portal instance. Portal name must be unique within a configuration file.

default A "true" or "false" flag indicating whether this portal is a default portal instance that would be used if a usePortal tag did not specify a portal name. If you provide no value, default is set to "false".

Page 25: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

25

3.1.3 <database>

A tag to provide database connection information about a given portal instance.

<database data-source="jdbc/MyPortal"/>

Data-source attribute value is the name of the data source, which must be specified in the data-sources.xml file located in the $J2EE_HOME/config directory.

Here is an example of a data-source definition:

<data-source

class="com.evermind.sql.DriverManagerDataSource"

name="MyPortal"

location="jdbc/MyPortal"

xa-location="jdbc/xa/MyPortal"

ejb-location="jdbc/MyPortal"

connection-driver="oracle.jdbc.driver.OracleDriver"

username="portal_app"

password="portal_app"

url="jdbc:oracle:thin:@xyz.oracle.com:1521:orcl"

inactivity-timeout="30"

/>

Username and password attributes must be set to the Portal application schema username and password.

3.1.4 <url>

This tag provides connection information to the Portal instance.

Page 26: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

26

<url protocol="http" host="defg.oracle.com" port="7500" path="/pls/portal"/>

Tag attribute values:

3.1.5 <cookie>

This tag describes the Portal cookie.

<cookie name="portal" maxAge="-1" path="/" domain=".oracle.com"/>

Tag attribute values:

attribute value

protocol The name of the protocol used to connect to portal. Currently, only http and https protocols are supported. If you do not specify a protocol attribute, the default will be "http".

host The machine name for the Portal middle-tier.

port Port number. If no port is specified, the default number will be 80.

path For this release, must be set to "/pls/<PORTAL-DAD-NAME>".

attribute value

name The name of the cookie. This must be the same as the portal instance cookie name. Name is a required attribute of the cookie tag.value

maxAge The maximum age of the cookie, specified in seconds. Specify a value of -1 if you want the cookie to persist until browser shutdown. MaxAge is a required attribute of the cookie tag.

Page 27: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

27

3.1.6 <pageGroups>

This tag forms a container for the pageGroup tags.

Opening tag: <pageGroups>

Closing tag: </pageGroups>

This tag has no attributes.

3.1.7 <pageGroup>

This tag describes each individual page group’s properties.

<pageGroup name="JPSDemo" key="welcome" default="true"/>

Tag attribute values:

path The path on the server to which the browser returns this cookie. Path is a required attribute of the cookie tag.

domain This attribute should be specified only if changes were made to the SSO portlet cookie configuration. See the SSO documentation.

attribute value

name The page group name. This must be the name given to the page group when it was created in Portal.

attribute value

Page 28: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

28

Note: only ONE default page group is allowed per portal instance.

3.1.8 Example of a JSP Configuration File

The following is an example of a JPS configuration file:

<jps version="1.0">

<portal name="MyPortal" default="true">

<database data-source="jdbc/MyPortal"/>

<url host="xyz.oracle.com" port="7500" path="/pls/portal"/>

<cookie name="portal" maxAge="-1" path="/" />

<pageGroups>

<pageGroup name="JPSDemo" key="welcome" default="true"/>

<pageGroup name="JPSDemo2" key="welcome" default="false"/>

</pageGroups>

</portal>

<portal name="AnotherPortal">

<database data-source="jdbc/AnotherPortal"/>

<url protocol="http" host="abc.oracle.com" port="8888" path="/pls/portal90"/>

key The page group’s key. The value must match the "Access Key" value that was assigned to the page group in Portal in the "JSP Access Properties" area. (Note that a Portal page group identified here must have "JSP Access" enabled.)

default A flag set to "true" or "false" indicating whether or not this page group is the default page group within this portal instance. A default page group is the one used in the usePortal tag if no page group name is supplied. If no value provided for default in this pageGroup tag, it will be set to "false".

attribute value

Page 29: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

29

<cookie name="portal90" maxAge="-1" path="/" />

<pageGroups>

<pageGroup name="JPSDemo" key="welcome"/>

<pageGroup name="JPSDemo1" key="welcome1"/>

<pageGroup name="JPSDemo2" key="welcome2"/>

<pageGroup name="JPSDemo3" key="welcome3"/>

<pageGroup name="JPSDemo4" key="welcome4"/>

</pageGroups>

</portal>

</jps>

3.2 Location of Your JPS Configuration File.

By default, the name of configuration file is assumed to be wwjps.xml, and the default location of the file is in:

$J2EE_HOME/applications/portal/portal/WEB-INF

However, your configuration file can have any other name, and can be located any-where in the file system.

You specify the location via a context parameter in the web.xml file, which is located in the directory $J2EE_HOME/applications/portal/portal/WEB-INF.

The context parameter in the web.xml file is:

<context-param>

<param-name>oracle.webdb.service.ConfigLoader</param-name>

<param-value>/WEB-INF/wwjps.xml</param-value>

<description>This parameter specifies the location of the JPS configuration

file </description>

Page 30: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

30

</context-param>

3.3 External JSP login

External JSPs can be categorized by their login requirements:

■ "public" JSPs, which do not require login (or to which users login through the OracleAS Portal login link)

■ "protected" JSPs, which do require login.

Protected external JSPs have additional setup requirements. These are explained in the next section.

4 Setting up a JAZN file for external communication

The following steps are required only for "protected" external JSPs -- that is, exter-nal JSPs that require login.

In the external JSPs, if you need to log in to the portal, you need to use the following tag syntax.

<portal:usePortal id="AnyPortal" pagegroup="AnyPageGroup" login="true" />

When you execute this JSP, you will be redirected to the login server if you are not already logged on. In order to make this work, you need to do the following

• Set up mod_osso (if not already set up)

Page 31: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

31

• Set up JAZN with LDAP

Each of these procedures is described below.

4.1 Set up mod_osso

By default, your Oracle HTTP Server is registered with the login server. The following steps are given here only if that has been changed, and re-registration is necessary.

4.1.1 Register your Oracle HTTP Server with the Login ServerYou need to register your Oracle HTTP Server with the login server as a partner application. To do so:

1. Go to your login server home

e.g. http://webdbsvr2.us.oracle.com:3000/pls/portal_sso/

2. Login: portal_sso/portal_sso

3. Go to SSO Server administration: Administer Partner applications: Add Partner Application

4. Enter the following at the prompts.

Name: Oracle HTTP Server (any name)

Home URL: http://webdbsvr2.us.oracle.com:3000/

Success URL: http://webdbsvr2.us.oracle.com:3000/osso_login_ success

Logout URL: http://webdbsvr2.us.oracle.com:3000/osso_logout_ success

Click the Apply button. Keep a record of the values that are displayed. You will need these values in the next step.

4.1.2 Create a directory file

Create a file (for example, portal.clr) based on the following example.

Replace the values in this example file with the values you got in the previous step (when you registered your application).

Page 32: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

32

Example of a Directory File

sso_server_version=v1.2

cipher_key=95CFC0004E594CB3

site_id=1325

site_token=NCZ4UZMV1325

login_url=http://webdbsvr2.us.oracle.com:3000/pls/portal_sso/portal_sso.wwsso_a

pp_admin.ls_login

logout_url=http://webdbsvr2.us.oracle.com:3000/pls/portal_sso/portal_sso.wwsso_app_admin.ls_logout

cancel_url=http://webdbsvr2.us.oracle.com:3000/pls/portal_sso/

After making your changes in the above file, place the file in the directory

<Oracle HTTPhome>/Oracle HTTP/Oracle HTTP/conf/osso/

4.1.3 Run Oracle HTTP osso.conf

Go to <Oracle HTTPhome>/Oracle HTTP/Oracle HTTP/conf/osso/

and run:

<Oracle HTTPhome>/Oracle HTTP/Oracle HTTP/bin/apobfuscate portal.clr osso.conf

4.1.4 Uncomment the httpd.conf file

In your httpd.conf file, make sure you have the following line uncommented:

include "<Oracle HTTPhome>/Oracle HTTP/Oracle HTTP/conf/mod_osso.conf"

For further understanding and other required steps, please consult the Login Server administration guide.

Page 33: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

33

4.1.5 Restart the Oracle HTTP Server

After finishing the above steps, restart the Oracle HTTP Server.

4.2 Set up JAZN with LDAP

Please refer to the configuration chapter in the JAZN Developer's Guide to set up your web server with JAZN using LDAP.

Confirm that the JAZN is working with the LDAP. (You can use the demo provided by the JAZN.)

Do the following additional step:

Go to <j2eehome>/application-deployments/portal/orion-application.xml

and add the following:

<jazn provider="LDAP" location="ldap://<OIDHOST>:389"

default-realm="oracle" >

<jazn-web-app auth-method="SSO" />

</jazn>

Port number 389 is a default port for LDAP servers. However, any other port can be assigned. Contact your OID Administrator to obtain <host> and <port> information.

5 Other JSP Considerations

Page 34: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

34

5.1 Configuration File for Internal JSPs

Out of the box, no configuration file changes are needed to run internal JSPs. All configuration parameters have default values and are supplied in the web.xml file under Portal application.

However, there are two parameters that can be changed, if you require. The following servlet parameters in the

$J2EE_HOME/applications/portal/portal/WEB-INF/web.xml file

are used by internal JSPs:

1. jspRoot - relative directory name where internal JSPs will be downloaded.

2. jspSrcAlias - alias used for jspRoot. In most cases, should match the jspRoot directory name.

The default values in web.xml file are:

<init-param>

<param-name>jspRoot</param-name>

<param-value>internal_jsp</param-value>

</init-param>

The jspRoot directory name is relative to the Portal application, which means the internal JSP directory will be:

$J2EE_HOME/applications/portal/portal/internal_jsp

<init-param>

<param-name>jspSrcAlias</param-name>

<param-value>/internal_jsp/</param-value>

</init-param>

Page 35: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

35

If none of these parameters are specified (that is, they have been manually removed from the web.xml configuration file), the values for jspRoot and jspSrcAlias will default to the following:

■ jspRoot - jsp, which is, again, relative to the Portal application home $J2EE_HOME/applications/portal/portal/jsp

■ jspSrcAlias - /jsp/

5.2 Known Issues

For known issues in Release 9.0.4 that affect JSPs, see the OracleAS Portal Release Notes.

Page 36: Oracle Application Server Integrating JavaServer Pages with OracleAS Portal

36