Call function in jsp page : Scriptlet « JSP « Java Tutorial






<%--
  Copyright (c) 2002 by Phil Hanna
  All rights reserved.
  
  You may study, use, modify, and distribute this
  software for any purpose provided that this
  copyright notice appears in all copies.
  
  This software is provided without warranty
  either expressed or implied.
--%>
<%!
   public int sum(int a, int b)
   {
      return a + b;
   }
%>
2 + 2 = <%= sum(2, 2) %>








23.29.Scriptlet
23.29.1.Scriptlet Example
23.29.2.Call function in jsp page
23.29.3.Count to 10 Example using JSP Scriptlet
23.29.4.All Scripting Elements
23.29.5.This scriptlet checks a hidden field to see whether or not to throw an exception