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

call java function from onclick

 
Krishna MK
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Can you please tell me how to call a java function from an onclick.Syntax or sample code is appreciated.

I have an HREF in my jsp it redirects the page i want to do some more stuff in server side along with the redirect.thats the reason to call a java function (java function is in JSP).

Regards
KG
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"KG MK " please check your private messages for an important administrative matter. You can see them by clicking the My Private Messages link above.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an HREF in my jsp it redirects the page i want to do some more stuff in server side along with the redirect.

I am not getting what you are trying to do exactly. Can you please elaborate .

And welcome to Javaranch
 
Krishna MK
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

thanks for the reply

a href ="check" onclick???

public void fun()
{
}

I would like to call this function fun() from onclick .(fun() not being a javascript function ) could you please let me know hoe to make this call

Regards
Krishna
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Krishna MK:
fun() not being a javascript function


directly you can not . i guess ajax may help you
 
Krishna MK
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Could you let me know the other ways through which i can achieve this?

Regards
Krishna
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krishna MK check your private messages again.
And I would like to know what you want to achieve by writing such code, maybe there's another better workaround.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
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 why what you are asking is impossible.

You will need to submit to the server, or use Ajax or an Ajax library.

And pay heed to Amit's messages. Before you post again.
[ December 05, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic