1.Is it a must that the bean has to be a part of a Package?
2. Here are the complete details :
JAVA_HOME: C:\jdk1.3.1
TOMCAT_HOME : C:\TOMCAT\JAKART~1.3
when i start the TOMCAT this is what is shown :
Including all jars in C:\TOMCAT\JAKART~1.3\lib in your CLASSPATH.
Using CLASSPATH: C:\TOMCAT\JAKART~1.3\classes;C:\TOMCAT\JAKART~1.3\lib\ant.jar;C
:\TOMCAT\JAKART~1.3\lib\jasper.jar;C:\TOMCAT\JAKART~1.3\lib\jaxp.jar;C:\TOMCAT\J
AKART~1.3\lib\parser.jar;C:\TOMCAT\JAKART~1.3\lib\servlet.jar;C:\TOMCAT\JAKART~1
.3\lib\webserver.jar;C:\jdk1.3.1\lib\tools.jar
Hence, I placed all my class files in C:\TOMCAT\JAKART~1.3\Classes , JSP files are in C:\TOMCAT\JAKART~1.3\webapps\mydir
I call the login.html which in turn calls the ValidateUser1.jsp which is
<jsp:useBean id="loginManager" class="/Classes/LoginManager"
scope="application" />
<jsp:useBean id="credentials" class="/Classes/UserCredentials"
scope="session" />
<jsp:setProperty name="credentials" property="*"/>
<%!
String nextPage; %>
<%
if (loginManager.login(credentials)) {
nextPage="MainMenu.jsp";
}
else if (loginManager.alreadyLoggedIn(credentials)) {
nextPage="DuplicateLogin1.jsp";
}
else {
nextPage="LoginFailure1.jsp";
}
%>
<jsp:forward page="<%= nextPage %>"/>
<%@ page errorPage="Exception.jsp" %>
LoginManager is in Classes dir as mentioned above.Exception.jsp is as follows:
<%@ page isErrorPage="true" %>
<html>
<head>
<title>FATAL ERROR</title>
</head>
<body bgcolor="#ffffff">
<center>
<br>
<br>
<h1>A FATAL ERROR HAS OCCURRED!!!</h1>
</center>
<br>
<b>
<h2>
<%= exception.getMessage() %>
</h2>
<center>
<br>
Report above message to System Administrator
</b>
</center>
</body>
</html>
So when i click on submit buton inlogin.html it does go to ValidateUser1.jsp and then shows the message :
A FATAL ERROR HAS OCCURRED!!!
Cannot create bean of class LoginManager
Report above message to System Administrator
So why does it not create a bean?Is it because its not in a package?If i do place the bean in a package say com.something then i would have to include the bean as com.something.LoginManager - right?But would I need to change the directory structure in my Classes dir too like -
Classes
- com
-something(which has all bean class files)
Please help.I would be much obliged and very thankful
TIA -Kameswari
Originally posted by William Brogden:
It would help if you showed the JSP code where you are trying to create the bean - anyway, I will take a guess based on other folks problems.
1. Your bean should be a member of a package, NOT the default pkg
2. You must place the class files according to the rules for servlets - note how the Tomcat examples are constructed. This is all related to how your web application context is defined like Samith said.
3. Your <jsp:useBean tag must give the complete package in the class= attribute.
4. You must also import the package in the <%@ page directive
Bill