simple use of java beans in jsp page - test scope

hi guys!

I have a big problem with this simple bean! I tell some people to say me where is the problem? I want to test the Scope so I'm creating a java bean provabean.java: JAVA CODE:

package stringaBean;

publicclass provaBean{

private String nome ="Chi deve salutare il bean?";

publicvoid setNome(String name){

this.nome = name;

}

public String getNome(){

return nome;

}

}

after I'm creating a first page jsp include.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC"-//W3C//DTD HTML 4.01 Transition

><!-- DICHIARO UN BEAN VISIBILE SOLO ALLA FINO A TERMINAZIONE DELLA REQUEST -->

<jsp:useBean id="provabean" class="stringaBean.provaBean" scope="request"/>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<title>

<!-- VERIFICO CONTENUTO INIZIALE DEL BEAN -->

<jsp:getProperty name="provabean" property="nome"/>

</title>

<!-- TESTO LO SCOPE -->

<jsp:setProperty name="provabean" property="nome" value="Arrivo dalla pagina input!"/>

</head>

<body>

<form action="hellobean.jsp" method="get" name=inputname >

<label>Inserisci il nome: <input type="text" name="nome"/></label>

<label><input type="submit" name="invio" value="Spara il nome!"/></label>

</form>

</body>

and in the end the last page jsp where i want to test the bean scope:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<!-- testo valore immesso prima del submit -->

<title><jsp:getProperty name="provabean" property="nome"/></title>

</head>

<body>

<jsp:setProperty name="provabean" property="nome" value="<%=request.getParameter("nome") %>"/>

</body>

</html>

WHERE IS THE BUG?

Thanks to all!

Denis

[3763 byte] By [mr.devitoa] at [2007-11-27 1:44:16]
# 1

<jsp:setProperty name="provabean" property="nome" value="<%=request.getParameter("nome") %>"/>

This won't work unless you pass the parameter as part of the request i.e use a <input type="hidden" ../> in you form since the request.getParameter will return null

simonkent1a at 2007-7-12 1:03:16 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...