+

Search Tips   |   Advanced Search

Web Content Manager JSP tags

We use IBM Web Content Manager JSP tags with the Web Content Manager API to pull WCM content and components into external JSP applications.

A JSP referenced within a JSP component must not include a reference, directly or indirectly, to the same JSP component. This includes references within Web Content Manager tags or the API. If it does, a loop is created and the server will crash.

To use the Web Content Manager JSP tags, the following directive must be provided in the JSP:

<%@ taglib uri="/WEB-INF/tld/wcm.tld" prefix="wcm" %>

Storing JSP Files:

JSP files can be located:

Writing JSP to be referenced within a JSP component:

The setExplicitContext and setContext tags are not required when displaying a JSP file with a JSP Component. They are only required when directly accessing a JSP file.

Reloading JSP files:

JSP files referenced by Web Content Manager are reloaded once every 10 seconds. If you update a JSP file, you may need to wait for it to be reloaded before the changes will be displayed.


InitWorkspace tag

This is used to set the initial workspace.

<wcm:initworkspace username=" " password=" " >
[Error Message]
</wcm:initworkspace>

Parameter Details
username The user name of a valid Web Content Manager user.
password The password for the valid Web Content Manager user.


Explicit context tag

This sets the path to the Web Content Manager server. This is not required in JSP that is displayed via a JSP component.

<wcm:setExplicitContext wcmWebAppPath=" " wcmServletPath=" " path=" "
 requestParameters" " prefix=" " project=" " >
[Error Message]
</wcm:setExplicitContext>

Parameter Details
wcmWebAppPath The URL up to the web application. For example: http://localhost:10040/wps/wcm
wcmServletPath The servlet path to the Web Content Manager servlet. For example: /connect
path The path to the content and site areas. For example: /Site Area A/ Site Area B/Content C
requestParameters You specify java Map request parameters to set in the context. These parameters can be used by menu components that are rendered via the JSP that use a query string.
project The name of the project to set in the context. If the corresponding project cannot be found, it will be ignored and an error will be logged. An empty string is used to clear any project previously set in the context.

The project, wcmWebAppPath and wcmServletPath parameters are optional. However, if wcmWebAppPath is specified, wcmServletPath must also be specified.

Developers can add insert context tags at any place in the page and it will change the context for the rest of the page execution, but the tags cannot be nested.


Context retrieval tag

Sets the context given the location of a path string. This is not required in JSP that is displayed via a JSP component.

<wcm:setContext location=" "  wcmWebAppPath=" " wcmServletPath=" " param=" " project=" " defaultPath=" " >
[Error Message]
</wcm:setContext>

Parameter Details
location This sets the context of the location of a path string. Either:

    location="query"

    The context is obtained from the query parameter.

    location="request"

    The context is obtained from the value of the request.

    location="session"

    The context is obtained from the value of the current session.

    location="portalContext"

    This is used to define the path of a site area or content item that will be used as the current context of a page. For example: /library1/sitearea3/content4

    location="portalMapping"

    This is used to define the path of a site area or content item that will be used as the default site area of a page. For example: /library1/sitearea3

wcmWebAppPath The URL up to the web application. For example: http://localhost:10040/wps/wcm
wcmServletPath The servlet path to the Web Content Manager servlet. For example: /connect
param This is the name of the parameter that the path string will be in.
project The name of the project to set in the context. If the corresponding project cannot be found, it will be ignored and an error will be logged. An empty string is used to clear any project previously set in the context.
defaultPath If the location parameter does not resolve to a valid location, then the value of the defaultPath is used. For example: /library2/sitearea1

The project, wcmWebAppPath , wcmServletPath, and defaultPath parameters are optional. However, if wcmWebAppPath is specified, wcmServletPath must also be specified.

Developers can add context tags at any place in the page and it will change the context for the rest of the page execution, but the tags cannot be nested.


Render tags

These are equivalent to element and component tags.


Error handling

The following tag can be added to error messages to enable error handling:

<%=error%>


Plugin tag

Render plug-ins can be referenced within JSP code using a plugin tag:

<wcm:plugin name=" " param1="value" param2="value2" >

// Your text.

</wcm:plugin>
See Create a plug-in tag for further information.


Parent: The IBM Web Content Manager API