• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to import bean  RSS feed

 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the jsp page where i am importing java bean class
and stored in webapps\purejsp\pagebean.jsp
---------------------------------------------------------
<jsp:useBean id="counter" scope="page" class="Counter"/>
<html>
<head>
<title>page bean example</title>
</head>
<body>
<h3>page bean example</h3>
<center><b>The current count for the counter bean is :</b>
<%=counter.getCount() %></center>
</body>
</html>
-------------------------------------------------------
this is the java bean where i stored in purejsp\WEB-INF\classes
---------------------------------------------------------------
import java.io.Serializable;
public class Counter implements Serializable
{
int count=0;
public Counter()
{
}
public int getCount()
{
count++;
return this.count;
}
public void setCount(int count)
{
this.count=count;
}
}
------------------------------------------------
errors i am getting
unresolve symbol class Counter
----------------------------------------------
 
Vijay Vaddem
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Lakshmi,
If you are running on tomcat server, you need to place your bean
in a package and place the bean in WEB-INF/classes/yourpackage
In JSP, in useBean, please pass the complete package structure...
for example:
<jsp:useBean id="counter" class="yourpackage.your_class_name" scope="page">
</jsp:useBean>
Hope this will help you....
Regards,
Vijay
[ May 02, 2004: Message edited by: Vijay Vaddem ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!