This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to call inner class method or variable from outer jsp?  RSS feed

 
amir taghvayi
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
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 .
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65824
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't. Firstly, the time to be putting Java code in a JSP is long past -- almost 10 years to be exact. Time to move on.

Secondly, even when scriptlets were in vogue, using a JSP for such a purpose was not acceptable. Reusable code belongs in a Java class, not a JSP.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!