Forums

RSS RSS
set PortletMode in JSF portlet Flat View
Threads
set PortletMode in JSF portlet
jsf portletmode
4/9/10 5:38 AM
I have a problem in controlling the PortletMode back to View after changing the preferences; on a Save or Back button;
Note: navigation works but if you return to /web/guest/home you'll see the EDIT page

I tried several things;
#1 Override com.sun.faces.portlet.FacesPortlet's processAction;
 1
 2public void processAction(ActionRequest request, ActionResponse response) throws IOException, PortletException {
 3        PortletMode portletmode = request.getPortletMode();
 4        if (PortletMode.EDIT.equals(portletmode)) {
 5            response.setPortletMode(PortletMode.VIEW);
 6        } else if (PortletMode.HELP.equals(portletmode)) {
 7            response.setPortletMode(PortletMode.VIEW);
 8        }
 9
10        super.processAction(request, response);
11
12    }

To some extend this works but only if you 'Save' to the same page eg return on action = "" and then press Back.
1public String doSaveEditPage() {return "";}

1public String doBackEditPage() {return "toview";}


#2 set ActionResponse from FacesContext
1protected void setPortletModeToView() {
2  ActionResponse action_response = (ActionResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
3 action_response.setPortletMode(PortletMode.VIEW);
4
5}


Even example portlets like guessnumber show same problems;

Anyone please it's driving me crazy! emoticon

using
jsf-api_1.1.jar (1.1_02-b08) Sun
jsf-impl_1.1.jar (1.1_02-b08) Sun
jsf-portlet_1.1.jar (1.1.6) Sun
Flag Flag
RE: set PortletMode in JSF portlet
4/9/10 5:47 AM as a reply to Corné Aussems.
Replicatable with this portlet

Deploy portlet (guessnumberportlet.war ) on /web/guest/home

>> Change preferences;
>> Press Submit;
>> navigate to /web/guest/home (by logo or nav):

BTW pressing "Return to Full Page" will solve the issue
Attachment

Attachments: ScreenShot524.png (7.6k), guessnumberportlet.war (1,568.0k)
Flag Flag