File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaScript varialble in a Servlet

 
Madhav T Murthy
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing an JSP application where, i would like to use a JavaScript variable in the Java servlet Code. Please tell me how do i do it?
 
Thomas Goorden
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the way I understand it, you can't do this directly:
the javascript is executed in the client's browser, *after* your jsp page has already done it's thing.
Therefor, the JSP page needs to be executed again.
The way I'd do it is to let let the javascript address the same page with your needed value as a GET or POST parameter.
Hope this solves it.
 
Madhav T Murthy
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for answering my query Mr Thomas.
But could please clear my doubt with an example ??
I just got the idea what should be done..but please give an example.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic