W3C home > Mailing lists > Public > www-jigsaw@w3.org > March to April 2001

Re: How to define a function within a JSP ?

From: Suresh Solomon <suresh@yashaa.com>
Date: Tue, 27 Mar 2001 10:08:21 -0500 (EST)
Message-ID: <000901c08872$97420730$6301a8c0@sureshsolomon>
To: <www-jigsaw@w3.org>
declare the method in a declaration tag like

<%!


boolean isDefined( HttpServletRequest req, String name, String value )

{
    String vals[] = (String [])req.getParameterValues(name);
    if (vals != null)
    {
      for (int i = 1; i<vals.length; i++)
      {
        if( value.equalsIgnoreCase(vals[i]) )
          return true;
      }
    }
    return false;
}
%>

and continue as usual like isDefined(request,"name","value")

thanx,
Suresh
Received on Tuesday, 27 March 2001 10:21:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:35 GMT