greetings all
i have a domain class named car
and i have an object from car retrieved from the DB
and i want to save this object in the form as a hidden field
in order when submitting to get this object
but when i tried
<form:hidden path=carObj />
it didn’t work, any ideas why, and how to do such behaviour ?
Well
carObjis a java object, and an HTML hidden field can only hold text, so how would Spring store one inside the other? If you want to use hidden fields, you’re going to have to break down the object into individual fields.It sounds like what you need is to tell Spring to store
carObjin the session, so that’s visible when the form is posted. You can use the@SessionAttributesannotation for this (see docs).