On 6/11/06, Ronald Traikovich <[EMAIL PROTECTED]> wrote:
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

ad 1) who said that the javascript file should have the extension .js?
the content-type text/javascript should be sufficent for the browser
to recognize it as javascript even if its a foo.jsp file.

or, if you want to have the js extension define an action foo.js and
map it to the action/jsp combination which produces your javascript.

regards
Leon

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




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to