• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsf table binding attribute help needed

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;
}
}
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Anil11", please check your private messages about an important administrative matter.
reply
    Bookmark Topic Watch Topic
  • New Topic