Bookmark Topic Watch Topic
  • New Topic

invoke java method from java script function

 
Gauravu Arorau
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
Is there any way to call a java method from java script funtions on the basis of some condition?

Thanks
Gaurav
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Gauravu,
This question is close enough to:
http://www.coderanch.com/t/291249/JSP/java/Conditional-script-let-tag-java
that I think it would be better to continue the discussion there.

The answer is the same as the ones given there.
Javascript is interpreted on the client's machine, in a browser.
JSP is interpreted on the server and is, in effect, done and finished before the Javascript even starts.
For this reason, there is no way to conditionally execute JSP code based on branches in your Javascript.

One workaround to this is AJAX but I wouldn't recommend tinkering with AJAX until you have a firm grip on HTTP; at least as far as understanding what happens on the server and what happens on the client.

If you have any further questions, ask in your other thread.

-Ben
[ January 10, 2007: Message edited by: Ben Souther ]
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!