tags:

views:

428

answers:

1

Hi. I have a java web app running in spring web flow framework and hibernate as ORM. I wanna ask what the best practice is with regards to binding the form values. Do I create a pojo or bean representing each form so that I have an object where I can bind the form to? I can try getting the values as parameters in the url but I don't think this is a good approach.

What I was trying to do is pass the values inputted from the forms to the flow xml and use the values there as parameters in calling functions.

  <view-state id="editForm" model="registerBean" view="../xhtml/framework/edit">        
 <transition on="editButton" to="dummy" >
  <set name="flowScope.newPassword" value="requestParameters.newPassword"/>
        <set name="flowScope.confirmPassword" value="requestParameters.confirmPassword"/>
 </transition>
 <transition on="delete" to="deleteEmployee" />
 <transition on="back" to="loginSuccessful" />
</view-state>

I printed ${newPassword} in an xhtml file but get no output. So I was thinking of having an object representing the form and bind the values and access them in my flow xml

+2  A: 

Use <form:bind> directly with your domain (Hibernate) objects, no need of extra objects just for the sake if populating with data. If you have one domain object per screen, you can use spring's SimpleFormController.

Bozho