aspose file tools*
The moose likes Tomcat and the fly likes Problem with jsp finding my bean see code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem with jsp finding my bean see code" Watch "Problem with jsp finding my bean see code" New topic
Author

Problem with jsp finding my bean see code

Ray Smilgius
Ranch Hand

Joined: Jan 29, 2001
Posts: 120
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

SCJO, SCJD, SCWCD, I-Net+, A+, Network+, MCSD, MCDBA, MCP, MCT
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
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.


what?
Ray Smilgius
Ranch Hand

Joined: Jan 29, 2001
Posts: 120
Thanks Sir,
I will dwell on this at work tomorrow.
Thanks Ray
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem with jsp finding my bean see code