Wrox Programmer Forums
|
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 December 23rd, 2003, 03:03 PM
Registered User
 
Join Date: Dec 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch4 Problem

If anyone could help out with this, I'd appreciate it.

On page 78 of chapter 4, I'm struggling with the paths the book is telling me to create.

First, I'm told to create a file called CarBean.java and save it to the folder %CATALINA_HOME\WEB-INF\classes\begjsp-ch04\WEB-INF\classes\com\wrox\cars
My %CATALINA_HOME directory is c:\Tomcat 5.0, the rest of the folders are not present. So I create them and save the file to:

c:\Tomcat 5.0\WEB-INF\classes\begjsp-ch04\WEB-INF\classes\com\wrox\cars
Correct so far?

Then I'm told to create a file called carPage.jsp and put it in %CATALINA_HOME\webapps\begjsp-ch04.

So create the file and put it in c:\Tomcat 5.0\webapps\begjsp-ch04

No problem, right?

Then the book on page 79 tell me to compile the java file. But it tells me to go to the folder, %CATALINA_HOME\webapps\begjsp-04\WEB-INF\classes
And Run: javac com\wrox\cars\CarBean.java

This doesn't seem to add up. And when I I go to this folder and run the command line, it obviously can't find the .java file.

Any ideas?
 
Old December 23rd, 2003, 03:19 PM
Registered User
 
Join Date: Dec 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I solved this and I believe it is a typo in the book, or at least made very unclear.

Printed on page 78 is the directory:

%CATALINA_HOME\WEB-INF\classes\begjsp-ch04\WEB-INF\classes\com\wrox\cars

It really should be:

%CATALINA_HOME\webapps\begjsp-ch04\WEB-INF\classes\com\wrox\cars
 
Old December 23rd, 2003, 03:29 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Great... I'm glad you solved your problem, however, when I checked my book the line that you say should read:

%CATALINA_HOME\webapps\begjsp-ch04\WEB-INF\classes\com\wrox\cars

is printed as:

%CATALINA_HOME%begjsp-ch04\webapps\begjsp-ch04\WEB-INF\classes\com\wrox\cars

Note the extra begjsp-ch04 at the start of the class path, preceeded by a %. I'm guessing that the missing % is a typo on your part.

You've probably spotted this already, but I just wanted to point it out in case it was the cause of more frustration.

Cheers

Martyn
 
Old January 21st, 2004, 03:39 PM
Registered User
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have this same problem in Chapter 4 and the solution below does not work for me. Does anyone have any suggestions?

Thanks!

Pete

Quote:
quote:Originally posted by daivos03
 If anyone could help out with this, I'd appreciate it.

On page 78 of chapter 4, I'm struggling with the paths the book is telling me to create.

First, I'm told to create a file called CarBean.java and save it to the folder %CATALINA_HOME\WEB-INF\classes\begjsp-ch04\WEB-INF\classes\com\wrox\cars
My %CATALINA_HOME directory is c:\Tomcat 5.0, the rest of the folders are not present. So I create them and save the file to:

c:\Tomcat 5.0\WEB-INF\classes\begjsp-ch04\WEB-INF\classes\com\wrox\cars
Correct so far?

Then I'm told to create a file called carPage.jsp and put it in %CATALINA_HOME\webapps\begjsp-ch04.

So create the file and put it in c:\Tomcat 5.0\webapps\begjsp-ch04

No problem, right?

Then the book on page 79 tell me to compile the java file. But it tells me to go to the folder, %CATALINA_HOME\webapps\begjsp-04\WEB-INF\classes
And Run: javac com\wrox\cars\CarBean.java

This doesn't seem to add up. And when I I go to this folder and run the command line, it obviously can't find the .java file.

Any ideas?
 
Old January 21st, 2004, 07:57 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The directory structure in the book is wrong change the directory structure:

%CATALINA_HOME\WEB-INF\classes\begjsp-ch04\WEB-INF\classes\com\wrox\cars

to:

%CATALINA_HOME\begjsp-ch04\WEB-INF\classes\com\wrox\cars

and then compile:

javac com\wrox\cars\CarBean.java

Once successful fire-up Tomcat, open your browser and point it to:

http://localhost:8080/begjsp-ch04/carPage.jsp


Cheers

Martyn
 
Old January 22nd, 2004, 12:15 PM
Registered User
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think what I have is what you suggest. Here's the absolute path that I have:

C:\jakarta-tomcat-5.0.16\webapps\begjsp-ch04\web-inf\classes\com\wrox\cars\CarBean.java

Is this what you mean? That's what I have and it doesn't work.

Thanks!

Pete

Quote:
quote:Originally posted by Martyn
 The directory structure in the book is wrong change the directory structure:

%CATALINA_HOME\WEB-INF\classes\begjsp-ch04\WEB-INF\classes\com\wrox\cars

to:

%CATALINA_HOME\begjsp-ch04\WEB-INF\classes\com\wrox\cars

and then compile:

javac com\wrox\cars\CarBean.java

Once successful fire-up Tomcat, open your browser and point it to:

http://localhost:8080/begjsp-ch04/carPage.jsp


Cheers

Martyn


 
Old January 22nd, 2004, 07:37 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Pete1234,

I'm a bit unclear, is the problem you are experiencing with the compile of carBean.java, or when you attempt to run carPage.jsp?

Cheers

Martyn
 
Old January 23rd, 2004, 11:33 AM
Registered User
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Martyn,

I have it working now.....

Thanks!

Pete

Quote:
quote:Originally posted by Martyn
 Hi Pete1234,

I'm a bit unclear, is the problem you are experiencing with the compile of carBean.java, or when you attempt to run carPage.jsp?

Cheers

Martyn

 
Old January 23rd, 2004, 12:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Pete,

Well done mate! What was it in the end?

Cheers

Martyn
 
Old January 30th, 2006, 01:57 AM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm having trouble with this same problem but my issue is a little different.

So I'm using Mac OS X running Tomcat and trying to work examples from a book about JavaBeans. My JavaBean code is for the file called CarBean.java and is as follows:

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;
    }
}

CarBean.java:1: 'class' or 'interface' expected
package com.wrox.cars;
^
CarBean.java:3: 'class' or 'interface' expected
import java.io.Serializable;
^
2 errors

I am trying to compile in /usr/local/jakarta-tomcat-4.1.31/webapps/ROOT/WEB-INF/classes/com/wrox/cars. I think that the %CATALINA_HOME is my /usr/local/jakarta-tomcat-4.1.31/ path

Any help would be appreciated.






Similar Threads
Thread Thread Starter Forum Replies Last Post
VB: Ch4 p132 Security Try It Out Rich57 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 October 19th, 2007 05:05 AM
Ch4 pge 112. WebSiteAdminTool Security problem enzoinbath BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 November 17th, 2006 08:22 AM
Problems in Ch3 and Ch4 Maram BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 August 4th, 2005 09:28 AM
ch4 wrong output? pete12345 JSP Basics 3 January 24th, 2004 09:51 AM





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