Just import it in the same way as in a real Java class. That is, import mypackagename.MyClassName or import mypackagename.* And therefore not import mypackagename with just the package name.
<%@ page import="mypackagename.MyClassName" %>
However, you should not write Java source code in a JSP file. Scripting is considered bad. This code belongs to the real Java class. It was perfectly located in the Servlet class. What is this, the problem by which you think this is the βrightβ solution, move it all to the side of your vision and clutter up the template text with raw Java code? Develop about this in a new question, then we can offer the right solutions. Perhaps you did not know about the existence and authority of taglib, such as JSTL ?
Balusc
source share