Duvida no setProperty

0 respostas
dicabeca

pessoal to tendo um problema com um jsp aqui,nele eu ja tenho um bean e consigo colocar os valores nos campos, tudo certinho, o problema é qnd eu quero alterar esse bean,pra mim era so colocar o setProperty,ta dando nullException no servlet queria saber oq estou fzd d errado???
meu jsp

<jsp:useBean id="alunoBean" class="control.AlunoBean" scope="request"/>

<html>
<head>
	<title>Cadastro de Aluno</title>
	
	<script language="javaScript">
		function Submit(acao,destino)
		{	
			document.from_desvio.acao.value = acao;
			document.from_desvio.action = destino;
			document.from_desvio.submit();
		}
	</script>
	
</head>

<body>
	<form name="from_desvio" method="post" >
	<table border="0" align="center">
	 <tr>
	  <td>Nome:</td><td><input type="text" name="nome" value=<jsp:getProperty name="alunoBean" property="nome"/> /></td>
		<jsp:setProperty name="alunoBean" property="nome"/> 			 
	 </tr>
	 <tr>
	  <td>Endereço:</td><td><input type="text" name="endereco" value =<jsp:getProperty name="alunoBean" property="endereco"/>/></td>
	 
	 </tr>
	 <tr>
	  <td>Telefone:</td><td><input type="text" name="telefone" value =<jsp:getProperty name="alunoBean" property="telefone"/> /></td>
	 
	 </tr>
	 <tr>
	  <td>Email:</td><td><textarea name="email" rows="4"><jsp:getProperty name="alunoBean" property="email"/></textarea></td>
	 </tr>
	 <tr>
	  <td>Histórico:</td><td><textarea name="historico" rows="5"><jsp:getProperty name="alunoBean" property="historico"/></textarea></td>
	 
	 </tr>
	 <tr>
	 <input type="hidden" name="acao">
	 	<td><input type="Button" value="Alterar" onclick="Submit('Alterar','cadastroAluno')"/></td>
	 	<td><input type="reset" value="Cancelar"/></td>
	 </tr>
	 <!-- br><input type="button" value="Procurar Aluno" onclick="Submit('Procurar','cadastroAluno')"/-->
	 
	</table>	
	</form>
</body>
</html>

meu servlet

....
if(acao.equals("Alterar"))
			{
			    AlunoBean alunoBean2 = (AlunoBean)request.getAttribute("alunoBean");
				System.out.println(alunoBean2.getNome());//<== O ERRO			}
......
Criado 22 de novembro de 2007
Respostas 0
Participantes 1