Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / November 2004

Tip: Looking for answers? Try searching our database.

Error on java bean..help...

Thread view: 
\(?`?.?FlacK?.???\) - 20 Oct 2004 11:08 GMT
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("ciao@dom.it");
%>
<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)
bill - 22 Oct 2004 11:28 GMT
Hi FlacK,

See:

http://courses.coreservlets.com/Course-Materials/html/csajsp2/13-JavaBeans_files
/frame.htm

slide 13.

Note:
Bean's must alway be in packages!

gr
willem
gonas - 20 Nov 2004 09:12 GMT
> Hi FlacK,
>
[quoted text clipped - 8 lines]
> gr
> willem

try placing your jar file into the library folder if doing a java/web
projects
if Beans try the one following
place .class file into your project.jar file itself and then build if
it works kindly repost a messaeg.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.