Announcement Announcement Module
Collapse
No announcement yet.
call a backingBean.action() (JSF/MVC) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • call a backingBean.action() (JSF/MVC)

    Hallo.
    I my applikation runs with SWF2 and JSF and Facelets.

    Any of my pages are not a flow and i defined this sites as JSF-Pages (xhtml).
    For this pages i use spring as middle-tier only and jsf as web-tier.
    The BackingBean:
    Code:
    public class BackingBean {
    	private MyService service;
    	private User user;
    
    	public BackingBean(){
    		int userId = get from the request (facesContext.externalContext) 
    		initAttributes(userId);
    	}
    	
    	private initAttributes(int userId){
    		this.user = ..load by id from DB
    	}
    	
    	public MyService getService() {
    		return service;
    	}
    	public void setService(MyService service) {
    		this.service = service;
    	}
    }
    Inside the xhtml page i use the backingBean as follow:
    Code:
    ${backingBean.attribute}
    But i think it's not a good design to initialize the attributes of my backingBean (by load from the DB) inside the constructor.
    Furthermore i want to call a BackingBean.action().

    At the moment i have no navigationrules inside my faces-config.xml (only ViewHandler and VariableResolver).


    Is it possible to instantiate and inject the backingBean by spring-mittle-tier and trigger a jsf-livecycle without a mixe of managedbeans and springbeans?
    Maybe:
    1. call the xhtml-page
    2. spring instantiate and inject the backingbean
    3. an event is called at the backingBean (init)
    4. render the view
    5. call a actionListener or Action at the backingBean <h:commandLink..?

    If i use JSF, should i use the navigation-rules and managed-beans with faces-config or should i have a springcontroller to manage the lifecycle? I would benefit from the jsf-components and eventhandling.

    Maybe anybody have an example?
    Last edited by spring_alex; Jun 30th, 2008, 08:43 AM.
Working...
X