Boa noite, GUJs!
Pessoal, creio que minha dúvida seja bastante comum, mas em todas as soluções que encontrei pela internet, não me ajudaram e estou aqui para obter essa resposta.
Estou engatinhando no JSP, acompanhado da FJ-21, e estou com dificuldades para instanciar uma classe em minha página .JSP. Ao chamar a classe Teste.java em minha .JSP, mas a mesma classe Teste.java chamado da Main.java, funciona! Gostaria por favor, que alguém me indicasse onde estou falhando. Obrigado.
Diretórios do projeto:

index.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="teste.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
Teste t = new Teste();
t.digite();
%>
</body>
</html>
Teste.java
package teste;
public class Teste {
public void digite(){
System.out.println("Println .java");
}
}
Main.java
package teste;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Teste t = new Teste();
t.digite();
}
}
Erro:
HTTP Status 500 - Unable to compile class for JSP: An error occurred at line: 13 in the jsp file: /TesteJSP/WebContent/index.jsp Teste cannot be resolved to a type 10: <body> 11: <% 12: 13: Teste t = new Teste(); 14: t.digite(); 15: 16: %> An error occurred at line: 13 in the jsp file: /TesteJSP/WebContent/index.jsp Teste cannot be resolved to a type 10: <body> 11: <% 12: 13: Teste t = new Teste(); 14: t.digite(); 15: 16: %> Stacktrace:
type Exception report
message Unable to compile class for JSP: An error occurred at line: 13 in the jsp file: /TesteJSP/WebContent/index.jsp Teste cannot be resolved to a type 10: <body> 11: <% 12: 13: Teste t = new Teste(); 14: t.digite(); 15: 16: %> An error occurred at line: 13 in the jsp file: /TesteJSP/WebContent/index.jsp Teste cannot be resolved to a type 10: <body> 11: <% 12: 13: Teste t = new Teste(); 14: t.digite(); 15: 16: %> Stacktrace:
description The server encountered an internal error (Unable to compile class for JSP: An error occurred at line: 13 in the jsp file: /TesteJSP/WebContent/index.jsp Teste cannot be resolved to a type 10: <body> 11: <% 12: 13: Teste t = new Teste(); 14: t.digite(); 15: 16: %> An error occurred at line: 13 in the jsp file: /TesteJSP/WebContent/index.jsp Teste cannot be resolved to a type 10: <body> 11: <% 12: 13: Teste t = new Teste(); 14: t.digite(); 15: 16: %> Stacktrace:) that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 13 in the jsp file: /TesteJSP/WebContent/index.jsp
Teste cannot be resolved to a type
10: <body>
11: <%
12:
13: Teste t = new Teste();
14: t.digite();
15:
16: %>
An error occurred at line: 13 in the jsp file: /TesteJSP/WebContent/index.jsp
Teste cannot be resolved to a type
10: <body>
11: <%
12:
13: Teste t = new Teste();
14: t.digite();
15:
16: %>
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.29 logs.
Apache Tomcat/7.0.29



