What you're proposing would appear to require that the browser's javascript interpreter be aware of/have access to what I assume is a server-side java entity. This may be possible, but I'm not aware of anything inherent that'll let you do this.
I realize it's not ideal, but you might consider file-scoped javascript variables (can you create a constant in javascript?), or creating your own javascript 'object' containing these strings. -----Original Message----- From: Jason Kilgrow [mailto:[EMAIL PROTECTED]] Sent: Monday, May 13, 2002 2:00 PM To: JDJList Subject: [jdjlist] RE: Static class variables in Javascript 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 onLoad="doSomething(<%objRef.getWhateverProperty()%>)"> > > 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
