reset portlet data


We have a web application (legacy) with an iframe for a portlet in MWS. Outside the iframe there is a link to create a new request which will takes to the portlet inside the iframe.
The first time the portlet fields are all empty which is correct. Then we set some data to the fields and submit the form. If we click back again on the link to create a new request the portlet will show us the exact some data. I understand this is due to the JSF framework which just restores the view and returns. But how can I reset the data, just as if this was the first time?

We have tried to change the view Managed Bean Scope to Request, but this didn’t work.



we’ll be resetting the fields on the submit action before the render response.
This solution is valid because we’ll not be refreshing (on the browser) the area with the fields unless it comes from the new request link.


Hi Bruno,
This might give you a problem if your view has any hidden command controls, like refreshing the page on selection of a dropdown or checkbox.
beforeRenderResponse gets invoked everytime a page refresh is done either partially completely.

Instead of re-setting the fields in beforeRenderResponse, you can reset the fields once you submit the request and before returning to a different page.

other way is, if you are using an ExtendedPortletUrl to navigate to this page then if you set the reset state property to true.


We had a similar use case where we have an iFrame which renders a portlet view upon clicking a Simple Link outside the iFrame. The slight difference is that the portlet is not empty but instead loads with some information, (for eg. Table of Pending Invoices) with the ability to submit the form after user chooses to set some Flags on chosen Invoices.

So far so good. There is another link that must display Table of Pending Invoices Greater than $1,000,000.00 ( you wish :wink: !!). We chose to reuse the previous portlet to display this table by invoking the same webservice with a different Input.

Now the fun part. If the user chooses to see the list of Pending Invoices and then to see the list of High Value Invoices (without submitting the previous form), the previous data is still displayed.

Ok, I know the reason why. It is because the Form has already been “initialized” and the “initialize” method does not get executed. Fair enough, I set “initialized = false” in the initialize method after initializing. This worked almost fine. But, this had side effects in that if the user had entered some data in the rows and navigated to other data pages, the entered data was lost.

We tried a few more things, but we were hard pressed on time and chose to create a new portlet.

Perhaps an Extended Portlet URL with Reset State = true is ideal for this use case.

This use case will become more and more common and the ability to have reusable portlets would largely help in gaining client’s confidence on Rapid Application Development.

I saw there was a new method callInitialize (perhaps introduced in CAF 8.0) in the BasePortletPageBean but could not find any Java Docs on this.

How do you suggest we handle cases like this?

If you control the links getting to the portlet, then i would recommend attempting to use the ExtendedPortletURL’s resetState property.

If not, you’ll need to figure out a different technique for resetting your managed beans. I’m not sure that i would mess with the initialized state for this however.