How to deploy and access portlets from WAS ?

Here is a new feature which IBM has put in a portlet container into WAS 7 and later. Try the following steps.

Portlets cannot run on WAS supplied with portal or on the WAS on which Portal server is running on your machine so you need to deploy and run the portlets on server1 instance and not WebSphere_Portal i.e separate standalone WAS.

If you try to run the portlet on the WAS on which portal server is running you might get an error such as "Direct portlet access prevented by WebSphere Portal".

To access the admin console of server1 instance use the following URL

https://localhost:9043/ibm/console/login.do?action=secure

Deploy the war containing 1 or more portlets on WAS server.

  • Provide the context root (e.g. /sample)
  • Select server as server1.
  • Follow the steps to complete the installation
  • Make sure war file is started after the installation is completed

Now hit the following URL in the browser to see the portlet

http://localhost:9080/sample/Portlet1

where /sample is the context root of the application and and Portlet1 is the portlet name defined in the portlet.xml

By hitting the above URL one should be able to see the portlet from WAS though basic features of portal will be missing from portlets as its running from WAS.

WebDav Client on Linux

"Web Distributed Authoring and Versioning (WebDAV), an extension to the HTTP-protocol, allows authoring of resources on a remote web server. davfs2 provides the ability to access such resources like a typical file system, allowing for use by standard applications with no built-in support for WebDAV." (http://savannah.nongnu.org/projects/davfs2)

This is the easy way of mounting a webdav share from the command line.

1. Install davfs2

sudo yum install davfs2

2. Mount remote resource (you might be prompted for credentials)

sudo mount -t davfs http://localhost:8000/webdav /mnt/dav

3. Access the remote resource locally in /mnt/dav directory.

Enabling Two-Phase rendering support in JSR 286 Portlets

By default, two-phase rendering is turned off. To enable two-phase rendering for a portlet, you must update the portlet.xml deployment descriptor for the portlet.

By enabling Two-Phase Rendering, one can setup cookies, http headers or page title dynamically.

Add the following entry to the file:

<portlet>
...
<container-runtime-option>
<name>javax.portlet.renderHeaders</name>
<value>true</value>
</container-runtime-option>
</portlet>


How to enable / disable Edit Mode on Portal pages?

By default, the administration pages are not intended to be edited, those pages are excluded from the edit mode features provided by the site tool bar in WebSphere Portal 8.0.

When you navigate to an administration page, the site tool bar automatically exits edit mode. The edit mode features are suppressed by the page parameter theme.disable.edit.mode on the Administration page label (unique name wps.Administration). Setting the parameter on the top-level administration page also causes the child pages to be affected.

You can set the theme.disable.edit.mode parameter on any page where you want to disable edit mode in the site tool bar. Edit the properties of the page, and add the theme.disable.edit.mode parameter with a value of true.


Edit Mode
In custom home page, we can set “theme.disable.edit.mode” to true.

Edit Mode


Edit Mode

Synchronizing Portal Pages with Portal Site library in WebSphere Portal Server 8.0

When you disable the manged page, Portal Site library no longer automatically synchronized with the page structure.

After enable manged pages feature, you can resynchronize the Portal Site library based on the current portal page structure that is stored in the portal database. When performing this synchronization, the portal database acts a master repository. Any portal page site areas in the Portal Site library that do not correspond to existing portal pages are removed from the Portal Site library. Any content site areas or content items within the affected portal page site areas are also removed.

To perform this resynchronization, run the create-page-nodes configuration task.

ConfigEngine.bat create-page-nodes -DPortalAdminPwd=wpsadmin -DWasPassword=wpsadmin

Dynamic content spots in WebSphere Portal 8.0

Dynamic content spots and markup contributions are both techniques for adding HTML to a theme, with one important difference. Markup contributions are always placed at the end of the body of the page, while dynamic content spots render wherever they are placed in the theme HTML template.

When a module requires markup, use a markup contribution if it is not important where the module is in the page, such as with iWidget definitions. If the markup must appear in a particular spot in the theme, then a conditional dynamic spot is used.

In the portal 8.0 theme, there is a button in the banner to enter page Edit mode, or return to View mode.

In the theme HTML template, the button is rendered with this dynamic content spot:

<a rel="dynamic-content" href="dyn-cs:id:80theme_pageModeToggle"></a>

which maps to this URI through the WP_DynamicContentSpotMappings > Resource Environment Provider in WebSphere® Application Server:

res:/wps/defaultTheme80/themes/html/dynamicSpots/pageModeToggle.jsp, wp_toolbar

The wp_toolbar module contains the JavaScript resources necessary for page editing, so you only want the button to render when this module is on.

You can control contributing markup using a dynamic content spot

You can display a dynamic content spot only when a particular module is turned on. This is possible with the following format:

<a rel="dynamic-content" href="res:path/to/some/dynamic/content/spot.jsp, some_module_name"></a>

This means that the spot.jsp file is only processed when some_module_name is turned on.

How to transfer Objects from Action Phase to Render Phase ?

Generally we can send a String object from Action phase to Render phase ,but in case you are using JSR286 API for portlet development then we can also send objects. The following configuration changes are required.

Portlet.xml
<portlet>
...
<container-runtime-option>
<name>javax.portlet.actionScopedRequestAttributes</name>
<value>true</value>
</container-runtime-option>
</portlet>
 Portlet Class

public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {

Map userProfile = new HashMap();
userProfile.put("userName", "Arun");
request.setAttribute("userProfile", userProfile);
}

public void doView(RenderRequest request,RenderResponse response)
throws PortletException, IOException {

Map userProfile = (Map)renderRequest.getAttribute("userProfile");
}

Creating Portlets without using RAD

Nice article to refer to if you are keen to create portlets without using RAD tool.

http://theoreticaltechstuff.blogspot.in/2013/12/creating-portlets-without-rad-ibm.html







Updated WCM Content not getting syndicated from one environment to another


Root Cause: Event log records which track the changes of WCM contents were corrupted.

Fix applied

First enable the reset event log module by adding the following parameters to the WCM WCMConfigService service using the WebSphere® Integrated Solutions Console:

connect.businesslogic.module.reseteventlog.class=com.ibm.workplace.wcm.services.eventlog.ResetEventLogModule
connect.businesslogic.module.reseteventlog.remoteaccess=true
connect.businesslogic.module.reseteventlog.autoload=false

Restarted Portal Server

Ran the command ConfigEngine.bat wcm-reset-event-log to delete all change records.

http://infolib.lotus.com/resources/portal/8.0.0/doc/en_us/PT800ACD004/wcm/wcm_config_reset_event_log.html


Hiding a Portal page from Portal Navigation

Hiding portal pages (and other items) from Portal Navigation is a common requirement, but there is no obvious way to do this. There are some suggestions that using the Manage Pages portlet works, though I have not had any success with it. Here's how to do it:

First, use xmlaccess to export the page, label, or other item(s) that you need to hide from navigation. For a brief tutorial about xmlaccess exporting, the following article may be helpful: http://www-01.ibm.com/support/docview.wss?uid=swg21260098

<content-node action="update" active="true" allportletsallowed="false" create-type="explicit" domain="rel".... >
.....
<parameter name="com.ibm.portal.Hidden" type="string" update="set"><![CDATA[true]]></parameter>
.....
<content-node>

If the parameter already exists, just change the value within the CDATA block to "true" (to hide the page) or "false" (to show the page), depending on what you need.

Once you're done, save the xmlaccess file (make sure you keep a back up of your original export!) and reimport to your server. The changes should be visible to Portal Navigation on the next reload.

Portal Managed Pages

The below link guide WebSphere Portal developers and administrators on effectively using Managed Pages. Topics include developing pages and content, workflow, and staging to production.

http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Managed_Pages

Troubleshooting : Transaction Times Out after 120 seconds after server start

If your websphere application server is not getting restarted and you are getting transaction timeout errors in the logs then here is the quick solution to fix this issue.

TimeoutManage I WTRN0006W: Transaction 0000013DA170AA790000000C0000001A25566AF1FCED064A9CE73DD8F83E0E506FC2909E0000013DA170AA790000000C0000001A25566AF1FCED064A9CE73DD8F83E0E506FC2909E00000001 has timed out after 120 seconds.


1. Login to the WAS (Dmgr) admin console.

2. Navigate to: Servers > Application Servers > WebSphere_Portal > Container Services > Transaction service.

3. Change the Total Transaction Lifetime Timeout and Maximum Transaction Timeout to 600.

4. Save (and sync if in a cluster) the changes.

5. Clear out the transaction logs: /tranlog

6. Save your changes and restart the Portal.

Recent Posts

Reader Comments

Popular Posts

© 2011-2013 Web Portal Club