I’m trying to get my first jsp page running and it does not work as I expect it to.
I’m using Tomcat7 + Eclipse.
First I created my framework.java file and put it in: \ROOT\WEB-INF\classes\framework.
Then I successful compiled it so I got:
\ROOT\WEB-INF\classes\framework\Layer1.class, Layer2.class, Layer3.class
Then i did the actual jsp file:
<%@ page import="framework.Layer1" %>
<%= Layer1.write() %>
Now, even Eclipse at this point gives me the warning: The type framework.Layer1 is not visible.
And when I run the page, naturally it says: The type framework.Layer1 is not visible.
What am I doing wrong here? I tried all tutorials I found and all had the same issue.
Any suggestions?
You are in the right path, but you need to make sure Layer1 is a public class.
So, your
Layer1class must be something like:Instead of: