Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling java method defined in jsp  RSS feed

 
Nidheesh Krishna
Ranch Hand
Posts: 60
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to call a java method defined in jsp inside a javascript method defined in same jsp page?
 
Tim Moores
Saloon Keeper
Posts: 3564
77
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, you should not define methods in JSPs - they are meant as a view template, not for any kind of serious processing. If you need some custom processing, use a tag file.

Secondly, JavaScript and JSP are entirely separate: the former is executed on the client, while the latter is executed on the server - and never the twain shall meet :-)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65898
135
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this article to understand how JSP operates and why what you are asking makes little sense.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!