aspose file tools
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 Groovy Fundamentals video training course this week in the Groovy 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: 12955
Importing mybeans.MyCalendar in your page directive might fix this.
I agree. Here's the link:
subject: JSP file couldn't recognized JavaBeans