I'm not sure if I know exactly what you're after here, but I'll throw a
couple of thoughts out there.  It sounds like you want to use JSP pages to
keep all your JavaScript code so that you don't have to send comments to the
client.  I haven't tried this, but I'm thinking something like this should
work...

functions.jsp:
(JavaScript functions with comments)
you could try putting comments in
<%-- comment --%>
or in
<% /* comment */ %>
jsp comments so they aren't output to the client.

webpage.jsp:
wherever you want your JavaScript functions inserted, you could try
<jsp:include page="functions.jsp" flush="true"/>

Is this the general idea?  Are you saying you've already tried something like
this and it doesn't work?  Am I just way off the mark?

Hope this helps,
-Jeff





[EMAIL PROTECTED] on 12/28/2000 09:27:30 AM
Please respond to [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
cc:
Subject: RE: want to preporcess javascript files

>- I dont see why a js file won't be handled like a jsp regarding source
>control and revision history.

this is not a problem. It is handled by source control, But I don't want
to send revision history and code documentation to client machines.

>- It costs you in performance to use js in jsp - you make the Tomcat
>generate them again and again for each request. I guess that the js code is
>quite static and not changed between requests, so that generation is
>unnecessary.

if I have it as the src attribute in the script tag it will only be
downloaded once
to each client, and if I cache the jsp page it will be resident in memory
intead of reading it from disk before sending it down.

>- I have a js file whose code depends on some other java classes. I have
>made in java a sort of preprocessor that create it whenever a new version
is
>required.

The Jakarta team has done a great job at writing a preprocessor which I
don't
want or have the time to do.

So back to my origonal question does anyone know how I could do this without
telling me why I should not.


-----Original Message-----
From: Boaz Shaham [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 28, 2000 3:17 AM
To: '[EMAIL PROTECTED]'
Subject: RE: want to preporcess javascript files


I had that problem too. Some notes:

- I dont see why a js file won't be handled like a jsp regarding source
control and revision history.

- It costs you in performance to use js in jsp - you make the Tomcat
generate them again and again for each request. I guess that the js code is
quite static and not changed between requests, so that generation is
unnecessary.

- I have a js file whose code depends on some other java classes. I have
made in java a sort of preprocessor that create it whenever a new version is
required.

If you still want to use it as jsp - try add to these files a header
indicating the mime type for js code (dont know what it is)


- Boaz

-----Original Message-----
From: Tim Cronin [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 27, 2000 23:17
To: '[EMAIL PROTECTED]'
Cc: Paul Lange; Frank Livaudais; Rex Staples
Subject: want to preporcess javascript files


I was initially using jsp files to contain javascript. This way I could
have them documented and keep revision history in them for development
then have the commenst stripped out when they were deployed to clients.

This works fine in IE. but causes Netscape to hang. I tryed to change
them back to js and add a handler to preprocess these files as well
but could not get it to work.

Any solutions?



Reply via email to