W3C home > Mailing lists > Public > www-jigsaw@w3.org > May to June 2000

How to define a function within a JSP ?

From: Roland Mainz <Roland.Mainz@informatik.med.uni-giessen.de>
Date: Mon, 22 May 2000 18:11:11 +0200
Message-Id: <39295C1F.6B852FE5@informatik.med.uni-giessen.de>
To: W3 Jigsaw Mailinglist <www-jigsaw@w3.org>

Hi !

----

Does anyone know how to define a function within a JSP (tomcat 3.1
JSP) ?

I'd like to do something like the following (non-working) example:
-- snip --
<%
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;
}

%>
<html>
  <body>
    <% java.util.Date d = new java.util.Date(); %>

    The current date is <%= "date == " + d + " " + isDefined(request,
"test", "mark1") %>
    <p />
  </body>
</html>

-- snip --

Any ideas ?

----

Bye,
Roland

--
  __ .  . __
 (o.\ \/ /.o) Roland.Mainz@informatik.med.uni-giessen.de
  \__\/\/__/  gisburn@informatik.med.uni-giessen.de
  /O /==\ O\  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
 (;O/ \/ \O;) TEL +49 641 99-13193 FAX +49 641 99-41359
Received on Monday, 22 May 2000 12:11:31 GMT

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