title: Problem with JSF form submit
body: <pre><code>public class MyBackingBean{
  
  private List model;
  
  public String search(){
    //change model data
    model = doSearch();
    return "same_view"
  }
  
  @PostConstruct
  public void init(){
    model = loadDefault()
  }
  
  //Other code omitted for clarity
  }
  </code></pre>
  
  <p>And in JSP, for some reasons I use <strong>c:foreach</strong> to iterate over the model and display the items in a HTML table. The jsp page has got a searh button the action of which is mapped to the <strong>#{mybackingbean.search}</strong>. So when i click seach, i expect only a subset to be displayed(based on search params) on the same page. The problem i have is that, "When i click on search button,search method is getting invoked and it returns a view name. Since the bean is request scoped, a new instance of the bean is getting created after this and eventually the init method <strong>overwrites the results</strong>.Meaning, i get the same initial view which displays all the items instead of displaying only the matching items". </p>
  
  <p>What is wrong with this ? And please guide me on the ideal approach to solve this.</p>