Hello Ronald,
when I must use variable comming from Server Side like Web Application
context.
I create a javascript variable which I initialize in my JSP and after in my
Jsvacript
I use this variable.
For instance, in my JSP
<script>
var webApplicationContext = '<html:page src="/" />';
</script>

And afer in my function Javascript, I can use it :

function displayWebApplicationContext() {
  alert(webApplicationContext);
}

Regards Angelo



2006/6/11, Ronald Traikovich <[EMAIL PROTECTED]>:

Hi group,
I was given a javascript file called operations.js that handles
javascript events that load images. So this javascript file is included
in my jsp page. The problem is that the image paths are hardcoded, so I
want to rewrite these paths with some struts tags. So for example
<html:page src="/image/myimage"/>.  instead of just a var
pathToImage="/image/myimage"; which is what they all are now.

The problem I hit is that I can't include any struts html tags in a
javascript file or maybe I just don't know how to do it? I figure there
are two solutions.
1) take these .js files and turn them into .jsp files and include the
javascript in the <script> tags or
2) create functions that take parms for the correct path from the
caller(which is a jsp file).

I think #1 is the best solution, but I wanted to ask the group to make
sure there isn't an easier solution.


Thanks a lot
Ron



Reply via email to