File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Compiling problem :-( Help! Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Compiling problem :-( Help!" Watch "Compiling problem :-( Help!" New topic
Author

Compiling problem :-( Help!

aliasger talib
Ranch Hand

Joined: Aug 19, 2002
Posts: 37
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'>

<tr>
<td>Check</td>
<td>Date</td>
<td>From</td>
<td>Subject</td>
<td>Size</td>
</tr>

<% webMail.setMessage(0); %>
<% for(int i = 1; webMail.getNextMessage(); ++i) { %>

<tr>
<td><input type='checkbox' name='number'
value='<%= webMail.getMessageNumber() %>'></td>
<td><jsp:getProperty name='webMail'
property='messageSentDate'/></td>
<td><jsp:getProperty name='webMail'
property='messageFrom'/></td>
<td>
<a href='<%= "read.jsp?message=" +
webMail.getMessageNumber() %>'>
<jsp:getProperty name='webMail'
property='messageSubject'/>
</a>
</td>
<td><jsp:getProperty name='webMail'
property='messageSize'/></td>
</tr>
<% } %>
</table>

<input type='submit' name='command' value='Delete'>
<input type='submit' name='command' value='Copy'>
<input type='submit' name='command' value='Move'>

<select name='to'>

<option value=''>Selected Messages To:</option>
<% String[] otherFolders = webMail.getOtherFolderNames();
for(int i = 0; i < otherFolders.length; ++i) { %>

<option><%= otherFolders[i] %></option>
<% } %>
</select>
</form>

<% } %>
</body>
</html>
-------------------------------------
Thanks for your patience guys. Appreciate it.
Cheers,
- A.
Zabe Agha
Greenhorn

Joined: Feb 27, 2003
Posts: 19
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
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
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
 
 
subject: Compiling problem :-( Help!
 
Threads others viewed
Can't pass changed beans values from one JSP page to another
submitting and forwarding JSP pages with beans
error occuring while use jsp
Problem with my jsp compilation/Java mail
<jsp:setProperty> sets null values in the bean
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com