In the following example, first. jsp sends an Ajax request with parameters (2) to invoke. jsp, and then invoke. jsp calls JavaProgramEv --- getsuggestions () method, instantiate EV parameter 3, sugg = eV (3), call program parameters with first. JSP 2: Sugg. getsuggestions (2). The result is finally returned to first. JSP and displays.
========================================================== =
First. jsp
-----------------------------------------------------------------------
Ttp: // www.w3.org/tr/html4/loose.dtd ""> http://www.w3.org/TR/html4/loose.dtd ">
========================================================== ==================================
Invoke. jsp
Bytes ------------------------------------------------------------------------------------
Br/> http://www.w3.org/TR/html4/loose.dtd>
========================================================== ======================================
App. Ev. Java
------------------------------------------------
Package app;
Public class ev {
Private int lev;
Public String getsuggestions (INT reqint ){
Int result = reqint + lev;
Return string. valueof (result) lbloutput;
}
Public eV (INT eV ){
This. lev= lev;
}
}