bonfarj 10 de jul. de 2006
Oi chopinhead, seja bem vindo ao fórum!
Sim, é possível ter iterates dentro de outros, eu mesmo já usei 3 níveis de iterate. Vc pode postar o trecho do .jsp aqui?, fica mais fácil de ajudar.
abraços,
chopinhead 13 de jul. de 2006
Ok, vou colocar o código aqui completo.
<% @ taglib uri = "http://java.sun.com/jstl/core" prefix = "c" %>
<% @ taglib uri = "/WEB-INF/struts-logic.tld" prefix = "logic" %>
<% @ taglib uri = "/WEB-INF/struts-html.tld" prefix = "html" %>
<% @ taglib uri = "/tags/struts-bean" prefix = "bean" %>
<% @page import = "com.fortebrasil.sophos.dto.TarefasUsuario, com.fortebrasil.sophos.dto.Tarefas, java.text.DecimalFormat, java.util.Collection;" %>
<html:form action= "mediasAlunos.do" >
<table class= "tabelaEdicao" width= "95%" >
<tr>
<th width= "20%" >
<bean:message key= "formulario_filtro_turma.tipo_curso" />
</th>
<td width= "80%" >
<html:select property= "tipoCurso" style= "width:100%;" onchange= "document.mediasAlunosForm.submit();" >
<html:option value= "0" ><bean:message key= "formulario_filtro_turma.selecione" /></html:option>
<html:optionsCollection property= "listaTiposCurso" value= "id" label= "nome" />
</html:select>
</td>
</tr>
<tr>
<th width= "20%" >
<bean:message key= "formulario_filtro_turma.curso" />
</th>
<td width= "80%" >
<html:select property= "curso" style= "width:100%;" onchange= "document.mediasAlunosForm.submit();" >
<html:option value= "0" ><bean:message key= "formulario_filtro_turma.selecione" /></html:option>
<html:optionsCollection property= "listaCursos" value= "id" label= "nome" />
</html:select>
</td>
</tr>
<tr>
<th width= "20%" >
<bean:message key= "formulario_filtro_turma.periodo" />
</th>
<td width= "80%" >
<html:select property= "periodo" style= "width:100%;" onchange= "document.mediasAlunosForm.submit();" >
<html:option value= "0" ><bean:message key= "formulario_filtro_turma.selecione" /></html:option>
<html:optionsCollection property= "listaPeriodos" value= "id" label= "nome" />
</html:select>
</td>
</tr>
<tr>
<th width= "20%" >
<bean:message key= "admin.bibliotecasvirtuais.cadastrarbibliotecasvirtuais.turmas" />
</th>
<td width= "80%" >
<html:select property= "turma" style= "width:100%;" onchange= "document.mediasAlunosForm.submit();" >
<html:option value= "0" ><bean:message key= "formulario_filtro_turma.selecione" /></html:option>
<html:optionsCollection property= "listaTurmas" value= "id" label= "nome" />
</html:select>
</td>
</tr>
</table>
<br/>
<logic:notEmpty name= "mediasAlunosForm" property= "alunos" >
<%
// INICIALIZACAO DE VARIAVEIS
// Contador de graus
int qtdeGraus = 0 ;
// Contador de tarefas por grau
int qtdeTarefas = 0 ;
// Media por grau
float media = 0 ;
// Media Final do Aluno
float mediaFinal = 0 ;
// CONTROLAR O NUMERO DE CASAS DECIMAIS DAS NOTAS
DecimalFormat casas = new DecimalFormat ( "0.00" );
%>
<logic:iterate name= "mediasAlunosForm" property= "alunos" id= "alunos" >
<table width= "95%" class= "tabela" >
<tr>
<td colspan= "2" >
<strong><bean:write name= "alunos" property= "nome" /></strong></strong>
</td>
</tr>
<tr>
<td align= "center" colspan= "2" >
<logic:notEmpty name= "mediasAlunosForm" property= "graus" >
<table width= "95%" class= "tabela" >
<logic:iterate name= "mediasAlunosForm" property= "graus" id= "graus" >
<%
qtdeGraus ++ ;
%>
<tr>
<td>
<strong><bean:message key= "professores.avaliacao.mediaAluno.grau" /></strong> <bean:write name= "graus" property= "nome" />
</td>
</tr>
<tr>
<td align= "center" >
<table class= "tabela" width= "95%" >
<logic:notEmpty name= "mediasAlunosForm" property= "tarefas" >
<logic:iterate name= "mediasAlunosForm" property= "tarefas" id= "tarefa" >
<%
float nota = 0 ;
Tarefas auxTarefa = ( Tarefas ) tarefa ;
float peso = 0 ;
if ( auxTarefa . getPesoMedia () != null )
peso = auxTarefa . getPesoMedia () . floatValue ();
%>
<bean:define name= "tarefa" property= "graus" id= "grau" />
<c:if test= "${(grau.id == graus.id)}" >
<% qtdeTarefas ++ ; %>
<tr>
<td width= "90%" >
<bean:write name= "tarefa" property= "nome" /> - <bean:write name= "tarefa" property= "pesoMedia" />
</td>
<td width= "10%" align= "center" >
<logic:notEmpty name= "mediasAlunosForm" property= "tarefasUsuario" >
<logic:iterate name= "mediasAlunosForm" property= "tarefasUsuario" id= "tarefasUsuario" >
<bean:define name= "tarefasUsuario" property= "tarefa" id= "tar" />
<bean:define name= "tarefasUsuario" property= "grau" id= "gra" />
<bean:define name= "tarefasUsuario" property= "usuario" id= "usu" />
<bean:define name= "tarefasUsuario" property= "tarefaUsuario" id= "tarUsu" />
<c:if test= "${(tar.id == tarefa.id) && (usu.id == alunos.id)}" >
<%
TarefasUsuario tt = ( TarefasUsuario ) tarUsu ;
if ( tt . getGrauObtido () != null ){
nota = tt . getGrauObtido () . floatValue ();
nota = ( 10 * nota ) / peso ;
}
%>
</c:if>
</logic:iterate>
</logic:notEmpty>
<%
media += nota ;
out . println ( casas . format ( nota ));
%>
</td>
</tr>
</c:if>
</logic:iterate>
</logic:notEmpty>
<tr>
<td width= "90%" align= "right" >
<strong><bean:message key= "professores.avaliacao.mediaAluno.media" /> <bean:write name= "graus" property= "nome" /> : </strong>
</td>
<td width= "10%" align= "center" >
<strong>
<%
media = media / qtdeTarefas ;
mediaFinal += media ;
out . println ( casas . format ( media ));
media = 0 ;
%>
</strong>
</td>
</tr>
</table>
</td>
</tr>
</logic:iterate>
</table>
</logic:notEmpty>
</td>
</tr>
<tr>
<td colspan= "2" align= "center" >
<strong><font color= "#FF0000" >
<bean:message key= "professores.avaliacao.mediaAluno.mediaFinal" />
<%
mediaFinal = mediaFinal / qtdeGraus ;
out . println ( casas . format ( mediaFinal ));
mediaFinal = 0 ;
qtdeGraus = 0 ;
%>
</font>
</strong>
</td>
</tr>
</table>
<table width= "95%" >
<tr>
<td style= "border-top-width: 1px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: dotted; border-right-style: dotted; border-bottom-style: dotted; border-left-style: dotted;" > </td>
</tr>
</table>
</logic:iterate>
</logic:notEmpty>
</html:form>
Tentei tb retirar toda a logica de dentro dos iterates deixando eles vazios e mesmo assim acontece a mesma coisa. Os espaços em branco gerado no html causa o erro java heap space.
Valeu por ter respondido.