Inside a JSP, how to represent private methods and call them?

Luigi Viggiano

[I wrote a servlet, and I want to convert it to a JSP file. Usually it is very simple - all of the code of the "doGet" method directly goes into the JSP. But now I have a private method in that servlet, that the “doGet” method calls with various arguments. How do I put that in a jsp? ]

Use a declaration scriptlet:


<%!
    private void foo() {
        System.out.println("foo");
    }
%>

<%
  foo();
%>

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact