> 1) I would like to populate an array stored on the client with data from a
bean.
> Is there any way call a getXXX() method within a JavaScript function, or
do I
> have to pass the result of the getXXX() method as a parameter to the
JavaScript
> function?
What do you mean? To fetch data from a jsp, a client have to estabilish an
HTTP connection to the server.
I use the following framework (based on LiveConnect) to manage interaction
between client javascript and server jsp:
1) I have an applet that is able to do HTTP connections with the server
2) my jsp serves javascript code that is eval'd by the client.
Example:
CLIENT CODE
-------------
var client = applets[0]; // my applet that manages http connections
var x = new Array(); // array to be initalized
var response = client.get('host/initialize.jsp'); // fetch initialization
code
eval(response); // evaluates the code
alert(x[0] + " " + x[1]);
SERVER CODE (initialize.jsp)
---------------------------
x[0] = "this is a trivial";
x[1] = "array initialization";
>Also, is there any way of getting at session variables within
> JavaScript?
1) write the sessionid in a hidden field of your page and then access it
from javascript
or,
2) make your js file a jsp and assign a javascript variabile, i.e.
var sessionid = '<%= session.getId() %>';
Hope this helps,
Iac
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html