Hi I have ServletA, which has html table output. For each row I have a form element created and at the end of each form I have a submit button. When the user submit, that particular row of data has to be sent to another servlet B. Please Suggest how do I do it? Thanks
Tony Alicea
Desperado
Sheriff
Joined: Jan 30, 2000
Posts: 3219
posted
0
I have no answer to your question. Only more questions WHY oh why are you having servlets generate HTML output? I know this is chapter one of servlets books; how we can do CGI in Java What Sun suggests for an effective presentation of a Web application, is that you delegate presentation to JSP pages and have Java servlets prep those JSPs with the appropriate beans (objects) that those JSPs will need to render the appropriate UI... It was called "Model 2" architecture in the "old" servlet days
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
Not all of us are as deeply in love with JSP as the Sun marketing team. There are huge holes in JSP. Debugging is a huge pain. And it does not solve the issue of separation of HTML from code. A well designed HTML templating scheme is 1000X better than the JSP hack as far as I am concerned.
As to Jairat's question, simply create a form pointing to the servlet you wish to execute.
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
And Jairat, I must ask you again to change your registration to a first and last name format. If you don't, the owners of this web site will revoke your registration. Please look at this: http://www.javaranch.com/ubb/Forum10/HTML/000180.html
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
I can see a few ways of doing what you require (separate "submit" buttons for each line of a table). 1. Use a separate form for each line of the table. This works well if you don't also need any operations on all the lines at once. You can send the data to the same servlet, but put the row number in a hidden field:
2. Take advantage of the form behaviour with submit buttons. Only the button clicked is sent to the server with the form, all other buttons are ignored, so you can name the button in a unique way:
I'm sure there are other ways, but these two should do for the moment.