java - Modify a form in Spring MVC -



java - Modify a form in Spring MVC -

application : spring, jsp

is possible create editable form in spring mvc + jsp? can create new form using

<sf:form modelattribute="employee method="post>

but 1 time inputs saved in database, how form provided user allow them modify inputted values?

sorry, don't have thought how can done, have not posted have tried!

thanks in advance

i assume adding sort of empty employee entity or form object model when render form. example:

model.addattribute("employee", new employee());

if want edit employee record after save it, add together employee instance model instead of empty instance. example:

employee employee = employeeservice.getemployeebyid(employeeid); model.addattribute("employee", employee);

you need create separate controller method has id of employee want edit in path variable or request param know employee instance retrieve , add together model (the illustration above assumes have service that).

hope helps, if need clarification, leave comment , i'll seek update answer.

java spring jsp spring-mvc

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -