Reputation: 53
this is my index.jsp page:
<html>
<body>
<%!
public class myclass{
private final int foo = 42;
public int getFoo() {
return foo;
}
}
%>
</body>
</html>
how to call myclass method or variable in other jsp page ? please help me .
Upvotes: 0
Views: 776
Reputation: 1427
Did you try to use something like
<%@ include file="/myFile.jsp" % >
???
Upvotes: 0
Reputation: 128899
You don't from any "other" JSP. Those declarations should be treated as local to the JSP. If you need a class to be used by multiple JSPs, write it as a separate Java source file, compile it, and include it in your webapp in WEB-INF/classes.
Upvotes: 4