"Can not find symbol" when calling a class from a JSP file

1

I make this call to the "CookieHandler" class from the start of the JSP:

<% 
    CookieHandler handler = new CookieHandler();
    if(handler.checkLogged(request, response)){
%>

It happens that I do not stop having this error, I do not know why:

  

org.apache.jasper.JasperException: PWC6033: Error in Javac compilation   for JSP

     

PWC6199: Generated servlet error: source value 1.5 is obsolete and   will be removed in a future release

     

PWC6199: Generated servlet error: target value 1.5 is obsolete and   will be removed in a future release

     

PWC6199: Generated servlet error: To suppress warnings about obsolete   options, use -Xlint: -options.

     

PWC6197: An error occurred at line: 9 in the jsp file:   /SeccionUsuarios.jsp PWC6199: Generated servlet error: can not find   symbol symbol: class CookieHandler location: class   org.apache.jsp.SeccionUsuarios_jsp

     

PWC6197: An error occurred at line: 9 in the jsp file:   /SeccionUsuarios.jsp PWC6199: Generated servlet error: can not find   symbol symbol: class CookieHandler location: class   org.apache.jsp.SeccionUsuarios_jsp

The class "CookieHandler" is in the default package of the project, because this project is only to teach some Java EE things (that is, nothing serious), but it still amazes me why I have this error. Does anyone know what happens?

    
asked by Zerok 08.09.2016 в 12:31
source

1 answer

1

The problem is in the description of your situation:

  

The "CookieHandler" class is in the default project package.

The JSPs can not access the classes that are in the default project package (servlets included). Place the class inside a package and then, in your JSP, the class matters:

<%@ page import="paquete.para.CookieHandler" %>

I recommend that you avoid showing scriptlets to people who are learning Java EE. They are not considered good practice for real applications.

    
answered by 09.09.2016 / 05:19
source