These technologies do not interact in the manner described.
JSPs are processed by the web server & supply pure HTML responses for the
browser to process. Javascript, however, is processed solely by the browser
within the context of the web page. Therefore, Javascript cannot invoke JSP
methods. Although JSP can alter the Javascript supplied, it does not invoke
that script either.
You need to reanalyze your design & determine where the processing needs to
occur. Client-side processing belongs in Javascript, while server-side
processing belongs in JSP.
-----Original Message-----
From: Shannon Moschetti
To: [EMAIL PROTECTED]
Sent: 2/28/00 12:27 AM
Subject: Calling java code from javascript function
Forgive me if this has been covered recently; I just joined this list...
I'd like to know how I would go about calling a java method defined in
my JSP page from a javascript function defined on the same page. For
example, how whould I call the showProduct() java method from the
callJava() javascript function...
<%!
void showProduct(){
int val = 2 * 2;
out.println("Product: " + Integer.toString(val));
}
%>
function callJava(){
// I'm not very familiar with server side javascripting(ssjs), but
I'm guessing that if what
// I want to do can be done, I'd have to use ssjs, in which case,
does anyone know of
// a site that has some helpful info about ssjs?
}
========================================================================
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets