aspose file tools*
The moose likes Servlets and the fly likes Using javascript in a scriptlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using javascript in a scriptlet" Watch "Using javascript in a scriptlet" New topic
Author

Using javascript in a scriptlet

Ravissant Markandey
Ranch Hand

Joined: Oct 24, 2007
Posts: 41
Hi Everyone,

Can anyone please tell me how i can use a javascript variable in a scriplet? Heres what i want to do :


so, instead of the '107' i want to put a javascript variable, like :



Please note the above DOESNT work, how do i do it??


Regards,
RAvissant
Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
Hi,

As far as I know, this would not work. I have this feeling as javascript actually runs at your client machine and servlet on your server. So servlet can't really access any variable declared under client side script. I may be completely wrong here and would love to know the facts here.


Thanks & Regards, SK
SCJP 5.0, DB2 - 800, DB2 - 803, SCDJWS (On the way)
Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
I googled on this topic and found the very first link

Passing Javascript variable to servlet.

Check that.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Please read this article. It's about JSP, but the same applies to servlets.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
raj malhotra
Ranch Hand

Joined: Feb 22, 2007
Posts: 285
Just to add the above comments.
You know we can write java code in the scriptlet.And in java code we can write Html code.And in html code we can write javascript......
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61657
    
  67

Originally posted by raj malhotra:
Just to add the above comments.
You know we can write java code in the scriptlet.And in java code we can write Html code.And in html code we can write javascript......
Which has nothing at all to do with the original question. It still does not allow client-side values to be available in a non-causal fashion to code executing on the server long before the page is even sent to the browser.
raj malhotra
Ranch Hand

Joined: Feb 22, 2007
Posts: 285
Thanks Mr Bear Bibeault for correcting me
Ravissant Markandey
Ranch Hand

Joined: Oct 24, 2007
Posts: 41
Thanks Ravi, Raj and Bear
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using javascript in a scriptlet