File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes How to access javascript variable inside scriptlet in a jsp file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to access javascript variable inside scriptlet in a jsp file?" Watch "How to access javascript variable inside scriptlet in a jsp file?" New topic
Author

How to access javascript variable inside scriptlet in a jsp file?

Jessica James
Ranch Hand

Joined: Jan 23, 2007
Posts: 69
Hi folks,

I want to access a javascript variable inside scriptlet block in a jsp file..

If you have answer plese clear my doubt..

Thanks in advance..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41574
    
  54
That's not possible. JSP scriptlets are executed on the server, while JavaScript is executed in the browser (i.e., on the client), at which point JSP has long since finished its job. What are you trying to accomplish?


Ping & DNS - my free Android networking tools app
Jessica James
Ranch Hand

Joined: Jan 23, 2007
Posts: 69
ok.. Thanks..
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

I would like share this thread with you.

where we discuss the same topic. It could more help you on others seniors views.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Jessica James
Ranch Hand

Joined: Jan 23, 2007
Posts: 69
Can I get one of the form parameter value inside a JSP file?
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Originally posted by Jessica James:
Can I get one of the form parameter value inside a JSP file?


didn't get what you have mean by form parameters?

assume that you are asking about getting a record from all elements inside the form.

if it is then the answer is Yes,

Just define you JSP file (path) inside the form action attribute.
When the form is submitted, the specified name and value are included in the GET or POST data, Then you can use request.getParameter() method in your jsp to retrieve these value by the name of elements.

hope it helps.
[ April 16, 2007: Message edited by: Saif uddin ]
 
Don't get me started about those stupid light bulbs.
 
subject: How to access javascript variable inside scriptlet in a jsp file?