You can do this by turning your html file into a JSP.  That is if you have a JSP Engine, like Jasper.

Make my.js now be my.jsp

<%@ page import="com.your_company.Finals" %>
    .
    .
    .
    if (formAction == Finals.REFRESH)
    .
    .
    .
    else if (formAction == Finals.RESET)
    .
    .
    .
I'm not sure if you can do this or not?
<script  type="text/javascript" language="javascript" src=""my.jsp"></script>"

In your main file, if you have one, you could do this:

<jsp:include  page="Relative URL/my.jsp" />

This will include the javascript in your html file, you have to make it a jsp file too though.

--ekiM



On Mon, 2002-05-13 at 13:59, Jason Kilgrow wrote:
Let me get a bit more specific.
I have a class called Finals.class that has the following:

public static final String REFRESH = "refresh";
public static final String RESET = "reset";

etc...

In my javascript file (let's call it my.js) I have a number of
functions. One of these functions is called
"handleSubmit(formAction)" where formAction is a string.

function void handleSubmit(formAction)
{
    if (formAction == "refresh")
    {
        // do the refresh stuff
    }
    else if (formAction == "reset")
    {
        // do the reset stuff
    }
}

What I want to do is this:
    .
    .
    .
    if (formAction == Finals.REFRESH)
    .
    .
    .
    else if (formAction == Finals.RESET)
    .
    .
    .

Any suggestions? In the meantime, I'll take a look at Liveconnect.
I've heard of it but I'm skeptical that it'll do what I want.

--- "Cote, Robert" <[EMAIL PROTECTED]> wrote:
> Not knowing your specific requirements, I do a fair bit of the
> following in
> my JSPs (intranet application):
> 
> <body >
> 
> Netscape defined LiveConnect (at least in js 1.3 spec) for
> communication
> between js and java -- I haven't worked with it, and I'd bet
> against
> internet explorer support.
> 
> -----Original Message-----
> From: Jason Kilgrow [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 13, 2002 11:50 AM
> To: JDJList
> Subject: [jdjlist] Static class variables in Javascript
> 
> 
> Does anyone know if it's possible to access static final class
> properties from Javascript? If it is possible, how is it done?
> 
> __________________________________________________
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
> 
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm
> 
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm


__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

    
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to