user2627156
user2627156

Reputation: 161

Spring : Updating table entry

I am new to Web applications. I am implementing a simple one that enables to show all the entries of a table (i am using Spring + Hibernate). I added a column that contains a link enabling the update of a table entry (in reality, juste one column can be updated the other ones shouldn't be changed).

I would like that when i click on this update link, a form of update should be displayed and this form is initialised with the values of the columns of the table entry.

for example: if the entry is :

USER1 | 55 | 190cm | 80kg | "update link"

only the weight column can be updated, so the form of update so be initialised with:

name : USER1 (cannot be changed) age : 55 (cannot be changed) height : 190cm (cannot be changed) weight : 80kg ( THE ONLY COLUMN THAT CAN BE CHANGED)

How can i pass the values from the "display.jsp" page to the "update.jsp" page? should i pass through the controller or froma jsp to jsp directly?

Thanks,

Upvotes: 0

Views: 249

Answers (1)

Maksym Demidas
Maksym Demidas

Reputation: 7817

Each controller must be responsible for loading appropriate data and passing them to corresponding view. The only info that you need to pass from one page to another is unique identifier of choosen line. Consider example where you want to change a record with unique identifier = 758. Normally unique identifier will be passed trough URL param:

http://example.com/update_controller_address?id=758

Upvotes: 1

Related Questions