TorpedoBlu
02-02-2008, 17:10
ciao, sto provando a scrivere il mio primo bean Usando Eclipse:
Nuovo progetto Web Dinamico -> nuova classe:
public class InfoUtente {
private String nome = null;
private String email = null;
private int pagineViste;
public InfoUtente() {
pagineViste=0;
}
public void aggiornaPV(){
pagineViste++;
}
public int getPagineViste(){
return pagineViste;
}
public void setNome(String value) {
nome = value;
}
public String getNome() {
return nome;
}
public void setEmail(String value) {
email = value;
}
public String getEmail() {
return email;
}
public String riassunto(){
String riassunto = null;
riassunto = "Il nome dell'utente è"+nome+",";
riassunto+= "il suo indirizzo e-mail è: "+email;
riassunto+=" e ha visitato "+pagineViste+" del sito";
return riassunto;
}
}//InfoUtente
poi nuova JSP ->
<html>
<head><title>Utilizzo del Bean</title></head>
<body>
<jsp:useBean id="utente" scope="session" class="InfoUtente"/>
</body>
</html>
e gia mi da un Warning: "The local variable Utente is never Read"
mi dico: va beh vediamo lo stesso:
RunAs ->on Server ->mi fa selezionare Tomcat 6 regolarmente installato
Si avvia Tomcat e mi da errore:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error ()
that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 4 in the jsp file: /index.jsp
InfoUtente cannot be resolved to a type
:help:
Nuovo progetto Web Dinamico -> nuova classe:
public class InfoUtente {
private String nome = null;
private String email = null;
private int pagineViste;
public InfoUtente() {
pagineViste=0;
}
public void aggiornaPV(){
pagineViste++;
}
public int getPagineViste(){
return pagineViste;
}
public void setNome(String value) {
nome = value;
}
public String getNome() {
return nome;
}
public void setEmail(String value) {
email = value;
}
public String getEmail() {
return email;
}
public String riassunto(){
String riassunto = null;
riassunto = "Il nome dell'utente è"+nome+",";
riassunto+= "il suo indirizzo e-mail è: "+email;
riassunto+=" e ha visitato "+pagineViste+" del sito";
return riassunto;
}
}//InfoUtente
poi nuova JSP ->
<html>
<head><title>Utilizzo del Bean</title></head>
<body>
<jsp:useBean id="utente" scope="session" class="InfoUtente"/>
</body>
</html>
e gia mi da un Warning: "The local variable Utente is never Read"
mi dico: va beh vediamo lo stesso:
RunAs ->on Server ->mi fa selezionare Tomcat 6 regolarmente installato
Si avvia Tomcat e mi da errore:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error ()
that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 4 in the jsp file: /index.jsp
InfoUtente cannot be resolved to a type
:help: