aspose file tools*
The moose likes JSF and the fly likes jsf table  binding attribute help needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "jsf table  binding attribute help needed" Watch "jsf table  binding attribute help needed" New topic
Author

jsf table binding attribute help needed

Kumar Gaurav
Ranch Hand

Joined: Apr 08, 2008
Posts: 108
Hi All,

I have a table displaying some records.Each record is having info about an user like name, age, role etc. and also having an update button. On clicking update button that particular row should get displayed in form format(there is such page to add user details.) and should be editable as well as not editable in the same page which is being used to add user details.
Please provide some inputs.


Regards,
Gaurav
Anil kumar
Greenhorn

Joined: Dec 05, 2008
Posts: 3
Have a backing bean which represents the user details
class UserDetails{
private int age;
private String name;
private boolean renderUserForm;
public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
public boolean isRenderUserForm() {
return renderUserForm;
}

public void setRenderUserForm(boolean renderUserForm) {
this.renderUserForm = renderUserForm;
}

}

with in the f:subview place the user form fields

<f:subview rendered="#{user.renderUserForm}">....</f:subview>

write a event listener and access the managed user bean and update fields age,name etc.. also set the renderUserForm boolean value to true

accessing managed beans in a event listener

public Object getManagedBean(String beanName, Object newBean) {

Object bean=null;
if(newBean!=null)
bean = getFacesContext().getExternalContext().getSessionMap().get( beanName );

if(bean == null)
{
getFacesContext().getExternalContext().getSessionMap().put(beanName, newBean);
return newBean;
}
else
{
return bean;
}
}
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18985
    
    8

"Anil11", please check your private messages about an important administrative matter.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsf table binding attribute help needed