tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank Applin" <fapp...@ix.netcom.com>
Subject Re: need help...
Date Tue, 15 Aug 2000 20:57:29 GMT
I did the following, and it worked (so, I must be doing something stupid):

***********************************************************
<%@ page errorPage="errorpage.jsp" %>

<html>
<head>
<title>Customer List Page</title>
</head>
<body>
<jsp:useBean id="customer" scope="session" class="CustomerInformation" />
<%
customer.setCustomerList ("This is a test.");
out.println (customer.getCustomerList ());
%>
</body>
</html>

***********************************************************
----- Original Message -----
From: "Frank Applin" <fapplin@ix.netcom.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Tuesday, August 15, 2000 3:11 PM
Subject: need help...


> Can someone help? I've been working through the book "Pure JSP - A Code
> Intensive Premium Reference" by James Goodwill. I have been using the
Tomcat
> server just fine through all of the examples, until I tried to do
something
> on my own. I've created a very simple JavaBean and a very simple JSP, but
I
> can't seem to get beyond an error (see below).
>
****************************************************************************
> ******
> The book instructed on how to change the server.xml file (which I did):
>
> <Context path="/purejsp" docBase="purejsp"
> defaultSessionTimeOut="30" isWARExpanded="true"
> isWARValidated="false" isInvokerEnabled="true"
> isWorkDirPesistent="false" />
>
****************************************************************************
> ******
> My .class file is located in purejsp/WEB-INF/classes directory and my .jsp
> file is located in the purejsp directory.
>
****************************************************************************
> ******
> Here's the error that I keep getting:
>
> Error: 500
> Location: /purejsp/CustomerList.jsp
> Internal Servlet Error:
>
> org.apache.jasper.JasperException: Cannot find any information on property
> 'CustomerList' in a bean of type 'CustomerInformation'
>  at
> org.apache.jasper.runtime.JspRuntimeLibrary.getReadMethod(JspRuntimeLibrar
y.
> java, Compiled Code)
>  at
>
org.apache.jasper.compiler.GetPropertyGenerator.generate(GetPropertyGenerato
> r.java:101)
>  at
>
org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(J
> spParseEventListener.java, Compiled Code)
>  at
>
org.apache.jasper.compiler.JspParseEventListener.generateAll(JspParseEventLi
> stener.java, Compiled Code)
>  at
>
org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseE
> ventListener.java:169)
>  at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled
> Code)
>  at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
>  at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
> rvlet.java:149)
>  at
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:161)
>  at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
>  at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled
> Code)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
> Compiled Code)
>  at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
>  at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:160)
>  at
>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
> )
>  at java.lang.Thread.run(Thread.java:479)
>
****************************************************************************
> ******
> Here's  the JSP:
> <%@ page errorPage="errorpage.jsp" %>
> <html>
> <head>
> <title>Customer List Page</title>
> </head>
> <body>
> <jsp:useBean id="customer" scope="session" class="CustomerInformation" />
> <jsp:setProperty name="customer" property="CustomerList" value="This is a
> test" />
> <jsp:getProperty name="customer" property="CustomerList" />
> </body>
> </html>
>
****************************************************************************
> ******
> Here's the JavaBean, I've commented out most of the code to keep it as
> simple as possible:
>
> import java.lang.*;
> import java.sql.*;
> import java.util.*;
>
> public class CustomerInformation
> {
>     public String CustomerList = "";
>     private Hashtable customerInfo = new Hashtable ();
>  public CustomerInformation()
>  {
> /*     try {
>          Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
>       Connection con = DriverManager.getConnection ("jdbc:odbc:AsaDemo",
> "dba", "sql");
>       Statement smnt = con.createStatement ();
>
>       ResultSet rs = smnt.executeQuery ("SELECT id, company_name FROM
> customers");
>       while (rs.next ()) {
>           String id = (new Integer (rs.getInt (1))).toString ();
>           String companyName = rs.getString (1);
>           customerInfo.put (id, companyName);
>       } file://end while
>       con.close ();
>   } file://end try
>   catch (Exception e) {
>       System.err.println (e.getMessage ());
>   }//end catch
> */
>  } file://end constructor
>
>     public String getCustomerList ()
>     {
>         return CustomerList;
>     } file://end method
>
>     public void setCustomerList (String value)
>     {
> /*
>         StringBuffer html = new StringBuffer ();
>         html.append ("<table border =\"1\">");
>         Enumeration elements = customerInfo.elements ();
>         while (elements.hasMoreElements ()) {
>             html.append ("<tr>");
>             html.append ("<td>" + (String) elements.nextElement () +
> "</td>");
>             html.append ("<td>" + (String) elements.nextElement () +
> "</td>");
>             html.append ("</tr>");
>         } file://end while
>         CustomerList = html.toString ();
> */
>         CustomerList = value;
>     } file://end method
> }
>
****************************************************************************
> ******
>


Mime
View raw message