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 20:57:21 UTC

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

    [ https://issues.apache.org/jira/browse/MYFACES-3853?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13900668#comment-13900668 ] 

Leonardo Uribe commented on MYFACES-3853:
-----------------------------------------

I have checked the demo and there is a bug in the SectionUniqueIdCounter. Under this combination:

        System.out.println(counter.generateUniqueId());
        System.out.println(counter.generateUniqueId());
        System.out.println(counter.startUniqueIdSection("X"));
        System.out.println(counter.generateUniqueId());
        System.out.println(counter.generateUniqueId());
        System.out.println(counter.startUniqueIdSection());
        System.out.println(counter.generateUniqueId());
        System.out.println(counter.generateUniqueId());

It generates:

1
2
3_X
3_X_1
3_X_2
3_3
3_3_1
3_3_2

But it should be:

1
2
3_X
3_X_1
3_X_2
3_X_3
3_X_3_1
3_X_3_2



> 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
>            Priority: Critical
>
> 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)