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
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP file couldn Watch "JSP file couldn New topic
Author

JSP file couldn't recognized JavaBeans

Timbu Buddu
Greenhorn

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

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

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
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
Importing mybeans.MyCalendar in your page directive might fix this.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP file couldn't recognized JavaBeans