----- Original Message ----- 
Frank, I can think of conventional techniques:

1) add new Javascript section:

<script language="javascript" src="/servlet/generatearray"></script>

generatearray.class must produce MIME type for Javascript.

2) if the main file is HTML, try to use SHTML:

<script language="javascript">
<!--#include virtual="/servlet/generatearraydefinition" -->
for(var k=0;k<title.length;++k) document.write("<p>"+title[k]);
</script>

actual syntax of the include depends on your webserver.

and so on...




From: "Frank Morton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 13, 2001 12:25 AM
Subject: Stuck Combining Servlets and JavaScript


> I have a servlet that can generate JavaScript arrays. I want to
> combine those arrays with html/javascript for final presentation.
> One of the catches is that the servlet uses an HttpSession to
> keep track of what has happened.
> 
> So, say I have an html file containing this (less headers):
> 
> <script language="javascript">
> booktitle = new Array("title1","title2","title3","title4");
> for(var k=0;k<title.length;++k) document.write("<p>"+title[k]);
> </script>
> 
> So, I want the servlet to generate the second line of the script.





> 
> Frank
> 


Oleg L. Sverdlov
Web Development Dept.

Netmount Networks 
Raanana, Israel. 

http://www.netmount.com
Phone: +972-9-745-5220
Fax: +972-9-745-2521

Reply via email to