p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   JSP Basics (http://p2p.wrox.com/forumdisplay.php?f=92)
-   -   Problem with code in wrox book.... (http://p2p.wrox.com/showthread.php?t=4559)

wvmikep October 2nd, 2003 08:51 PM

Problem with code in wrox book....
...on page 85 in Beginning JSP Web Development:

I have the following bean:

 * CarBean.java
 * Created on October 2, 2003, 8:36 PM

package com.wrox.cars;
//package Templates.Beans;

import java.io.Serializable;
//import java.beans.*;

 * @author mike
public class CarBean implements Serializable {

    public CarBean() {

    private String make = "Ford";

    public String getMake() {
        return make;

    public void setMake(String make) {
        this.make = make;

    private double cost = 10000.00;
    private double taxRate = 17.5;

    public double getPrice() {
        double price = (cost + (cost * (taxRate/100)));
        return price;

    private void setPrice(double newPrice) {

...and the following JSP page:

<%@page contentType="text/html"%>
<head><title>Using a JavaBean</title></head>

<h2>Using a JavaBean</h2>

<jsp:useBean id="myCar" class="com.wrox.cars.CarBean" />

I have a <jsp:getProperty name="myCar" property="make" /> <br />

My car costs $<jsp:getProperty name="myCar" property="price" />


The problem is, I get:
500 Unhandled exception thrown from /begjsp-ch04/carPage2.jsp:12
Unhandled exception thrown from /begjsp-ch04/carPage2.jsp:12

If I delete the whole line in the JSP page that starts with "My car costs..." the error goes away. This code is straight from the book. Any ideas?

Now, I realized I could just skip it and continue on in the book, which I would likely do, since until page 500, where it starts talking about struts, it doesn't look like I'll be doing much with beans anymore. However, if there is a solution, I'd like to have the piece of mind of knowing that I'm not crazy...if you know what I mean.

chuakev October 11th, 2003 10:32 AM

hi there:
    how do u download the wlsbook_code.zip from the web site ? pls enlightened me?:)

gilf August 24th, 2004 04:31 AM

I know you posted this along time ago but for anybody who's having the same problem.

You just restart Tomcat and it works, took me a while to figure that out. It does actually say that in the book but I'm sure like you, I get the idea you know what your doing and don't need to read the book :)

All times are GMT -4. The time now is 09:05 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.