This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with jsp finding my bean see code

 
Ray Smilgius
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the code for the jsp:
<html>
<head>
<jsp:useBean class="linebean" id="bean0" scope="page" />
<title>Access JavaBean Methods</title>
</head>
<body>
Welcome to my Web page
<%= bean0.stars(30) %>
</body>
</html>

/////////////////////here is the code for the bean
public class linebean
{
public String stars(int x)
{
String text = "
";
for(int i =0;i<x;i++)>
text = text + "*";
return text + "
";
}
public String doubleLine(int x)
{
String text = "
";
for (int i=0;i<x;i++)>
text = text + "=";
return text + "
";
}
}
////It is in the C:\jakarta-tomcat-4.0\webapps\examples\WEB-INF\classes where I put all my servlet classes to run
I am getting the error linebean not found in my JSP a servlet exception
also does a bean have to be in a package???mine is not.
Thanks Ray Smilgius
 
Greg Harris
Ranch Hand
Posts: 1012
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was having the same problem using tomcat on webappcabaret.com... i had the jsp/servlets working on orion server, but for some reason i could not get the tomcat server to work.
so, i installed tomcat on my desktop and got it to work. the jsp file identifies the bean as:
jsp:useBean
id="studentList"
class="dataaccess.StudentListBean"
the bean is in a directory that is in the /classes directory. so, the bean path is ../web-inf/classes/dataaccess
i am not that familiar with jsp yet, but i hope this helps.
 
Ray Smilgius
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sir,
I will dwell on this at work tomorrow.
Thanks Ray
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic