A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Java
»
JSF
Author
JSF bind object
Edward Chen
Ranch Hand
Joined: Dec 23, 2003
Posts: 758
posted
Mar 11, 2008 12:20:00
0
I don't know why the 'peoplePageObj.people.peopleId' can't bind into an object 'people' when clicking the 'submit' button ?
I am new to
JSF
, please help. any link is welcome.
Thanks.
<f:view> <h:form> <h:outputText value="Id"/><h:inputText id="inputInt" value="#{peoplePageObj.people.peopleId}"/> <h:dataTable value="#{peoplePageObj.people.names}" var="name"> <h:column> <f:facet name="header"><h:outputText value="nameId" /></f:facet> <h:inputText id="inputInt" value="#{name.nameId}"/> </h:column> </h:dataTable> <h:commandButton id="button1" value="submit" action="#{peoplePageObj.save}" /> </h:form> </f:view>
public class PeoplePageObj { private PeopleDao peopleDao; private People people; public People getPeople() { return peopleDao.getPeople(); } public void setPeople(People people) { this.people = people; } public PeopleDao getPeopleDao() { return peopleDao; } public void setPeopleDao(PeopleDao peopleDao) { this.peopleDao = peopleDao; } public PeoplePageObj(PeopleDao peopleDao) { this.peopleDao = peopleDao; } public PeoplePageObj() { peopleDao = new PeopleDao(); } ///////////////////////////// public void save(){ //peopleDao.save(); System.out.println(this.getPeople()); // failed }
<managed-bean> <managed-bean-name>peoplePageObj</managed-bean-name> <managed-bean-class>com.pageobj.PeoplePageObj</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean>
Abhisek Jana
Greenhorn
Joined: Jan 25, 2007
Posts: 14
posted
Mar 11, 2008 14:36:00
0
use this :
<h:dataTable binding="#{peoplePageObj.people.names}" var="name">
Thanks,<br />Abhi<br />[SCJP,SCWCD,SCBCD,SCDJWS]
I agree. Here's the link:
http://zeroturnaround.com/jrebel
- it saves me about five hours per week
subject: JSF bind object
Similar Threads
Dynamic Component in JSF
creating a table component dynamically
Unable to call Action Methof
Providing anchor to columns in a datatable
Which Package to Import to Use FacesContext's getRequestMap()?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter