SunQuest
           Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old October 8th, 2002, 09:35 AM
progkcp progkcp is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 8 progkcp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to progkcp
Question jsp package directory structure problem

I'm new and trying to follow an example from a wrox book on how to set up a jsp with a bean. I'm doing something wrong but I can't figure out what my problem is....

Here's the story...



I compile my .java file from the following directory

D:\Tomcat 4.1\webapps\begjsp-ch04\web-inf\classes

as follows

javac com\wrox\cars\CarBean.java




I point my browser to

http://dsti-128:8080/begjsp-ch04/carPage.jsp

and I get this error:

type Exception report

message

description The server encountered an internal error () that prevented it from
fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 14 in the jsp file: /begjsp-ch04/carPage.jsp

Generated servlet error:
[javac] Compiling 1 source file

D:\Tomcat 4.1\work\Standalone\localhost\_\begjsp-ch04\carPage_jsp.java:49:
package com.wrox.cars does not exist

com.wrox.cars.CarBean myCar = new com.wrox.cars.CarBean();
out.write("\r\n\t\r\n\tI own a ");
^

here's the contents of 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("Ferrari"); %>

Now I own a <%= myCar.getMake() %>

</body>

</html>




here's the contents of CarBean.class

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;

}

}


<***Location of my class CALLED CarBean.class********>

10/07/2002 03:03 PM 458 CarBean.class
10/03/2002 01:53 PM 279 CarBean.java

D:\Tomcat 4.1\webapps\begjsp-ch04\web-inf\classes\com\wrox\cars>





<***Location of my JSP CALLED carPage.jsp ********>

10/07/2002 03:25 PM 319 carPage.jsp

D:\Tomcat 4.1\webapps\ROOT\begjsp-ch04>









<***environmental variables**********>


CATALINA_HOME = D:\Tomcat 4.1


CLASSPATH = D:\Tomcat 4.1\common\lib\servlet.jar;.;
...
D:\Tomcat 4.1\webapps\begjsp-ch04\web-inf\classes;


JAVA_HOME = D:\j2sdk1.4.0_01



PATH = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
...
C:\Program Files\Common Files\Adaptec Shared\System;D:\j2sdk1.4.0_01\bin

Reply With Quote
  #2  
Old October 8th, 2002, 12:54 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
You say your jsp is in "D:\Tomcat 4.1\webapps\ROOT\begjsp-ch04" and your bean is in "D:\Tomcat 4.1\webapps\begjsp-ch04"?

Those need to be the same.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > jsp package directory structure problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway