> > You're missing the point. I can't use a constant. I need to pass a
> > variable into Java.
[quoted text clipped - 7 lines]
> for you to use XMLHttpRequest to send the data and use something like
> request.getParameter() in your JSP.
Hi,
> I've come accross your point about javascript being on the client and
> java on the server. BUT, the client side javascript function IS able to
> pass a constant as a parameter to the server side java.
No, it's not. In your quoted example here under, the "constant" is a
Java string. The scope of everything which is executed between <% ... %>
is the server, and it's Java.
<% testClass.set("iiiiiiiiii") ; %>
"iiiiiiiiiii" is a Java string.
<snip>
HTH,
Laurent

Signature
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
> I've come accross your point about javascript being on the client and
> java on the server. BUT, the client side javascript function IS able to
[quoted text clipped - 4 lines]
> functionality is there maybe javascript should be standardized to allow
> some way to pass a variable.
Your missing something very key here, that is javascript cannot access
java.
What is can access are the RESULTS of that java method. You see by the
time javascript is running, the JSP has already rendered itself to HTML
output and is done.
> Thanks, I think i'll have to look into XMLHttpRequest.
Using this you can pass a javascript variable to serverside process. If
this results in changes on the page, you'll have to either reload the
page or execute the changes yourself in javascript.
> Also, how can I use a image preload get to transmit a string to the
> server, i've heard this is possible.
By using a server side process (like a servlet) to provide the image
data, and appending a query string to the img src parameter. The server
side process will receive the request (headers, parameters and all) and
can process it before transmitting image data back (or it may not
actually send anything back...)
HTH.
> Thanks,
misdst23 - 31 Aug 2006 14:31 GMT
ok. So you're saying that the java within the javascript is actually
executed BEFORE the javascript executes ?
> By using a server side process (like a servlet) to provide the image
> data, and appending a query string to the img src parameter. The server
> side process will receive the request (headers, parameters and all) and
> can process it before transmitting image data back (or it may not
> actually send anything back...)
So I have to have a seperate servlet or something that handles the
request on the server ? It can't be part of the same jsp.
Do you have any example code on this ?
> > I've come accross your point about javascript being on the client and
> > java on the server. BUT, the client side javascript function IS able to
[quoted text clipped - 23 lines]
>
> > Thanks,
Tom Cole - 31 Aug 2006 15:59 GMT
> ok. So you're saying that the java within the javascript is actually
> executed BEFORE the javascript executes ?
Yes. The javascript only sees the output resulting from the java
method.
> > By using a server side process (like a servlet) to provide the image
> > data, and appending a query string to the img src parameter. The server
[quoted text clipped - 4 lines]
> So I have to have a seperate servlet or something that handles the
> request on the server ? It can't be part of the same jsp.
You will need something Java on the server side that can get your value
to your already executing javascript. I would recommend not using the
image loading idea, but rather use an XmHttpRequest to send a response
to and read the response from a servlet. Then use javascript to update
the page.
> Do you have any example code on this ?
There are many examples/tutorials on using XmlHttpRequest.
> > > I've come accross your point about javascript being on the client and
> > > java on the server. BUT, the client side javascript function IS able to
[quoted text clipped - 23 lines]
> >
> > > Thanks,