How to call a servlet, and work with vaadin and servlet

Hi, I have some basic doubts, I wanna know how can I call a servlet when I click in a button and if somebody have some material that explain how can I develop an app using vaadin and servlet.

If there´s some mistakes in my english I apologize, english it´s not my native language

Hi and welcome!

What do you mean exactly with “I wanna know how can I call a servlet when I click in a button”? Do you have a Vaadin application and a separate servlet application, and you want to call the other application through a click of a button?

Please explain with a little more words exactly what you try to do, and don’t worry about your English. It is perfectly fine. :slight_smile:

Thank you Jens Jansson, I will try to give more details

In a regular web app we add a form tag, in this tag we had the action attribute and the value of this attribute it´s the name of the servlet. When the submit button it´s clicked a request it´s send to the servlet and then we do what we wanna do with the data.

Now, in my currently situation, I had a vaadin aplication and I wanna send a HttpRequest to the servlet when I click the button. I´m question this cuz the next thing that I want to study it´s vaadin with mysql.

If there´s a better way to this using vaadin please tell me…

Hmm I think you are thinking in a too standard java servlet, http and html way. Vaadin abstracts everything like that away. When you develop a Vaadin application, all you need to do is to add a Button to your application, and attach a ClickListener to it, and Vaadin will take care of the rest. When the user clicks on the button in the browser, the ClickListener gets called on the server side. No need to handle HttpRequests. Same goes for Textfields, ComboBoxes, and all the other fields.

thank you for the explanation Jens Jansson, I try to do some simple data insert into a database following this ideia but I´m not getting any error, but doens´t insert into the database, I create a post in the data bindings area about this problem that I´m having.