I am new to building dynamic web project. I have javascript as my front end. My query is how do i retrieve something from the database by clicking a button in the front end? How is javascript connected to servlet class to trigger an event in the backend?
-
The most common options are to trigger a traditional form submit and get a new page back, or make an Ajax request and update some part(s) of the current page with the result. Both options are http requests.nnnnnn– nnnnnn2016-02-27 22:10:43 +00:00Commented Feb 27, 2016 at 22:10
Add a comment
|
1 Answer
If you are using servlet then you can use jsp (front end) as well to connect to your servlet, in jsp you need to write javascript code in <head> tag or by creating separate .js file then with help of button onclick function you will connect to your servlet by posting form
Please read this
1 Comment
nnnnnn
"you need to use jsp" - You don't "need" to, there are other options. (Not that I'm saying jsp is a bad plan, just that it's not the only plan.)