File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » JSF
Bookmark "jsf table  binding attribute help needed" Watch "jsf table  binding attribute help needed" New topic

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.

Anil kumar

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) { = 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;
bean = getFacesContext().getExternalContext().getSessionMap().get( beanName );

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

Joined: Oct 14, 2005
Posts: 19973

"Anil11", please check your private messages about an important administrative matter.
I agree. Here's the link:
subject: jsf table binding attribute help needed
It's not a secret anymore!