I need to define variables and functions in one javascript file, and than
include this file into another javascript file and use them. Is that
possible (even if is needed to use java interface)?
Thank you a lot.
Ivana
What I do is combine Rhino with Velocity. So a get a script and use
Velocity like a pre-processor.
So I have code like this:
// Some script.
var hello = 10;
#include("/common/StringUtil.js")
The #include is a velocity macro which inserts the other js file into
the current one. Usually I would place these at the bottom of the js file.
If you haven't used Velocity there is good documentation here:
http://velocity.apache.org/
> Hi,
>
> I need to define variables and functions in one javascript file, and than
> include this file into another javascript file and use them. Is that
> possible (even if is needed to use java interface)?
>
I use an approach similar to Dan's however I'd like to replace it with
"require". There's been some work done here to support the "require()"
function, I don't know much of the details, maybe someone else here can
cover it.
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
http://www.opentempo.com
mailto:daryl....@opentempo.com
Note: Rhino's CommonJS support is only implemented in CVS right now,
so you'll need to build from CVS. if you are feeling lazy you can grab
my js.jar build from [3].
[1]:http://www.mynajs.org
[2]:http://code.google.com/p/myna/source/browse/trunk/1.0/web/shared/
js/libOO/CommonJS.sjs?spec=svn109&r=109
[3]:http://myna.googlecode.com/svn-history/r109/trunk/1.0/jars/js.jar
----------------------------------------------------------
Mark Porter
Myna JavaScript Application Server
Easy server-side JS on a Java platform
http://www.mynajs.org
On May 24, 6:18 am, Daryl Stultz <da...@6degrees.com> wrote:
> mailto:daryl.stu...@opentempo.com