• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

call java function from onclick

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic