• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with jsp finding my bean see code

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1012
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Sir,
I will dwell on this at work tomorrow.
Thanks Ray
 
reply
    Bookmark Topic Watch Topic
  • New Topic