views:

461

answers:

1

Hi. I have a java web application which uses spring webflow as framework. I have a problem with processing data on a plain flow xml. When the processing gets more complicated I find it hard to implement using the flow xml of the web flow. I was considering of using controllers to perform these operations. How do I do this. Have no Idea in using controllers in web flow. And from controllers can I jump to the flow xml too to continue processing?

An example of my problem is in submitting forms. Here's the scenario. I have a Users table and authorities table. I also have a User class representing the tablebec I used here Hibernate. In my register page I have the username, password and authority(not a field of the user class) fields. I bind this form to my User object using spring webflow binding. My problem is I can't bind the authority field because it doesn't exist in my User class. Do i need to create a bean representing my form? I need to add the username and password on Users table and authority in another table Authority. Where do I make the initializations for my User object and Authority object or where do I set the values from the registerFormBean to my POJOs? I think it is not a good approach or it will make my flow xml complicated

+1  A: 

you can implement this by jsf as presentation +webflow+mvc as controller

first you will create backing bean with username,password,authority then let webflow to create the backing bean on session then when submit the action will call @controller "Spring MVC" and controller will call your business and business call DAO which you implemented it as Hibernate

like this <on-start> <evaluate expression="youractionClass.createbackingBean()" result="conversationScope.yourbean" /> </on-start>

second solution you can bind the view to model which contains username,password,authority then when submit the action will call @controller "Spring MVC" and controller will call your business and business call DAO which you implemented it as Hibernate

<view-state id="registerForm" model="registerBean"
bassem