There was a long discussion on this a while ago in this list which went into some detail about this whole issue. In fact, reviewing it, you were involved in the discussion! Basically, your JavaScript has to go, in source form, to the browser (i.e. the client) because it is a client-side interpreted language. There is absolutely no way you can prevent someone with a little guile from reading your JavaScript -- you can make it harder by using <script src="whatever.js"></script> tags etc., but the script is still sent to the client. You can look for an obfuscator to make it harder for people to understand the code, but it'll still be there. You can't use JavaScript on the server side to execute any form of dynamic client side activity. Period.
-----Original Message----- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Miao, Franco CAWS:EX Sent: Wednesday, November 14, 2001 11:13 AM To: [EMAIL PROTECTED] Subject: Re: how to embed Javascript in Jsp? but then I can not hide the Javascript file, I saw a website has floating object, I knew it is running Javascript, but can see it in "Soure" menul in brower, but <frame........ somthing>, just wondering how this web guy hide the javascript. I guess this guy program javascript run at server side. Franco -----Original Message----- From: Noble Long [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 14, 2001 10:36 AM To: [EMAIL PROTECTED] Subject: Re: how to embed Javascript in Jsp? Don't put it inside the JSP tags <% and %> put it inside <SCRIPT> or html tags and surround those with your JSP statements in there own tags - example: (snip) } catch(SQLException sqle){} } %> <SCRIPT SRC='OODAClient.js'></SCRIPT> <html> <head> <link REL="stylesheet" HREF="../Common/styles.css" TYPE="text/css"> <SCRIPT LANGUAGE="JavaScript1.2" SRC="../Common/OODAClient.js"></SCRIPT> <title>Item Lookup</title> <style type="text/css"> <!-- a:link { color: #FFFFFF; font-size: 11px; font-weight: bold; font-family: Arial; text-decoration: none} a:visited { font-family: Arial; font-size: 11px; font-weight: bold; color: #FFFFFF; text-decoration: none} a:hover { font-family: Arial; font-size: 11px; font-weight: bold; color: #FF0033; text-decoration: none} .selectitems { font-size: 11px; color: #000000; font-weight: normal} .pick { font-family: "Times New Roman", Times, serif; font-size: 8pt; color: #000000} .links { color: #0000FF; font-size: 8pt; font-weight: normal; font-family: "Times New Roman", Times, serif} --> </style> </head> <body bgcolor="#FFFFFF"> <script language=JavaScript> function doRefresh(theFilter) { var QS; QS = "ItemsGrid.jsp?ActiveOnly=" + document.cbform.cbUseActive.checked + "&filter=" + theFilter; self.location=QS; } </script> <p align="left"> <% if(bCustomerCheck) { %> <blockquote> (snip ----- Original Message ----- From: "Miao, Franco CAWS:EX" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 13, 2001 9:58 PM Subject: how to embed Javascript in Jsp? > Basically I would like to put javascript file .js inside <% %>, > just don't know the syntax. thanks! > > > Franco > > =========================================================================== > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". > Some relevant FAQs on JSP/Servlets can be found at: > > http://archives.java.sun.com/jsp-interest.html > http://java.sun.com/products/jsp/faq.html > http://www.esperanto.org.nz/jsp/jspfaq.jsp > http://www.jguru.com/faq/index.jsp > http://www.jspinsider.com > =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com