1

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?

1
  • 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. Commented Feb 27, 2016 at 22:10

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

"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.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.