O'Keeffe Patrick wrote:
>
> Hello,
>
> I have a file which contains loads of definitions (static final x, static final
> y, ....).
>
> I need these definitions to be available to a JSP and to some helper classes
> which the JSP imports, but I only want to define them in one place. Any ideas on
> how to do this??

Just create a separate class with all your constants, e.g. my.package.Constants,
and import it in all your JSPs and helper classes, i.e.

  <%@ page import="my.package.*" %>

and

  import my.package.*:
  public class MyClass { ...

Or you can just use the fully qualified names in both the JSPs and helper
classes:

  if (foo == my.package.x) { ...

No matter what, make sure the class is in the classpath used by the JSP engine.

--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to