Erro JSF + Tela em Branco

0 respostas
shenn

Opa galera, estou começando a estudar JSF, e fiz um exemplo simples, mas esta dando algum erro, pq nao exibe nada =/

segue meu codigo:
package br.com.bean;

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

import javax.faces.bean.ManagedBean;

@ManagedBean
public class GeradorDeApostasBean {

	private int quantidadeDeNumeros;
	private int tamanhoAposta;
	private int quantidadeAposta;
	private List<List<Integer>> apostas;

	public int getQuantidadeDeNumeros() {
		return quantidadeDeNumeros;
	}

	public void setQuantidadeDeNumeros(int quantidadeDeNumeros) {
		this.quantidadeDeNumeros = quantidadeDeNumeros;
	}

	public List<List<Integer>> getApostas() {
		return apostas;
	}

	public void setApostas(List<List<Integer>> apostas) {
		this.apostas = apostas;
	}

	public int getTamanhoAposta() {
		return tamanhoAposta;
	}

	public void setTamanhoAposta(int tamanhoAposta) {
		this.tamanhoAposta = tamanhoAposta;
	}

	public int getQuantidadeAposta() {
		return quantidadeAposta;
	}

	public void setQuantidadeAposta(int quantidadeAposta) {
		this.quantidadeAposta = quantidadeAposta;
	}

	public String gerarApostas() {
		// Lista com todos os numeros
		ArrayList<Integer> numeros = new ArrayList<Integer>();
		for (int i = 0; i < this.quantidadeDeNumeros; i++) {
			numeros.add(i);
		}

		// Cria uma subList da lista de numeros
		List<Integer> subList = numeros.subList(0, this.tamanhoAposta);

		// lista de apostas vazia
		this.apostas = new ArrayList<List<Integer>>();

		// Gera as apostas
		for (int i = 0; i < this.getQuantidadeAposta(); i++) {
			Collections.shuffle(numeros);
			List<Integer> aposta = new ArrayList<Integer>(subList);
			this.apostas.add(aposta);
		}
		
		return "lista-de-apostas";
	}
}

/////////////////////////// tela de entrada de dados ///////////////////////////////
<!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">

<h:head>
	<title>Gerador de Apostas</title>
</h:head>
<h:body>
	<h:form>
		<h:panelGrid>
			<h:outputLabel value="Quantidade total de números:" />
			<h:inputText value="#{geradorDeApostasBean.quantidadeDeNumeros}" />

			<h:outputLabel value="Quantidade de números por aposta:" />
			<h:inputText value="#{geradorDeApostasBean.tamanhoAposta}" />

			<h:outputLabel value="Quantidade de apostas:" />
			<h:inputText value="#{geradorDeApostasBean.quantidadeAposta}" />

			<h:commandButton action="#{geradorDeApostasBean.gerarApostas}" value="Gerar" />
		</h:panelGrid>
	</h:form>
</h:body>
</html>
///////////////////////////////// TELA DE SAIDA DE DADOS ////////////////////////////////
<!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:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Gerador de Apostas</title>
</h:head>
<h:body>
	<ui:repeat var="aposta" value="#{geradorDeApostasBean.apostas}"
		varStatus="status">
		<h:outputText value="Aposta #{status.index + 1}: " />
		<h:outputText value="#{aposta}" />
		<br />
	</ui:repeat>
</h:body>
</html>

Quando eu executo aparece uma tela em branco, alguem sabe o porque?

vlwl =D

Criado 8 de novembro de 2012
Respostas 0
Participantes 1