File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes JSP file couldn't recognized JavaBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP file couldn Watch "JSP file couldn New topic

JSP file couldn't recognized JavaBeans

Timbu Buddu

Joined: Apr 01, 2003
Posts: 8
The NumColDate.jsp file uses the bean But when I try to access the bean, I got an error "Undefined variable or class mybean"
Here are my files...
package mybeans;
import java.util.*;
public class MyCalendar{
Calendar c;
int year,month,day;
public MyCalendar(){
public int getYear(){
return year;
public int getMonth(){
return month;
public int getDay(){
return day;

Number, Colors and Date
<!--Thispage generates 26 numbers and the displays the date provided -->
<%@ page language="java" %>
<jsp:usebean id="datebean" scope="page" class="mybeans.MyCalendar" />
year: <%= datebean.getYear() %>
month: <%= datebean.getMonth() %>
day: <%= datebean.getDay() %>
<% for (int i=0;i<26;++i){ %>
<%= i %>
<% } %>

Directory Structure
1. Tomcat/webapps/JSP/NumColDate.jsp
2. Tomcat/webapps/JSP/web-inf/classes/mybeans/ NumColDate.jsp
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12755
Importing mybeans.MyCalendar in your page directive might fix this.
jQuery in Action, 2nd edition
subject: JSP file couldn't recognized JavaBeans
Similar Threads
Importing Java Foundation Classes automatically
trying to get a simple bean example to work using Tomcat and jsp
Error in JSP when using bean concept
JasperException from non-numeric parameter value
Trouble writing to bean