You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Juan Emilio Lama Salas (Created) (JIRA)" <de...@myfaces.apache.org> on 2011/11/15 16:38:51 UTC

[jira] [Created] (MYFACES-3395) ui: repeat does not work correctly in MyFaces Core 2.1.3

ui: repeat does not work correctly in MyFaces Core 2.1.3
--------------------------------------------------------

                 Key: MYFACES-3395
                 URL: https://issues.apache.org/jira/browse/MYFACES-3395
             Project: MyFaces Core
          Issue Type: Bug
          Components: General
    Affects Versions: 2.1.3
         Environment: Windows 7
Eclipse Indigo Service Release 1
Apache Tomcat 6.0.18
Myfaces 2.1.3

            Reporter: Juan Emilio Lama Salas


Hi:

ui:repeat no funciona correctamente en myfaces core 2.1.3:


package example;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Juan Lama
 *
 */
public class MyBean {

	private List<String> head;
	private List<List<String>> body;
	
	private int MAX_HEAD = 3;
	private int MAX_BODY = 5;
	
	public MyBean() {
	}

	public List<String> getHead() {
		if( head == null ) {
			head = new ArrayList<String>();
			for( int i = 1; i <= MAX_HEAD ; i++ ) {
				head.add( "HEAD".concat(Integer.toString(i)) );
			}
		}
		return head;
	}

	public void setHead(List<String> head) {
		this.head = head;
	}

	public List<List<String>> getBody() {
		if( body == null ) {
			body = new ArrayList<List<String>>();
			List<String> listTemp = null;
			int i;
			int j;
			for( i = 1; i <= MAX_HEAD ; i++ ) {
				listTemp = new ArrayList<String>();
				for( j = 1; j <= MAX_BODY ; j++ ) {
					listTemp.add( "BODY".concat(Integer.toString(i)).concat("-").concat(Integer.toString(j)) );
				}
				body.add(listTemp);
			}
		}
		return body;
	}

	public void setBody(List<List<String>> body) {
		this.body = body;
	}
}



<!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:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
	<head>
		<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
		<title>Result</title>
	</head>
	<body>
		<f:view>
			<h:form>
				<div align="center">
					<h:panelGrid columns="1">
						<table border="1" class="dr-table rich-table" width="100%">
				            <thead>
				                <tr>
				                	<ui:repeat value="#{myBean.head}" var="myvar">
				                		<td>
				            				 <h:outputText value="#{myvar}" />
				            			</td>
				                	</ui:repeat>
				                </tr>
				            </thead>
				            <tbody>
				            	<ui:repeat value="#{myBean.body}" var="myvar2">
				            		<tr>
				            			<ui:repeat value="#{myvar2}" var="myvar3">
				            				<td align="center">
				                            	<h:outputText value="#{myvar3}" />
				                            </td>
				            			</ui:repeat>
				            		</tr>
				            	</ui:repeat>
				            </tbody>
				        </table>
					</h:panelGrid>
				</div>
			</h:form>
		</f:view>
	</body>
</html>


Generates the following:



<!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">
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
<title>Result</title>
</head>
<body>
	<form id="j_id1773819711_69ba570b" name="j_id1773819711_69ba570b"
		method="post"
		action="/ui/faces/result.xhtml;jsessionid=5C7C5542FBF797643CCB4C3A0A250795"
		enctype="application/x-www-form-urlencoded">
		<div align="center">
			<table>
				<tbody>
					<tr>
						<td>
							<table border="1" class="dr-table rich-table" width="100%">

								<thead>
									<tr>
										</td>
									</tr>
									<tr>
										<td>
											<td>HEAD1</td>
											<td>HEAD2</td>
											<td>HEAD3</td>
										</td>
									</tr>
									<tr>
										<td>
									</tr>

								</thead>
								<tbody>
									</td>
									</tr>
									<tr>
										<td>
											<tr>
												<td align="center">BODY1-1</td>
												<td align="center">BODY1-2</td>
												<td align="center">BODY1-3</td>
												<td align="center">BODY1-4</td>

												<td align="center">BODY1-5</td>
											</tr>
											<tr>
												<td align="center">BODY2-1</td>
												<td align="center">BODY2-2</td>
												<td align="center">BODY2-3</td>
												<td align="center">BODY2-4</td>

												<td align="center">BODY2-5</td>
											</tr>
											<tr>
												<td align="center">BODY3-1</td>
												<td align="center">BODY3-2</td>
												<td align="center">BODY3-3</td>
												<td align="center">BODY3-4</td>

												<td align="center">BODY3-5</td>
											</tr>
										</td>
									</tr>
									<tr>
										<td>
								</tbody>
							</table>
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<input type="hidden" name="j_id1773819711_69ba570b_SUBMIT" value="1" /><input
			type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState"
			value="cg0+V14JsgFPNQA1c/ay81AaVVWBV1cKCa4QVp8xkJujv3Tc7sG1y6Cn6L9w7/YenIRbJ9ikyCjuU077q5GfiYb2Za4pR7mM2Z4wasFe27JapcVvWy/XnJcLHUfkCmQqzdYAgw==" />
	</form>
</body>
</html>



you see:

                                  <tr>
							</td>
					</tr>

esas etiquetas están mal


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira