avoiding excessive bijection question
x490812 Jul 9, 2007 6:35 PMIn Michael Yuan's seam book, there is a secion on avoiding excessive bijection.
I have tried to implement this idea in a test app with the following code:
the controller
@Stateful @Name("indexPage") @Scope(org.jboss.seam.ScopeType.SESSION) public class IndexPageBean implements IndexPage { @Logger private Log log; @In FacesMessages facesMessages; private Property property; private Borrower borrower; . . . public Borrower getBorrower() { return borrower; } public void setBorrower(Borrower borrower) { this.borrower = borrower; } . . .
the view
<div id="Borrower"> <h2>Borrower</h2> <form name="BorrowerForm" id="BorrowerForm" jsfc="h:form"> <div id="ageDiv"> <label>AGE: <input type="text" name="textfield" jsfc="h:inputText" value="#{indexPage.borrower.age}"/> </label> </div> <div id="grossIncomeDiv"> <label>GROSS: <input type="text" name="textfield" jsfc="h:inputText" value="#{indexPage.borrower.grossIncome}"/> </label> </div> <div id="submitBorrower"> <input type="submit" jsfc="h:commandButton" id="submitBorrowerButton" action="#{indexPage.submitBorrower}" value="Submit" /> </div> </form> </div> . . .
I am getting the error:
/home.xhtml @16,101 value="#{indexPage.borrower.age}": Bean: org.javassist.tmp.java.lang.Object_$$_javassist_91, property: borrower
with a stacktrace of
javax.faces.el.PropertyNotFoundException: /home.xhtml @16,101 value="#{indexPage.borrower.age}": Bean: org.javassist.tmp.java.lang.Object_$$_javassist_91, property: borrower
at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:217)
at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderInput(HtmlTextRendererBase.java:135)
Why? It seams to be saying that I do not have a borrower property in my controller, yet that is not true. Is it because I must first initialize something? The book gives a very similar example, but I must be missing something.