Separate controller+state from page bean?

Hi. I'm new to jsf web applications and look for a good practice on how to compose a tiny application.

What I have:

1) business logic class:

- holds application scope state

- public Result doSomething(with something)

(This would be a managed bean with application scope?)

2) page bean w/ gui set up by the IDE

My experience is that the latter page bean code gets cluttered quite easily. My intention is to write a controller/adapter class (session scope) which:

- handles gui actions (1:1) and do needed calls to model + evaluation

- holds session state

- provides "ready to use" output properties for use with jsf value binding

In my page bean generated by Studio Creator, I would basically only forward actions to the controller class and bind gui components to properties of the same class.

Would that be a usual way to write web apps?

Should the controller class be instantiated as managed session bean and get access to the model using the getBean(String) mechanism? (How does it get access to that mechanism - implement some provided bean class?)

Is it appropriate to call the above class a "controller"?

Thanks.

[1216 byte] By [newtofsha] at [2007-11-26 14:49:30]
# 1

Okay, this is what I did so far:

My "controller" implements com.sun.rave.web.ui.appbase.FacesBean; This class implements GetBean(String) - which gets the instance simply by calling FacesContext's static function getCurrentInstace() and so on.

So far the application works. The generated pages contain virtually no hand-coded logic at all, so I could throw away and redo the gui at any time.

I have not yet figured out what to do to have my managed beans show up in the "bind value" dialogue. I have them there finally, but I am not sure why.

newtofsha at 2007-7-8 8:37:30 > top of Java-index,Development Tools,Java Tools...