Problems with a link to an external project from my jsp - "ExternalClass cannot be resolved to type"

I inherited 2 JSP projects (tomcat) in my eclipse with common code that is duplicated. I wanted to export a duplicate of the code to a shared library / project and reference it from a JSP project.

So, I did the following:

I created a new Java project "JSP-Common" with the following package "com.mycompany.jsp.common". There I create a class "ExternalClass" with the public method "test ()", which returns a string.

in the JSP1 project (one of two JSP projects):

  • I added the JSP-Common project to the project tab of the build path

  • I added the following import to the jsp file:

    <%@ page import = "com.mycompany.jsp.common.*" %> 
  • I added to the jsp file in the body somewhere

     <% ExternalClass ec=new ExternalClass(); %> 

After creating and publishing the project, I get the error message "ExternalClass cannot be resolved to type" in the line with the instance described above on my page.

Am I missing something? Help?

I want to do this when I build the JSP1 project, it will automatically accept calls from the JSP-Common project.

+4
source share
1 answer

You need to add the JSP-Common project in the deployment assembly: go to the "Deployment Assembly" page in the project properties. Click Add and select Project.

+4
source

Source: https://habr.com/ru/post/1392332/


All Articles