Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
| Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 2nd, 2003, 08:51 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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"%>
<html>
<head><title>Using a JavaBean</title></head>
<body>

<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" />

</body>
</html>

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.

  #2 (permalink)  
Old October 11th, 2003, 10:32 AM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #3 (permalink)  
Old August 24th, 2004, 04:31 AM
Authorized User
 
Join Date: May 2004
Location: , , .
Posts: 28
Thanks: 0
Thanked 1 Time in 1 Post
Default

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 :)



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with code in wrox book isgamon2004 JSP Basics 2 May 13th, 2006 01:16 PM
Wrox book download code, GDI+ Programming jahanara_p2p All Other Wrox Books 1 June 14th, 2004 10:41 AM
Read first!!!: Where is the code for a Wrox book jminatel All Other Wrox Books 0 March 17th, 2004 04:43 PM
Read first!!!: Where is the code for a Wrox book jminatel Wrox Book Feedback 0 September 15th, 2003 11:30 AM
Wrox Book "ASP Databases" code anyone? sleddog Classic ASP Databases 2 August 19th, 2003 03:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.