1

I have a form whose value get stored in the database on click of submit button.

Also there are 4 fields whose data is to be displayed into the struts2-jquery-grid. I first used a temporary table to save values and display those values in the grid. But this approach isn't correct as the values remain in the table even if the user doesn't click on submit.

So is there a way to temporary store the data of 4 fields into the array and display in the grid and then when user submits the data the values from the array(grid) are stored into the database.

Roman C
  • 49,761
  • 33
  • 66
  • 176
Pradnya
  • 649
  • 2
  • 6
  • 17

1 Answers1

1

Temporary table is not solution as you have mentioned in the post, but you can use a session map to save your array before you display it in the grid. When you submit a form the values from the session could be retrieved back to the action and a session map could be cleared. To use a session map with the action you should implement SessionAware or get the session from the action context. See this answer for using a session in JSP.

Community
  • 1
  • 1
Roman C
  • 49,761
  • 33
  • 66
  • 176
  • thank u for the reply. But I did not quiet understand implementation of sessionware in my grid. I have 4 columns in the grid for name , age , address & attachments. And there can be multiple rows in the grid. How do i put values in session & retrieve back into the grid. – Pradnya Jul 19 '14 at 08:43