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 6705249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:22:55+00:00 2026-05-26T07:22:55+00:00

Hi I am getting a new session bean for every ajax request made to

  • 0

Hi I am getting a new session bean for every ajax request made to this Bean… Can any of you tell me why ?

...... imports ......
@Named(value = "userController")
@SessionScoped
public class UserController implements Serializable {

private User current;
private DataModel items = null;
@EJB
private br.com.cflex.itm.dataaccess.UserFacade ejbFacade;
private PaginationHelper pagination;
private int selectedItemIndex;

public UserController() {
}

public Collection<Project> getMyProjectList(){
    String login = FacesContext.getCurrentInstance().getExternalContext().getUserPrincipal().getName();
    User u = ejbFacade.getUserFromLogin(login);
    return u.getProjectCollection();
}    

public User getSelected() {               
    if (current == null) {
        current = new User();
        selectedItemIndex = -1;
    }
    return current;
} 
....... rest of class ....

Every time I make this request I am getting a new of this SessionBean I for as far as I know I should be getting the same guy over and over again.

    <h:panelGrid columns="2" cellpadding="2">
      <h:form>
       <h:outputText value="#{bundle.FirstName}"/>                                
         <h:inputText id="name" value="#{userController.selected.name}">
          <f:ajax event="keyup" execute="name" render="out" />
<!--       <f:ajax event="keyup" render="out"/>-->
           </h:inputText>
           <p>
            <h:commandButton value="add"></h:commandButton>      
            <h:outputText id="out" value="#{userController.selected.name}"/>
           </p>
      </h:form>
    </h:panelGrid>
  • 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-05-26T07:22:55+00:00Added an answer on May 26, 2026 at 7:22 am

    That can happen if you accidently imported @SessionScoped from the javax.faces.bean package instead of the javax.enterprise.context package.

    You’re using @javax.inject.Named annotation, so you should import the scopes from the javax.enterprise.context package. The scopes from the javax.faces.bean package only works in combination with @javax.faces.bean.ManagedBean annotation.

    A CDI bean without a valid scope will behave like @RequestScoped. A JSF bean without a valid scope will behave like @NoneScoped.

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

Sidebar

Related Questions

Anyone getting this error when using the new free chart controls MS bought from
When getting SQL DateTime Resharper suggests to use new DateTime() when value is DBNull.Value
I've created very basic EJB3 stateful bean but can't access it remotely. I'm getting:
We are getting new dev machines and moving up to Vista 64 Ultimate to
We're getting new servers. Trying to figure out the AMD vs Intel holy war.
Background: I'm a windows developer at MegaCorp(tm) and I am getting new hardware soon.
So I'm getting a new job working with databases (Microsoft SQL Server to be
I'm looking at getting a new LCD monitor, but I'm concerned that a glossy
We were running Tarantino in a Nant build script but we're getting some new
Okay I have updated my code quite a bit. I am getting a new

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.