Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning JavaServer Pages
BOOK: Beginning JavaServer Pages
This is the forum to discuss the Wrox book Beginning JavaServer Pages by Vivek Chopra, Jon Eaves, Rupert Jones, Sing Li, John T. Bell; ISBN: 9780764574856
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaServer Pages 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 May 13th, 2005, 03:38 PM
Registered User
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default CH3- java class imported, but still undefined

I'm trying to set up a test a simple jsp setup based off of Chapter 3 example 1. It's very simple - an index which has a link to a log in page, a log in page, and a logged in page. Im not concerned with forms or anything like that. My problem is I'm using "User.java" and "User.class" that are stored in WEB-INF/classes/custom. The Testing.war includes these. The first line in User.java is "package custom;" and the first line of the log in page is <%@ page language="java" import="custom.*,java.util.*"> copied from the chapter 3 example 1 format. For some reason, User is undefined. I debugged with Sun ONE Studio 5, and found that it looks like its correctly importing both custom.* and java.util.*
I can't figure out why User is undefined. I made sure to look at everything from the chapter 3 example 1 (and WEB-INF) and everything is in the same format.

Here's what the directory looks like
ROOT: Testing

| - classes
| | - custom
| | | - User.java
| | | - User.class
| - lib
| | - jstl.jar
| | - standard.jar
| - web.xml
- main
| - index.jsp // only contains a header and a link to page.jsp
| - page.jsp // Trying to use the User object (has a log in form)
| - page2.jsp // displays whether the test application works or not
- Testing.war

Any ideas?
Old May 19th, 2005, 08:13 PM
Registered User
Join Date: May 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

It's unusual to put the User.java in the WEB-INF/classes directory. While this is not likely to be causing you issues, this might indicate that your development environment is not setup quite correctly.

Running Tomcat or other containers within an IDE can be problematic due to classloading issues. I would suggest trying to run this from a command line to see what happens.
Old May 20th, 2005, 12:02 PM
Registered User
Join Date: May 2005
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

To be honest, I am beginning with web-applications - no real experience with that, and I only am slightly familiar with java from a semester class several years ago. But, I am quite familiar with C and C++ used with visual studio, so I don't know how to run this from a command line. I do now know how to compile with command line, use ant with command line, but that's about it.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Best Practices Class gxp Spring 0 August 21st, 2008 06:02 PM
Java Gui (Reload Class) Axar Java GUI 0 June 10th, 2006 05:35 PM
Using Java class from C# gettipu J2EE 0 February 7th, 2005 06:57 PM
undefined class name-oracle junemo Oracle 1 June 2nd, 2004 10:28 AM
java class edit mode mateenmohd Java GUI 2 March 8th, 2004 06:31 AM

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