¯
\(¯`·.¸FlacK¸.·´¯\)
Hi!
I have tried to run a little example that I have found in Internet on Java
bean, but it doesn't work, it give me an error.
I use Tomcat and I put class file in webapps\ROOT\WEB-INF\classes.
I must put something library for the bean?
I have put the code and the error below.
Thank you very much..bye
----------------------------------------
<html>
<head><title>Utilizzo del Bean</title></head>
<body>
<jsp:useBean id="utente" scope="session" class="InfoUtente"/>
<jsp:setProperty name="utente" property="nome" value="Zina&Tram"/>
<%
utente.setNome("Zina&Tram");
utente.setEmail("(e-mail address removed)");
%>
<jsp:getProperty name="utente" property="nome"/>
<% out.println(utente.getNome());
out.println(utente.riassunto()); %>
<% utente.aggiornaPV();
out.println(utente.getPagineViste()); %>
</html>
---------------------------------
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;
}
}
-------------------------
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: /InfoUtente.jsp
Generated servlet error:
C:\Programmi\Tomcat\jakarta-tomcat-5.0.27\work\Catalina\localhost\_\org\apac
he\jsp\InfoUtente_jsp.java:45: cannot resolve symbol
symbol : class InfoUtente
location: class org.apache.jsp.InfoUtente_jsp
InfoUtente utente = null;
^
An error occurred at line: 4 in the jsp file: /InfoUtente.jsp
Generated servlet error:
C:\Programmi\Tomcat\jakarta-tomcat-5.0.27\work\Catalina\localhost\_\org\apac
he\jsp\InfoUtente_jsp.java:47: cannot resolve symbol
symbol : class InfoUtente
location: class org.apache.jsp.InfoUtente_jsp
utente = (InfoUtente) _jspx_page_context.getAttribute("utente",
PageContext.SESSION_SCOPE);
^
An error occurred at line: 4 in the jsp file: /InfoUtente.jsp
Generated servlet error:
C:\Programmi\Tomcat\jakarta-tomcat-5.0.27\work\Catalina\localhost\_\org\apac
he\jsp\InfoUtente_jsp.java:49: cannot resolve symbol
symbol : class InfoUtente
location: class org.apache.jsp.InfoUtente_jsp
utente = new InfoUtente();
^
An error occurred at line: 10 in the jsp file: /InfoUtente.jsp
Generated servlet error:
C:\Programmi\Tomcat\jakarta-tomcat-5.0.27\work\Catalina\localhost\_\org\apac
he\jsp\InfoUtente_jsp.java:64: cannot resolve symbol
symbol : class InfoUtente
location: class org.apache.jsp.InfoUtente_jsp
out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((InfoUtente
)_jspx_page_context.findAttribute("utente")).getNome())));
^
4 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandle
r.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:3
32)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
11)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
95)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
I have tried to run a little example that I have found in Internet on Java
bean, but it doesn't work, it give me an error.
I use Tomcat and I put class file in webapps\ROOT\WEB-INF\classes.
I must put something library for the bean?
I have put the code and the error below.
Thank you very much..bye
----------------------------------------
<html>
<head><title>Utilizzo del Bean</title></head>
<body>
<jsp:useBean id="utente" scope="session" class="InfoUtente"/>
<jsp:setProperty name="utente" property="nome" value="Zina&Tram"/>
<%
utente.setNome("Zina&Tram");
utente.setEmail("(e-mail address removed)");
%>
<jsp:getProperty name="utente" property="nome"/>
<% out.println(utente.getNome());
out.println(utente.riassunto()); %>
<% utente.aggiornaPV();
out.println(utente.getPagineViste()); %>
</html>
---------------------------------
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;
}
}
-------------------------
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: /InfoUtente.jsp
Generated servlet error:
C:\Programmi\Tomcat\jakarta-tomcat-5.0.27\work\Catalina\localhost\_\org\apac
he\jsp\InfoUtente_jsp.java:45: cannot resolve symbol
symbol : class InfoUtente
location: class org.apache.jsp.InfoUtente_jsp
InfoUtente utente = null;
^
An error occurred at line: 4 in the jsp file: /InfoUtente.jsp
Generated servlet error:
C:\Programmi\Tomcat\jakarta-tomcat-5.0.27\work\Catalina\localhost\_\org\apac
he\jsp\InfoUtente_jsp.java:47: cannot resolve symbol
symbol : class InfoUtente
location: class org.apache.jsp.InfoUtente_jsp
utente = (InfoUtente) _jspx_page_context.getAttribute("utente",
PageContext.SESSION_SCOPE);
^
An error occurred at line: 4 in the jsp file: /InfoUtente.jsp
Generated servlet error:
C:\Programmi\Tomcat\jakarta-tomcat-5.0.27\work\Catalina\localhost\_\org\apac
he\jsp\InfoUtente_jsp.java:49: cannot resolve symbol
symbol : class InfoUtente
location: class org.apache.jsp.InfoUtente_jsp
utente = new InfoUtente();
^
An error occurred at line: 10 in the jsp file: /InfoUtente.jsp
Generated servlet error:
C:\Programmi\Tomcat\jakarta-tomcat-5.0.27\work\Catalina\localhost\_\org\apac
he\jsp\InfoUtente_jsp.java:64: cannot resolve symbol
symbol : class InfoUtente
location: class org.apache.jsp.InfoUtente_jsp
out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((InfoUtente
)_jspx_page_context.findAttribute("utente")).getNome())));
^
4 errors
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandle
r.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:3
32)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
11)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
95)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)