Home arrow static arrow Java Programming [Archive] - Calling JSP function using "onclick" in Javascript?
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Calling JSP function using "onclick" in Javascript?
This topic has 2 replies on 1 page.

Posts:12
Registered: 7/18/04
Calling JSP function using "onclick" in Javascript?  
Jul 18, 2004 8:49 PM



 
Hi all... i'm new here... hope to get some help here... anyway, here is the situation... i need to set some session attributes when some links are clicked... however the problem is that can i call a jsp function using the html onclick function?
is there any way do so?

E.g.
<a onclick=' ABC(); '>
can i call this method ABC(); which is declared in JSP ?
 

Posts:2,830
Registered: 9/1/03
Re: Calling JSP function using "onclick" in Javascript?  
Jul 18, 2004 9:00 PM (reply 1 of 2)



 
E.g.
<a onclick=' ABC(); '>
can i call this method ABC(); which is declared in JSP
?

No.

What you can do is have the javascript hit a page with some
paramater specified (i.e. mypage.jsp?action=doit) and then in
the doPost or doGet method you can then get out the 'action' param,
and consider it appropriately.
 

Posts:12
Registered: 7/18/04
Re: Calling JSP function using "onclick" in Javascript?  
Jul 18, 2004 10:06 PM (reply 2 of 2)



 
thx for the advice... erm... but i think i'm in a more tricky situation... coz the page is to be included as a page directive so i wish that the page is not to be linked to another... but really... thx alot!!! thank u...
 
This topic has 2 replies on 1 page.