You can create a function in JSP:

<%!
     String format(....) { }
%>

Note that '!', it indicates the following block is a declaration and
should be placed as such in the resulting Java servlet (JSPs are
translated to servlets).

Note however that a much better approach would be to develop a custom
tag.

Cheers,
Boris

____________________________________________
Borislav Iordanov
Chief Architect
TICL - a RAD toolkit for server-side Java
http://www.kobrix.com

> -----Original Message-----
> From: A mailing list about Java Server Pages specification and
reference
> [mailto:JSP-INTEREST@;JAVA.SUN.COM] On Behalf Of Kenny G. Dubuisson,
Jr.
> Sent: Tuesday, October 22, 2002 3:59 PM
> To: [EMAIL PROTECTED]
> Subject: Functions in JSP
>
> I need to create a function that formats a data a certain way and I
need
> to
> be able to call it from within a JSP page.  Would I create a JavaBean
to
> do
> this?  It is my understanding that you can't create a function in a
JSP
> page...am I incorrect in that?  Any pointers on how to handle this
would
> be
> appreciated.  Thanks,
> Kenny
>
>
========================================================================
==
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-
> INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to