Hi there guys, I'm trying to run some JSPs here and it's creating a problem. I'm using Tomcat 4.1.12 as my server. There is an application which starts by calling the file mail.jsp. This file links to a class file WebMailBean.class. I've placed the class file in the directory: TOMCAT_HOME\webapps\WebMail\classes This is the error I'm getting when I call mail.jsp in IE. There are many more occurances of the error, but I've just shown the first two. I think it's not finding my class file or something:
---------------------------------- An error occurred at line: 2 in the jsp file: /mail.jsp Generated servlet error: [javac] Compiling 1 source file D:\Tomcat4.1\work\Standalone\localhost\WebMail\mail_jsp.java:42: cannot resolve symbol symbol : class WebMailBean location: class org.apache.jsp.mail_jsp WebMailBean webMail = null; ^ An error occurred at line: 2 in the jsp file: /mail.jsp Generated servlet error: D:\Tomcat4.1\work\Standalone\localhost\WebMail\mail_jsp.java:44: cannot resolve symbol symbol : class WebMailBean location: class org.apache.jsp.mail_jsp webMail = (WebMailBean) pageContext.getAttribute("webMail", PageContext.SESSION_SCOPE); ^ ----------------------------------------- And here is my mail.jsp: --------------------------------- <%@ page language='java' %> <jsp:useBean id='webMail' class='WebMailBean' scope='session'/> <jsp:setProperty name='webMail' property='protocol'/> <jsp:setProperty name='webMail' property='host'/> <jsp:setProperty name='webMail' property='port'/> <jsp:setProperty name='webMail' property='user'/> <jsp:setProperty name='webMail' property='password'/> <%-- Is the user logged in to the store? --%> <% if(!webMail.isConnected()) { %>
<jsp:forward page='login.jsp'/>
<% } %> <html> <head><title>WebMail</title></head> <body> <%-- Does a command need to be executed? --%> <% if(request.getParameter("command") != null) { webMail.doCommand(request); } %> <%-- Change the current folder, if necessary. --%> <jsp:setProperty name='webMail' property='folder'/> <%-- Display the messages in this folder. --%> <h2><jsp:getProperty name='webMail' property='folderName'/></h2> <a href='write.jsp?to=&subject='>Compose</a> | <a href='logout.jsp'>Logout</a> <form method='post' action='<%= request.getRequestURI() %>'> Folder: <select name='folder'> <% String[] folderNames = webMail.getFolderNames(); for(int i = 0; i < folderNames.length; ++i) { %> <option><%= folderNames[i] %></option> <% } %> </select> <input type='submit' value='Go'> </form> <% int messageCount = webMail.getMessageCount(); if(messageCount == 0) { %> <h1>No messages</h1> <% } else { %> <form method='post' action='mail.jsp'> <table border='1'>
<% } %> </body> </html> ------------------------------------- Thanks for your patience guys. Appreciate it. Cheers, - A.
Zabe Agha
Greenhorn
Joined: Feb 27, 2003
Posts: 19
posted
0
Aliasger -- Your JSP is trying to pull the object from session. Unless you specifically put it there, it won't be found.
boyet silverio
Ranch Hand
Joined: Aug 28, 2002
Posts: 173
posted
0
hello Aliasger, One possible cause of the error is that you have not packaged your WebMailBean to something like com.WebMailBean). This seem to be a requirement with tomcat version 4.1.x. Unpackaged beans work fine with earlier tomcat versions (e.g. 4.0) though.
Anoop Krishnan
Ranch Hand
Joined: May 03, 2001
Posts: 163
posted
0
Try by keeping the classes under TOMCAT_HOME\webapps\classes\[PACKAGE_ROOT]
I just want to know is there any body call my bean's Getter and Setter methods with "Please" in front - My favorite quip from Bugzilla