• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Simple Question

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im using Tomcat version 4.0
I created a bean that that holds two pictures and I created a jsp file. When I try to access it it gives me a 500 status code.
I have my pictures and the bean saved where the jsp, html, etc resides.
This is what I have in the jsp:
<jsp:useBean id="cartoon" class="CartoonBean" />
<img src="images/<jsp:getProperty name="cartoon" property"filename" />">
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your problem may be in where you are storing your code. Beans (and other server-side classes) should reside in the <context-root>/WEB-INF/classes or <context-root>/WEB-INF/lib directories. These directories are where the server first looks for classes in your server context.
You seem to be trying to reference them similar to applets by placing them in a web-accessible directory along with the HTML and JSP, etc.
Give that a try and feel free to email me if you get stuck (chris@stehno.com)
Hope this helps.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You really should put CartoonBean in a package, name that package in the useBean tag, import the package in the JSP, and, like Chris says, put the compiled class in the right place according to the Servlet API - I always suggest that people download the servlet and jsp API documents from java.sun.com - then you will have the authoritative reference.
Bill
 
reply
    Bookmark Topic Watch Topic
  • New Topic