• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Undefined variable or class name

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I don't see any <%@ page import="Item" %> in your JSP.
Suresh Selvaraj
 
brian buckholz
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suresh,
It works - seems I forgot a lot of the earlier examples in the book left this out. Thank you !!
 
She said she got a brazillian. I think owning people is wrong. That is how I learned ... tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic