Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jessica James
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jessica James
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok.. Thanks..
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like share this thread with you.

where we discuss the same topic. It could more help you on others seniors views.
 
Jessica James
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I get one of the form parameter value inside a JSP file?
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic