user1958756
user1958756

Reputation: 377

How to refresh a single portlet in IBM Websphere Portal 7.0

I've been tasked with making a portlet on our landing page refresh, without refreshing the rest of the page, because it will probably kill our servers. If the whole page refreshed every time these settings would change. Buying new servers or optimizing our setup isn't an option at the moment.

Upvotes: 2

Views: 452

Answers (2)

Ankur Singh
Ankur Singh

Reputation: 21

You can use the Serve Resource method for this purpose. Please note this feature is only available for JSR 286 Portlets. If you are still using JSR 168, this feature won't be available.

How to implement:

Add Serve resource URL of your portlet - Use OOB portlet tags. The portlet can create resource URLs pointing back to itself in the following ways:

By invoking the createResourceURL() method of the RenderResponse object or ResourceResponse object By using the resourceURL tag (for example, portlet:resourceURL) When an end user invokes such a resource URL, the portlet container calls the serveResource() method of the portlet and renders the content returned by the serveResource call. You can also set a resource ID of the resource URL to enable the same serveResource() to serve multiple resources.

The serveResource method can also be used to implement Ajax use cases by invoking the resource URL through the XMLHttpRequest(or XMLPortletRequest) in client-side JavaScript code. The client-side code of the portlet can be refreshed thru AJAX call.

Upvotes: 2

ShaneQful
ShaneQful

Reputation: 2236

If you change your portlet to a Resource Serving Portlet, you can then use the serveResource method and a resourceURL which doesn't refresh the page when called.

You'll also have to write a little JS to interact with the resourceURL via AJAX requests.

Upvotes: 2

Related Questions