title: @ViewScoped doesn't work, bean is created for every request
body: <p>I am migrating from JSF1.2 to 2.1, I changed entries for beans in faces-config.xml to annotations. I try use @ViewScoped instead @RequestScoped and @ManagedProperties(To many params in few classes), but every time i click submit for my form bean with annotated as @ViewScoped is recreated. For @SessionScoped everything works correctyl. </p>
  
  <p>I read few Q&amp;A here, and <a href="http://balusc.blogspot.com/2011/09/communication-in-jsf-20.html#ViewScopedFailsInTagHandlers" rel="nofollow">This article</a>, but i didn't force it to work.</p>
  
  <p>I change JSTL tags to rendered atribute, or c:if with ui:param rendered.</p>
  
  <p>in my web.xml i set params:</p>
  
  <pre><code>&lt;context-param&gt;
    &lt;param-name&gt;javax.faces.PARTIAL_STATE_SAVING&lt;/param-name&gt;
    &lt;param-value&gt;false&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;context-param&gt;
    &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt;
    &lt;param-value&gt;CLIENT&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>I tried javax.faces.PARTIAL_STATE_SAVING = true, but didn't work too. With javax.faces.STATE_SAVING_METHOD = SERVER the same problem. </p>
  
  <p>I removed tags handler for test, but it didn't help too.</p>
  
  <p>In project is used: Mojarra 2.1.13, hibernate 3.6, spring 3.1(far as i know updated form 2.x by my predecessor), acegi-security-1.0.5, tomahawk20, urlrewrite-3.2.0.</p>
  
  <p>I use tomcat 6</p>
  
  <p><b>EDIT:</b></p>
  
  <p>This is my bean:
      package my.package;</p>
  
  <pre><code>import javax.faces.bean.ManagedBean; 
  import javax.faces.bean.SessionScoped;
  import javax.faces.bean.ViewScoped;
  
  import my.package.MyOtherBean;
  
  @ManagedBean(name="someNameBean")
  @ViewScoped
  //@SessionScoped
  public class MyBean extends MyOtherBean {
  
  public MyBean(){
      super();
      //XXX
      System.out.println("--&gt;&gt; someNameBean is being created");       
  }
  }
  
  
  
  package my.package;
  
  @ManagedBean(name="someNameMyOtherBean")
  //@ViewScoped
  @SessionScoped
  public class MyOtherBean extends BaseBean {
  
  private ClassWithFormFields dataIn; //getter &amp; setter exist
  //a lot of code here
  
  }
  </code></pre>
  
  <p>Example use of bean</p>
  
  <pre><code>&lt;h:selectOneMenu value="#{someNameBean.dataIn.currencyId}" id="currencyId" tabindex="2" &gt;
  &lt;f:selectItems value="#{someNameBean.dataIn..availableCurrencies}"/&gt;
  &lt;/h:selectOneMenu&gt;
  </code></pre>
  
  <p><b>Update</b>
  serviceLocalizator is managed by Spring xml files ans JSF annotation</p>
  
  <pre><code>@ManagedBean
  public class BaseBean implements Serializable {
  
  private static final long serialVersionUID = 1L;
  
  protected transient Logger log = Logger.getLogger(this.getClass());
  
  @ManagedProperty(value="#{serviceLocalizator}")
  protected transient ServiceLocalizator serviceLocalizator;
  
      //few more lines
  
  }
  </code></pre>
  
  <p><b>Update 2:</b>
  It's My fault. Thanks for @kolossus that he the indicated direction.
  I i was looking for answer and I found and read <a href="http://balusc.blogspot.com/2010/06/benefits-and-pitfalls-of-viewscoped.html" rel="nofollow">BalusC article</a> And now i now, i shouldn't return string in backing bean action. With null instead string it works. I badly understood concept of a view, I thought that ViewSoped bean id live as long as tab/windows is the same. Now i know that is it JSF View.
  I'am sory for a trouble.</p>
  
  <p>Maybe is a way to use @ViewSoped with redirect to new page?</p>