title: Use custom class in jsp
body: <p>I have written some java code that can download some table data from an sql server. It works fine when it is loaded as just a java project and consists of 4 classes: Server.java, Publication.java, Volume.java, SQLPublicationMapper.java. (The third isn't used.)</p>
  
  <p>I am trying to use these custom classes in a jsp project. I have gotten the jsp project to work with tomcat and it works in the browser, but I can't find a way to make it use my custom classes. Where are they supposed to be located? Do they need to be imported?</p>
  
  <p>I have tried placing the class files in: src/jsp, WebContent, WebContent\src. None of these appear to work.</p>
  
  <p>I have spent multiple hours being stuck on this issue and searching but didn't find anything applicable, so I come here.</p>
  
  <p>The index.jsp file is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
  &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /&gt;
  &lt;title&gt;Dynamisk jsp side&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;En test af java til at starte med&lt;/h1&gt;
  Klokken er (eller var sidste gang du trykkede): &lt;%= new java.util.Date() %&gt;&lt;br&gt;
  Jeg tæller til 20: &lt;br&gt; &lt;% 
  int x = 1;
  while( x &lt;= 20 ) {
  %&gt;
  &lt;p&gt;X er lig &lt;%= x %&gt;&lt;/p&gt;
  &lt;%   x++;
  } %&gt;
  
  &lt;h1&gt;Jeg outputter også hele databasen:&lt;/h1&gt;
  
  &lt;%@ page import="dk.au.hum.imv.persistence.db.*,
  java.sql.*,
  java.util.ArrayList,
  com.googlecode.totallylazy.numbers.Numbers.*"
  %&gt;
  
  &lt;%
  //fetch all publications
  System.out.println("All publications");
  ArrayList&lt;Publication&gt; publications = SQLPublicationMapper.getAllPublications();
  System.out.println("First 5 publications are:");
  for (Number idx : range(1,5)) {
      System.out.println(publications.get((int) idx).title+" by "+publications.get((int) idx).author);
  }
  System.out.println("Out of a total of "+publications.size());
  %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Eclipse EE gives the following errors:
  line 32: Publication cannot be resolved to a type
  Multiple annotations found at this line:
      - SQLPublicationMapper cannot be resolved
      - SQLPublicationMapper cannot be resolved
  line 34: The method range(int, int) is undefined for the type 
   __2F_jsp_2F_WebContent_2F_index_2E_jsp</p>
  
  <p>As far as I can tell, the first error is due to Publication.class not being available. The second the same for SQLPublicationMapper (twice?).
  The third because of some error importing the functional java (totallyLazy) library. This error does not occur when I just run the java itself.</p>
  
  <p>The appropriate jar files are included in the buildPath settings.</p>
  
  <p>Any ideas?</p>