Search code examples
javajsptomcatjrun

Classes from the default package must not be referenced from JSP file


From JSP file accessed another JSP file which acts like java class, this used to work in JRun server properly. Now I'm migrating to Tomcat server and this is what I'm getting. How can I solve such problem?

This is another.jsp file which is accessed from regular jsp file:

 <%!
public class ElemSetup {
}
%>

Solution

  • You can solve such problems by having a package declaration. Seriously, it is a strongly discouraged practice to have the default package!

    Well, declaring a class inside a JSP is forbidden. Use a regular .java file instead.