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>