myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matija Mazi (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-1359) PortletExternalContextImpl.encodeNamespace called during portlet ActionRequest
Date Fri, 03 Nov 2006 09:12:17 GMT
    [ http://issues.apache.org/jira/browse/MYFACES-1359?page=comments#action_12446874 ] 
            
Matija Mazi commented on MYFACES-1359:
--------------------------------------

I accidentally clicked the "Provide patch" link and changed the status of the issue; now I
can't revert it. Sorry. Probably something should be done about it?

> PortletExternalContextImpl.encodeNamespace called during portlet ActionRequest
> ------------------------------------------------------------------------------
>
>                 Key: MYFACES-1359
>                 URL: http://issues.apache.org/jira/browse/MYFACES-1359
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: Portlet_Support
>    Affects Versions: 1.1.5-SNAPSHOT
>         Environment: Facelets + Liferay 4.0.0
>            Reporter: John Singleton
>         Attachments: PortletExternalContextImpl.java.patch
>
>
> Theis portlet fragment renders one of 2 components depending on the selection in the
selectOneMenu: 
> <div xmlns:f="http://java.sun.com/jsf/core"
>     xmlns:h="http://java.sun.com/jsf/html">        
>     <h:form>
>         <h:outputLabel for="list">foo</h:outputLabel>
>         <h:selectOneMenu value="${booleanTest.choice}" id="list"><f:selectItems
value="#{booleanTest.selectList}"/></h:selectOneMenu>
>         <h:commandButton action="#{booleanTest.doIt}"/>
>     </h:form>
>     <h:outputText rendered="#{empty booleanTest.list}" value="Empty"/>
>     <h:dataTable rendered="#{! empty booleanTest.list}" value="#{booleanTest.list}"
var="l" border="1">
>         <h:column>
>             <f:facet name="header"><h:outputText value="Column"/></f:facet>
>             <h:outputText value="#{l}"/>
>         </h:column>
>     </h:dataTable>
> </div>
> It's using this simple bean:
> public class BooleanTest {
>     private List<String> list =  new ArrayList<String>();
>     private List<String> emptyList = new ArrayList<String>();
>     private String choice = "Foo";
>     private List<SelectItem> selectList = null;
>     
>     public List<String> getList() {
>         if (choice.equals("Foo")) {
>             return emptyList;
>         } else {
>             if (list.isEmpty()) {
>                 list = new ArrayList<String>();
>                 list.add("Hello");
>                 list.add("World");
>                 list.add("!!!!!");
>             }
>             return list;
>         }
>     }
>     
>     public String doIt() {
>         return "success";
>     }
>     public List<SelectItem> getSelectList() {
>         if (selectList == null) {
>             selectList = new ArrayList<SelectItem>();
>             selectList.add(new SelectItem("Foo", "Foo"));
>             selectList.add(new SelectItem("bar", "bar"));
>         }
>         return selectList;
>     }
>     public String getChoice() {
>         return choice;
>     }
>     public void setChoice(String choice) {
>         this.choice = choice;
>     }
> }
> When I first add this portlet to a page, I get the drop down list, the submit button
and the "empty" message. If I select the 'bar' entry in the list and click submit I get the
error, " Can not call encodeNamespace() during a portlet ActionRequest"
> It seems to be because MyFacesGenericPortlet.processAction calls lifecycle.execute, which
in turn starts createing components for the table (which wasn't in the first call to the page).
This calls encodeNamespace for the new componenet IDs and thats when it falls over.
> I fixed this by changing PortletExternalContextImpl.encodeNamespace to return null instead
of throwing an IllegalStateException. My application seems to be working well with this solution,
but I don't know if it might have any knock on effects?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message