I have a jsp proyect as a presentation layer to show the result (a simple string) from a function from a java class. This class is in the src directory.
When I try to run I get this errors:
org.apache.jasper.JasperException: Unable to compile class for JSP:
and then:
parser cannot be resolved to a type
My jsp code is:
<%
String input="ebnf a{non terminal A;}";
Symbol tree=null;
parser p=null;
InputStream entrada=null;
analex analizador;
try{
entrada=new ByteArrayInputStream(input.getBytes("UTF-8"));
analizador=new analex(entrada);
p=new parser(analizador);
tree=p.parse();
}catch(Exception e){
out.println("ERROR");
}
finally{}
out.println("CORRECTO");
ConDiaCClass cdc=Singleton.getInstance();
out.println(cdc);
%>
Actually I get the same problem with ConDiaCClass and analex classes too.
I have not created these class with Eclipse. They are from another project but they both are placed in the src directory (where the java classes are suposed to be). It seems that the jsp cannot recognize them.
Finally it was just that the classes hadn’t got the visibility atribute. I had not the public attribute for them so they could not be resolved as a type although the jsp knew where they are.
That was a JFlex/CUP problem: JFlex & CUP creates classes (analex & parser) without a visibility attribute.
Thank you for you answers. Next time I’ll try to be more specific with my questions.