File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Undefined variable or class name Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Undefined variable or class name" Watch "Undefined variable or class name" New topic
Author

Undefined variable or class name

brian buckholz
Greenhorn

Joined: Feb 08, 2003
Posts: 5
I was just reviewing Geremy Kawaller's JSP Weekend Crash Course. There is an MVC example in section 24 that I installed using Tomcat 4.0.4. Using http://localhost:8080/mvc/buy.jsp I get:
Generated servlet error:
C:\jakarta-tomcat-4.0.4\work\Standalone\localhost\mvc\buy$jsp.java:58: Undefined variable or class name: Item
out.print( Item.getAllItemsChoice("item") );
-- buy.jsp -->
<%@ page session="true" %>
<HTML><HEAD><TITLE>Shop Til You Drop</TITLE></HEAD>
<BODY BGCOLOR=cornsilk>
<form name=shopping
action=/mvc/controller.go
method=post>
Choose one:
<%= Item.getAllItemsChoice("item") %>
<input type=hidden name=viewcmd value=A>
<input type=submit value="Add to Cart">
</form>
<form action=/mvc/controller.go method=post>
<input type=hidden name=viewcmd value=C>
<input type=submit value="Show Cart">
</form>
</BODY></HTML>
<-- end buy.jsp ----
The Item.Class is in:
.../webapps/mvc/WEB-INF/classes
Any ideas ?? Seems it doesn't find the "Item" clas.
thanks.
Suresh Selvaraj
Ranch Hand

Joined: Nov 14, 2000
Posts: 104
Hi,
I don't see any <%@ page import="Item" %> in your JSP.
Suresh Selvaraj


Suresh Selvaraj, (author of JQuiz)<br />SCJP2<br /><a href="http://www.decontconsulting.com" target="_blank" rel="nofollow">www.decontconsulting.com</a>
brian buckholz
Greenhorn

Joined: Feb 08, 2003
Posts: 5
Suresh,
It works - seems I forgot a lot of the earlier examples in the book left this out. Thank you !!
 
IntelliJ Java IDE
 
subject: Undefined variable or class name
 
Threads others viewed
Scripting Invalid
My Shopping cart does not work
How to run jsp on TOMCAT?
my first servlet please help.
HELP HELP !!! JSP-BEAN
jQuery in Action, 2nd edition