aspose file tools*
The moose likes JSP and the fly likes Simple Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Simple Question" Watch "Simple Question" New topic
Author

Simple Question

Angelo Watson
Ranch Hand

Joined: Oct 27, 2002
Posts: 39
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" />">
Chris Stehno
Ranch Hand

Joined: Feb 26, 2001
Posts: 180
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.


- Chris Stehno, SCPJ
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12683
    
    5
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


Java Resources at www.wbrogden.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple Question
 
Similar Threads
Display images in a JSP page
JBOSS not finding JSF backing bean function
Display images in a JSP page
use of JavaBean in JSP
Bean instantiation from JSP