Hi,
I'm new to JSP. I want a sample code to call a java class on button click in jsp.

Recommended Answers

That you want in the way you want it cannot be done.
If you want to call a java method, after the page has rendered, by clicking a button you need to submit the form, to a servlet or jsp (preferably a servlet) and there you can call your java …

Jump to Post

All 3 Replies

That you want in the way you want it cannot be done.
If you want to call a java method, after the page has rendered, by clicking a button you need to submit the form, to a servlet or jsp (preferably a servlet) and there you can call your java method. Then you must redirect to whatever page you want with the results.

Check the first Read Me post of the jsp forum about MVC:

"JSP database connectivity according to Model View Controller (MVC) Model 2"

Thanks.

Issue solved now.

How do you solve the issue. Kindly reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.