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
 
Old October 13th, 2003, 09:40 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 4 - CarBean.java

I am trying to use a javaBean with Tomcat 4.1.27. I can not get it to work by following the instructions on page 78 of the Beginning JSP Web Development book released in 2001. I think the instructions are outdated.

Could someone please explain to me where I should save the CarBean.java file if I make it part of the package com.wrox.cars;

I will be invoking it from the following web page at url:
http://localhost:8080/begjsp-ch04/carPage.jsp.
Here is carPage.jsp:
<html>
    <head>
        <title>Using a JavaBean</title>
    </head>

    <body>
    <h2>Using a JavaBean</h2>

    <% com.wrox.cars.CarBean myCar = new com.wrox.cars.CarBean(); %>
    I own a <%= myCar.getMake() %> <br />
    <% myCar.setMake("Porche"); %>
    Now I own a <%= myCar.getMake()%>
        <br>
    </body>
</html>


Here is CarBean.java:
package com.wrox.cars;

import java.io.Serializable;

public class CarBean implements Serializable{

    public CarBean(){
    }

    private String make = "Ford";

    public String getMake(){
        return make;
    }

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


 
Old October 13th, 2003, 10:21 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I changed the properties of file Web-inf to be share as WEB-INF.
This fixed the problem I was having.
WooHoo!!!!!!







Similar Threads
Thread Thread Starter Forum Replies Last Post
Root Cause:java.lang.NoSuchMethodError: java.util. anees81 JSP Basics 3 March 1st, 2011 08:55 AM
java.lang.OutOfMemoryError: Java heap space meetkotresh J2EE 1 February 2nd, 2008 01:52 AM
Java Code - Wrox - Beginning JAVA - Ivor Horton ponguru Java Databases 3 May 18th, 2006 12:30 PM
Java vs Java Script functions joemorrison74 J2EE 0 July 6th, 2005 04:28 PM
Problems with Java Mail Please advise "Chapter 9" PatrickWalsh JSP Basics 1 September 5th, 2004 06:46 PM





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