Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8744495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:50:57+00:00 2026-06-13T11:50:57+00:00

I am migrating from JSF1.2 to 2.1, I changed entries for beans in faces-config.xml

  • 0

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.

I read few Q&A here, and This article, but i didn’t force it to work.

I change JSTL tags to rendered atribute, or c:if with ui:param rendered.

in my web.xml i set params:

<context-param>
  <param-name>javax.faces.PARTIAL_STATE_SAVING</param-name>
  <param-value>false</param-value>
</context-param>
<context-param>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>CLIENT</param-value>
</context-param>

I tried javax.faces.PARTIAL_STATE_SAVING = true, but didn’t work too. With javax.faces.STATE_SAVING_METHOD = SERVER the same problem.

I removed tags handler for test, but it didn’t help too.

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.

I use tomcat 6

EDIT:

This is my bean:
package my.package;

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("-->> someNameBean is being created");       
}
}



package my.package;

@ManagedBean(name="someNameMyOtherBean")
//@ViewScoped
@SessionScoped
public class MyOtherBean extends BaseBean {

private ClassWithFormFields dataIn; //getter & setter exist
//a lot of code here

}

Example use of bean

<h:selectOneMenu value="#{someNameBean.dataIn.currencyId}" id="currencyId" tabindex="2" >
<f:selectItems value="#{someNameBean.dataIn..availableCurrencies}"/>
</h:selectOneMenu>

Update
serviceLocalizator is managed by Spring xml files ans JSF annotation

@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

}

Update 2:
It’s My fault. Thanks for @kolossus that he the indicated direction.
I i was looking for answer and I found and read BalusC article 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.

Maybe is a way to use @ViewSoped with redirect to new page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:50:59+00:00Added an answer on June 13, 2026 at 11:50 am

    NB: If you reference the same (non-session scoped) bean from 2 different views, two instances of that bean will be created

    Navigating in JSF is very basic and straightforward from whatever kind of a bean that is backing a JSF view.

    1. return the name (view id) of the page you’re trying to navigate to as the return value of a public method

        public String navigateAway(){
         //Do whatever processing you want here
         return "page2"; //where page2 is the name of an actual .xhtml file in your application     
         }
      
    2. Return a JSF navigation case outcome as specified in a faces_config.xml file

        public String navigateAway(){
          //Prior processing
          return "go somewhere else" ;  //where go somewhere else is a navigation outcome you've specified in your faces_config.xml file
         }    
      

      In your faces_config.xml file, you’ll have this

        <navigation-rule>
      <from-view-id>/register.xhtml</from-view-id>
      <navigation-case>
          <from-outcome>go somewhere else</from-outcome>
          <to-view-id>/review_registration.xhtml</to-view-id>
          <redirect/>
      </navigation-case>
      

    If you want to remain on the same page after an action however, just return null instead of a string in your method and you will not be taken to another view. Also, depending on the scope of your backing bean, you can be sure you will be using the same instance of the bean if you return a null value

    For more detail look here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am migrating application from JSF1.2/MyFaces+Facelets TO JSF2.1/MyFaces. I have following template which used
I am migrating from RC to webdriver. In my existing project I use methods
Migrating from textboxe to dropdownlist – Need to send value from a hard-coded dropdownlist
I am migrating from RichFaces 3.3 to RichFaces 4.1. In RichFaces 3.3 there was
We're migrating from one server to another and a VBA script to save attachments
So we are migrating from Informix to Sql Server. And I have noticed that
I started migrating from cucumber + webrat to cucumber + capybara. Now the behavior
Are there tools for migrating from one virtual machine type to another? E.g let's
I am migrating from Ubuntu 10.04 to Ubuntu 11.10 (oneiric), but I have problems
Hi can any one suggest tool for migrating from TFS to TFS preferred Open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.