Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

jsf table binding attribute help needed

 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • 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
  • 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: 25818
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Anil11", please check your private messages about an important administrative matter.
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic