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.
Advertisement
Answer
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.