Resetting the JSF Portlet State

Consider a JSF Portlet having a navigation(what is a JSF app without navigation!!), for example a Search JSF Portlet. It has two pages, "Search Criteria Page" and "Search Results Page".  After you enter the criteria on "Search Criteria Page" and click submit, you will get a "Search Results Page". Add this JSF Portlet on a page in Web Space or Liferay. Now visit some other page and comeback to the page on which you added the JSF Portlet, you will see that it is showing "Search Results Page", i.e the state is retained. This is as per spec and is the correct behaviour. What if you want to see "Search Criteria Page" everytime you visit the page. This can be achieved as follows.

1. In your JSF Portlet, add the following init parameter in the portlet.xml

        <init-param>
            <name>com.sun.faces.portlet.CLEARING_STATE_ENABLED</name>
            <value>true</value>
        </init-param>

2. In Web Space / Liferay, Click on "Manage Pages"

Manage Pages Drop Down

3. Select the page that has JSF Portlet(in this example, i have it on "jsftest" page). In the "Query String" textfield, enter the value com.sun.faces.portlet.CLEAR_STATE=true. Save the page.

Manage Pages

Now whenever you visit the page you will see the "Search Criteria Page". But if you are doing any action on any other portlet on that page, "Search JSF Portlet" will retain the state. It will not reset to "Search Criteria Page". Resetting happens only when you visit the page. This means, suppose, there is another JSR286 portlet or a JSF Portlet on that page and "Search JSF Portlet" shows "Search Results Page". If you are doing any action on the other portlet and after the page is rendered, "Search JSF Portlet" will continue to show "Search Results Page".

Comments:

Any particular portal pack to be used?

Posted by Hitesh on March 23, 2010 at 04:32 AM IST #

You need to use the latest JSF Portlet Bridge. Regarding the portal pack, it will be integrated in the next release. The workaround to use the latest bridge in portal pack 3.0.3 is as follows

1. Download the latest jsf-portlet.jar and rename it to ajsf-portlet-1.2.4.jar

2. Get the Visual Web Portlet Plugin( portal-pack-plugin-3_0_3_addons_vwp.zip)

3. Replace ajsf-portlet-1.2.4.jar that is present in org-netbeans-modules-portalpack-jsfportletbridge.nbm with the one from #1. Inside org-netbeans-modules-portalpack-jsfportletbridge.nbm, the ajsf-portlet.jar is present in netbeans\\modules\\ext\\portalpack\\jsfportletbridge. .nbm file can be treated as zip and you can use any zip utility to replace the file.

Posted by Deepak Gothe on March 23, 2010 at 06:04 AM IST #

Hi Deppak
Thanx for some wonderful articles. However I would require your help in resetting the JSF portlet state in IBM WebSphere Portal. I tried this article given by IBM support and it did not work for me as also for a few others.

http://www-01.ibm.com/support/docview.wss?uid=swg21299059

Whats ur suggestion ? Its reallu urgent .. Thanx for your time.

Neel.

Posted by NILANJAN CHAUDHURI on April 22, 2010 at 07:20 PM IST #

Hi Nilanjan,
Thanks.
Sorry i am not aware of JSF Portlet bridge used in IBM WebSphere Portal. Did you raise your issue in the feedback form in that article.

Posted by Deepak Gothe on April 23, 2010 at 03:46 AM IST #

Hi Deepak, can you explain how we set the porlet state in weblogic portal

Posted by guest on October 03, 2011 at 02:37 AM IST #

Resetting the JSF portlet state needs support from the portal. I am not aware of weblogic portal. You may want to check in the weblogic portal forum whether a page takes a query string.

Posted by Deepak on October 05, 2011 at 09:15 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Deepak Gothe

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today