# How Do I: Enable the forkPreRender Attribute

With SP5 you now have the ability to thread the “preRender” lifecycle as well as or instead of the “render” lifecycle. If your portlets communicate with external systems during this lifecycle you might want to implement pre-render forking. Note that if you are using page flows, the initial begin actions and refresh actions run during the preRender phase.

The attribute forkPreRender enables forking (that is, multithreading) in the preRender lifecycle phase. Setting forkPreRender to true indicates that the portlet’s preRender phase should be forked. As with render phase forking, preRender phase forking is only possible if the portlet’s forkable attribute is set to true.

preRender forking is supported by these portlet types:

- JSP
- Page Flow
- JSR 168
- WSRP (Consumer portlets only)

If you are threading portlets (that is, using forkable=true) ensure that you configure a portalRenderQueue and/or portalPreRenderQueue in your config.xml file so that the forked portlets use their own thread pools and not the WebLogic thread pool. The following code sample describes how to set the thread count appropriately:

<ExecuteQueue Name="default" ThreadCount="15"/>
<ExecuteQueue Name="portalRenderQueue" ThreadCount="5"/>
<ExecuteQueue Name="portalPreRenderQueue" ThreadCount="5"/>

At this time, forkPreRender is not supported by either the WebLogic Workshop interface or the WebLogic Portal Administration Portal. Instead, you need to implement it at the code level in the .portlet file. This topic describes how to enable the forkPreRender attribute for each portlet type.

## JSP Portlet

To enable forkPreRender on a JSP portlet:

1. Open the .portlet file for the specific portlet in any editor and locate the <netuix:javaPortlet> element.
2. Add the attribute forkPreRender=true within that element, as shown in the following code snippet:

    <?xml version="1.0" encoding="UTF-8"?>
       <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
          xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0
          portal-support-1_0_0.xsd">
          <netuix:portlet backingFile="com.bea.backing.jspBacking" definitionLabel="portlet_2"
             forkPreRender="true" forkRender="true" forkRenderTimeout="20" forkPreRenderTimeout="20" forkable="true"
             title="jspPortlet">
                <netuix:titlebar>
                   <netuix:maximize/>
                   <netuix:minimize/>
                </netuix:titlebar>
                <netuix:content>
                   <netuix:jspContent contentUri="/portlets/jspPortlets/jspPortlet.jsp"/>
                </netuix:content>
          </netuix:portlet>
       </portal:root>

## Page Flow Portlet

To enable forkPreRender on a Page Flow portlet:

1. Open the .portlet file for the specific portlet in any editor and locate the <netuix:javaPortlet> element.
2. Add the attribute forkPreRender=true within that element, as shown in the following code snippet:

    <?xml version="1.0" encoding="UTF-8"?>
    <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
       xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0
       portal-support-1_0_0.xsd">
       <netuix:portlet backingFile="com.bea.backing.pfBacking" definitionLabel="portlet_1"
          forkPreRender="true" forkRender="true" forkRenderTimeout="20" forkPreRenderTimeout="30" forkable="true"
          title="PfTest1Controller">
             <netuix:titlebar>
                <netuix:maximize/>
                <netuix:minimize/>
             </netuix:titlebar>
             <netuix:content>
                <netuix:pageflowContent contentUri="/portlets/pfPortlets/pfTest1/pfTest1/PfTest1Controller.jpf"/>
             </netuix:content>
       </netuix:portlet>
    </portal:root>

## JSR 168

To enable forkPreRender on a JSR168 portlet:

1. Open the .portlet file for the specific portlet in any editor and locate the <netuix:javaPortlet> element.
2. Add the attribute forkPreRender=true within that element, as shown in the following code snippet:

    <?xml version="1.0" encoding="UTF-8"?>
       <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
          xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0
          portal-support-1_0_0.xsd">
       <netuix:javaPortlet backingFile="com.bea.backing.javaBacking" definitionLabel="javaPortlet_1"
          forkPreRender="true" forkPreRenderTimeout="30" forkRender="false" forkRenderTimeout="20"
          forkable="true" title="Java Portlet"/>
    </portal:root>

## WSRP Consumer Portlet

To enable forkPreRender on a WSRP Consumer portlet:

1. Open the .portlet file for the specific portlet in any editor and locate the <netuix:javaPortlet> element.
2. Add the attribute forkPreRender=true within that element, as shown in the following code snippet:

    <?xml version="1.0" encoding="UTF-8"?>
       <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
          xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0    portal-support-1_0_0.xsd">
          <netuix:proxyPortlet backingFile="com.bea.backing.wsrpConsumerBacking" cacheExpires="300"
             definitionLabel="portlet_1_1" description="" doesUrlTemplateProcessing="true"
             forkPreRender="true" forkPreRenderTimeout="20" forkRender="true" forkRenderTimeout="20"
             forkable="true" groupId="producerWA" portletHandle="portlet_1" producerHandle="wsrpProducer"
             renderCacheable="true" templatesStoredInSession="true" title="producerTest">
             <netuix:titlebar>
                <netuix:maximize/>
                <netuix:minimize/>
             </netuix:titlebar>
             <netuix:proxyPortletContent/>
          </netuix:proxyPortlet>
       </portal:root>

### See also

How Do I: Enable the forkPreRenderTimeout Attribute

Portlet Properties