-4

I want to send table data from jsp to servlet.

Example the table structure is like

column1   column2 
First     Name 
Second    Name1

When i click on submit how can i retrieve or get the data in < td> tags First,Second, Name and Name1 values in servlet.

I searched but couldn't find any proper solution.

I want to know in how many ways i can achieve this. I searched about this and found we can achieve this using request.getParameter() or JSTL but didn't got any clear description

Please Suggest

  • refer this: http://stackoverflow.com/questions/4971877/how-to-transfer-data-from-jsp-to-servlet – Jayesh Aug 12 '13 at 06:43
  • @Jayesh -- I have already seen the post but couldn't find the solution. i am asking how to get data inside tags from the table in servler. – Coder Knowledge Aug 12 '13 at 08:29

1 Answers1

0

You need to create a hidden input type and assign the value of td tag to it and access its value in servlet using request.getparameter("hiddenInputName") e.g.

<td>someData</td><input type = "hidden" name = "someName" value = "someData">

Then after submitting form using post method you can access the value in servlet as

request.getParameter("someName");
Prasad Kharkar
  • 13,410
  • 5
  • 37
  • 56
  • Thank you. Is there any other way where we can do without writing hidden type. because if the table content is more then giving hidden name to all the td tags would be tedious – Coder Knowledge Aug 12 '13 at 15:12