I inherited 2 JSP projects (tomcat) in my eclipse with common code that is duplicated. I wanted to externalize the duplicate code to common library/project and reference it from both 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 a public "test()" method that returns a string.
in JSP1 project(one of the 2 JSP projects):
I added the JSP-Common project to the build path projects tab
I added to the jsp file in it the following import:
<%@ page import = "com.mycompany.jsp.common.*" %>
I added to the jsp file in the body somewhere
<% ExternalClass ec=new ExternalClass(); %>
After building and publishing the project, I get a "ExternalClass cannot be resolved to a type" error on the line with the instantiation above in my page.
Am I missing something ? Help ?
I want to make it so when I build my JSP1 project it will automatically take the callses from the JSP-Common project.
You have to add JSP-Common project in Deployment Assembly: go to Deployment Assembly page under project properties. Hit Add and select "Project" option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With