Hi, Rohit, Bean1.java is compiled. I tried all the possibilities ( including
Mr. Simms's suggestion) without success. I suspect the problem may be in
those two files but can't figure out myself.
Roland
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of kuttappan
Sent: Monday, March 05, 2001 10:20 PM
To: [EMAIL PROTECTED]
Subject: Re: Can you help with JSP example?
Ronald said:
>2. I created subdirectory ch04 under WEB-INF/class and put into it the file
Bean1.java.
This may sound stupid, but did you compile the .java file to generate a
.class file.
Rohit.
----- Original Message -----
From: "Roland Dong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, 06 March, 2001 4:11 AM
Subject: Re: Can you help with JSP example?
> Thanks a lot, Rohit,
>
> I tried your suggestion, didn't work either. Still get Error 500.
>
> beanexample1.jsp is located under
> C:\tomcat\webapps\examples\jspbook\ch04\beanexample1.jsp
>
> Bean1.class is located under
> C:\tomcat\webapps\examples\WEB-INF\classes\ch04
>
> Any ideas what goes wrong?
>
> Roland
>
> -----Original Message-----
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of kuttappan
> Sent: Sunday, March 04, 2001 9:36 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Can you help with JSP example?
>
>
> Ronald, I haven't read your code fully, but IMHO your package statement
> should read jspbook.ch04; and not com.awl.jspbook.ch04; Hope this helps.
>
> Rohit.
> ----- Original Message -----
> From: "Roland Dong" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, 05 March, 2001 9:09 AM
> Subject: Can you help with JSP example?
>
>
> > Hi, I am trying to run an examples using beans from the book JavaServr
> Pages
> > by larne Pekowsky. Could not get it work. I am using Tomcat3.21.
> >
> > Basically, beanexample1.jsp tries to get properties from Bean1.java.
When
> I
> > run it I got Error 500:
> >
> > Internal Servlet Error:
> > org.apache.jasper.JasperException: Unable to load class
> > com.awl.jspbook.ch04.Bean1
> > ......
> > ......
> >
> > Then I did the following:
> >
> > 1. changed <jsp:useBean id="bean1" class="com.awl.jspbook.ch04.Bean1"/>
in
> > the file beanexample1.jsp so it looks like this:
> > <jsp:useBean id="bean1" class="ch04.Bean1"/>
> >
> > 2. I created subdirectory ch04 under WEB-INF/class and put into it the
> file
> > Bean1.java.
> >
> > 3. I also modified the Bean1.java so that the line where you put the
> > Bean1.java in the package ch04 looks like this: package ch04
> >
> > However, when I run it I got this error message:
> >
> >
> > Internal Servlet Error:
> > org.apache.jasper.JasperException: Unable to compile class for JSP
> > .....
> > .....
> >
> > Root cause:
> > java.lang.NullPointerException
> > at
> >
>
org.apache.jasper.compiler.GetPropertyGenerator.generate(GetPropertyGenerato
> > r.java:100)
> >
> > Can anyone tell me what is wrong?
> >
> > Roland
> >
> >
> >
> > //This is the file beanexample1.jsp
> > <jsp:useBean id="bean1" class="com.awl.jspbook.ch04.Bean1"/>
> >
> > <HTML>
> >
> > <HEAD><TITLE>Beans!</TITLE></HEAD>
> >
> > <BODY BGCOLOR="#FFFFFF">
> >
> > <P>Here is some data that came from bean1:</P>
> >
> > <UL>
> >
> > <LI>The name of this bean is:
> > <jsp:getProperty name="bean1" property="name"/>
> >
> > <LI>The 7th prime number is:
> > <jsp:getProperty name="bean1" property="seventhPrimeNumber"/>
> >
> > <LI>The current time is:
> > <jsp:getProperty name="bean1" property="currentTime"/>
> >
> > </UL>
> >
> > <CENTER>
> >
> > <TABLE BORDER="0">
> > <TR>
> > <TD BGCOLOR="<jsp:getProperty name="bean1" property="color"/>">
> >
> > <P>The information from a bean can be used
> > anywhere on the page!</P>
> >
> > </TD>
> > </TR>
> > </TABLE>
> >
> > </BODY>
> > </HTML>
> >
> > //This is the file Bean1.java
> >
> > package com.awl.jspbook.ch04;
> >
> > import java.text.*;
> > import java.util.*;
> >
> > public class Bean1 implements java.io.Serializable {
> > public String getName() {
> > return "com.awl.jspbook.ch04";
> > }
> >
> >
> > public int getSeventhPrimeNumber() {
> > return 17;
> > }
> >
> > public String getColor() {
> > return "#772266";
> > }
> >
> > public String getCurrentTime() {
> > SimpleDateFormat sdf = new SimpleDateFormat("hh:mm 'and' s
> 'seconds'");
> > return sdf.format(new Date());
> > }
> > }
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.231 / Virus Database: 112 - Release Date: 12/02/2001
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.231 / Virus Database: 112 - Release Date: 12/02/2001
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets