Eclipse servlet/jsp webapp can't use java classes [message #662041] |
Tue, 29 March 2011 02:19 |
Benjamin Messages: 5 Registered: March 2011 |
Junior Member |
|
|
Hello,
I started making a brand new servlet/jsp web app in eclipse for my server which is using tomcat 7.0.10. I have 1 class, only one class, and no other class exists in this project. When I try to import this class into my JSP page, I get the error shown here:
http://www.bdbeasley.com/bdbeasley_ROOT/
Now, what I noticed is that even though I build my project, eclipse does not put my class files in WEB-INF/lib. So, I have to do it myself. If I don't put the class in there, then I get an error saying that tomcat can't find the classes, but if I put the classes into WEB-INF/lib and upload manually, I get an error that says tomcat thinks the class is a package! I know, its bizarre right? Why would it think my class is a package!
So obviously something here is screwy, but i don't know what... so uhhh... golden brownies to the fella who figures this one out.
header.jsp
<%@page import = "java.lang.Integer" %>
<%@page import = "manager.PageManager" %>
<%
int iPageNumber = ((Integer) request.getAttribute("pageNumber")).intValue();
iPageNumber--;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><%= PageManager.pageTitles[iPageNumber] %></title>
<link href = "resources/css/main.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<table align="center" width="610">
<tr>
<td align="left">
<h1>Benjamin D. Beasley</h1>
<h2>Software Engineer</h2>
<!-- MAIN TABS -->
<ul class = "navBar">
<%
for(int i = 0; i < PageManager.pageTabTitles.length; i++)
{
%>
<li class = "<%= (i == iPageNumber ? "selected" : "deselected") + " " + (i == 0 ? "first" : "") %>">
<a href = "<%= PageManager.pageTabUrls[i] %>"><%= PageManager.pageTabTitles[i] %></a>
</li>
<%
}
%>
<li class = "selected first" >
<a href = "index.jsp">Portfolio</a>
</li>
<li class = "deselected">
<a href = "contact.jsp">Contact</a>
</li>
</ul>
<table id="mainTable" border="0" cellspacing="0" cellpadding="6" width="610">
<tr>
<td>
[Updated on: Tue, 29 March 2011 02:20] Report message to a moderator
|
|
|
Re: Eclipse servlet/jsp webapp can't use java classes [message #662211 is a reply to message #662041] |
Tue, 29 March 2011 17:56 |
|
On 3/28/2011 10:19 PM, Benjamin wrote:
> I started making a brand new servlet/jsp web app in eclipse for my
> server which is using tomcat 7.0.10. I have 1 class, only one class, and
> no other class exists in this project. When I try to import this class
> into my JSP page, I get the error shown here:
> http://www.bdbeasley.com/bdbeasley_ROOT/
>
>
> Now, what I noticed is that even though I build my project, eclipse does
> not put my class files in WEB-INF/lib. So, I have to do it myself. If I
> don't put the class in there, then I get an error saying that tomcat
> can't find the classes, but if I put the classes into WEB-INF/lib and
> upload manually, I get an error that says tomcat thinks the class is a
> package! I know, its bizarre right? Why would it think my class is a
> package!
> So obviously something here is screwy, but i don't know what... so
> uhhh... golden brownies to the fella who figures this one out.
Standalone .class files are supposed to go into the WEB-INF/classes
folder. WEB-INF/lib is meant to contain jar files. You might want to
pursue this further, if needed, in the eclipse.webtools group.
--
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02357 seconds