Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling a java function from javascript?  RSS feed

 
Karl Beowulph
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy all.

First, apologies if this is in the wrong form, but it seemed like the right place.

Can I build functions in my .jsp java code and then call them from within my javascript?

If not, is it possible for me to call them directly from a forms "onklick =" attribute?

I'm not sure if this changes things, but I'm using Struts.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cannot happen. All of the code in a JSP executes on the server to format a "normal" HTML/Javascript page to the client. Once sent, the client has no access to anything back on the server except via the normal request/response cycle.
 
Joe McIntyre
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not build javascript functions on the server using java in a jsp? That's what I usually do.
[ June 08, 2004: Message edited by: Wally Flint ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is it that you are trying to do that requires a call to server-side code?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!