You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2014/02/13 22:52:20 UTC

[jira] [Resolved] (MYFACES-3853) ui:include not working inside c:forEach

     [ https://issues.apache.org/jira/browse/MYFACES-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe resolved MYFACES-3853.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.1
         Assignee: Leonardo Uribe

The fix is just append the last prefix in the counter chain instead calculate it using the counters. I have also synch the code with the one in 2.0.x and 2.1.x, but for those versions it doesn't have any effect. Thanks to Gonçalo Manuel Cruchinho for provide the example. 

> ui:include not working inside c:forEach
> ---------------------------------------
>
>                 Key: MYFACES-3853
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3853
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.2.0
>            Reporter: Gonçalo Manuel Cruchinho
>            Assignee: Leonardo Uribe
>            Priority: Critical
>             Fix For: 2.2.1
>
>
> Using ui:include inside a c:forEach cases a duplicate id error. This only happens if there is at least a second element to iterate.
> The exception is the following: java.lang.IllegalStateException: Client-id : <clientId> is duplicated in the faces tree.
> Below there's an example of a test case that replicates the problem.
> Test Case
> Myfaces22ForEach.java
> @ManagedBean(name = "myfaces22foreach")
> @SessionScoped
> public class Myfaces22ForEach {
> 	private List<String> pageList;
> 	public List<String> getPageList() {
> 		if (pageList == null) {
> 			pageList = new ArrayList<String>();
> 			pageList.add("page1.xhtml");
> 			pageList.add("page2.xhtml");
> 		}
> 		return pageList;
> 	}
> 	public void setPageList(List<String> pageList) {
> 		this.pageList = pageList;
> 	}
> }
> myfaces22foreach.xhtml
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html
> 	xmlns="http://www.w3.org/1999/xhtml"
> 	xmlns:h="http://java.sun.com/jsf/html"
> 	xmlns:c="http://java.sun.com/jsp/jstl/core"
> 	xmlns:ui="http://java.sun.com/jsf/facelets">
> 	
> 	<h:head>
> 	    <title>Myfaces 2.2 | forEach Test</title>
> 	</h:head>
> 	<h:body>
> 		<h:form>
> 			<table>
> 				<c:forEach items="#{myfaces22foreach.pageList}" var="page">
> 					<tr>
> 						<td>
> 							<ui:include src="#{page}" />
> 						</td>
> 					</tr>
> 				</c:forEach>
> 			</table>
> 		</h:form>
> 	</h:body>
> </html>
> page1.xhtml
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <ui:composition
> 	xmlns="http://www.w3.org/1999/xhtml"
> 	xmlns:h="http://java.sun.com/jsf/html"
> 	xmlns:ui="http://java.sun.com/jsf/facelets">
> 	
> 	<h:outputText value="Page1" />
> 	
> </ui:composition>
> page2.xhtml
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <ui:composition
> 	xmlns="http://www.w3.org/1999/xhtml"
> 	xmlns:h="http://java.sun.com/jsf/html"
> 	xmlns:ui="http://java.sun.com/jsf/facelets">
> 	
> 	<h:outputText value="Page2" />
> 	
> </ui:composition>



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)