Saturday, July 12, 2008

Inside Jsf(User Interface-Bean Interaction)

We can build our page by using jsf standart tags. Then we have to control these components with our beans and we have to control the behaviour of it. How?

We are doing this wtih backing beans related to our jsf pages connected by faces-config.xml.

So what is faces-config.xml?

This file is used to manage and configure our view. We are connecting our backing beans to our pages by using these lines;

1 <managed-bean>
2 <managed-bean-name>baseMBean
3 <managed-bean-class>
4 tr.gov.ibb.beans.BaseMBean
5 </managed-bean-class>
6 <managed-bean-scope>request
7 </managed-bean>

Line 1:"Here, a managed bean is starting"
Line 2:"Here, Beans name="baseBean" and you can use this declaration in your pages like"
Example:="<ice:inputText value="#{baseBean.entity.property}" />"
Line3:This managed Beans class is loocated in this package
Line4: Managed beans package name comes here as "com.oracle.beans.BaseBean"
Line5: Closing tag

Line6: This line is very important!! Managed beans scope is defined. And there could be 4 states for a managed bean. These are: "Request, Session, Application and None" I will explain them later.
Line7:Closing tag

After doing some configuration now we can control our view with our Bean.

No comments: