tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Cronin <tcro...@AUSTIN.CollegeClub.com>
Subject RE: want to preporcess javascript files
Date Thu, 28 Dec 2000 17:04:02 GMT
Thanks for all the input.

Solution:

in the javascript file (call it javascript.jsp)

<% response.setContentType("text/javascript"); %>

mark all comment blocks with

<%--
comment .....
--%>

you can include the javascript jsp file like a normal script file.

<script language="javascript" src="javascript.jsp"></script>

the only thing better than a solution is
a one line solution!

-----Original Message-----
From: Randy Layman [mailto:randy.layman@aswethink.com]
Sent: Thursday, December 28, 2000 9:09 AM
To: 'tcronin@AUSTIN.CollegeClub.com'
Subject: RE: want to preporcess javascript files



	What is the content-type you are returning from your JSP containing
JS file?  I believe that Netscape is expecting text/plain or text/javascript
and might not like a text/html when its not expecting it.  Also, are you
specifying the language in the <SCRIPT LANGUAGE= part of your html?  There
are problems in both IE and Netscape where they try to determine type by
file extension (I know this in regards to images and some other servlet
problems we've had, never experienced it in this situation).


> -----Original Message-----
> From: Tim Cronin [mailto:tcronin@AUSTIN.CollegeClub.com] 
> Sent: Thursday, December 28, 2000 10:28 AM
> To: 'tomcat-user@jakarta.apache.org'
> 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:Boazs@farechase.com]
> Sent: Thursday, December 28, 2000 3:17 AM
> To: 'tomcat-user@jakarta.apache.org'
> 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:tcronin@AUSTIN.CollegeClub.com]
> Sent: Wednesday, December 27, 2000 23:17
> To: 'tomcat-user@jakarta.apache.org'
> 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?
> 

Mime
View raw message