The form is generated by a servlet. What I want to do now is that when user selects one of the options, a request is sent to the server and another servlet would take care of filling the text field and send the form back to user.
Also, notice that I have two buttons down there and how would the servlet know which button is clicked?
What about having a single controller, a servlet, and let the controller delegates the task, either update or create, to a model.
Joined: Feb 22, 2005
Sorry I had two questions posted in my first post. One is how do I post data by slecting a item in the drop down list. A form has attribute called "action", how about "select"? Two is what Joe responded to. And how, then would the single controller know which button the user clicked? I mean, in a regular java app, we can always associate a action command with buttons. what about in servlet? Would you be more specific, Joe?
Yes, it's best not to ask multiple questions in one post. One or the other can get lost in the shuffle, and it makes reading through any replies confusing.
To the second, you can assign a request parameter that is unique to each button to be able to distinguish which was pressed. Or better yet, if the buttons trigger different actions, they should submit themselves to different controller servlets.