JSF is a framework and backing bean is a part of it. You cannot test the functionality of most of the componenet without using backing bean. Please go through some good examples to understand it in a better way.
Originally posted by peter tong: Oh, theat means all h:inputText must have a backing bean,otherwise we have no method to get the value?
Before you get into details, you really need to get an understanding of what JSF is all about. I think, actually, that you're looking at it as though the JSF pages are where the program logic is based, and that isn't so. In fact, one of the bits of advice I provide more than almost any other in this forum is that JSF pages should have as little logic on them as possible. None at all, if you can.
JSF is about as complete an implementation of the classic Model/View/Controller paradigm as you can manage when HTTP is your underlying transport mechanism. It's also very much based on the concept of Inversion of Control (IoC), where you don't "get" things, they're injected into your code.
I had to learn to think of web application structure a lot differently when I started working with JSF. So will you.
Kevin P Smith
Joined: Feb 18, 2005
Just been looking at JSF quickly and have a quick question to ask. I've put it here because this thread seems to be along the same lines...
I found this quick sample 2 page app called JSFKickStart.
Basically has 2 JSPs and a Bean, with the following smippets
Now my question is, how does JSP1 or JSP2 know to use the Getter or Setter?
Usually you'd expect to see something like
But as if by magic JSF seems to know which to use, what's the 'background' logic going on here?
PS: Early opinion is that JSF look very much the thing for me, but it will be very hard to drag me away from 5 years or so of classic JSP/Servlet/Bean coding!
Just like to add another observation to this question...
Pu a couple of simple Sys.outs in the Bean to see when, what is called and noticed this:
It 'gets' the method getPersonName twice! It gets the method getPersonName, then gets the method setPersonName, then gets the method getPersonName again!
That seems an extra 'call', why is this? [ November 20, 2008: Message edited by: Keith Seller ]