Why do you only call a default method on the page ??? JSF

0

Hi, I'm working on a project using Jsf.

The problem is that when calling a method of a Bean for example #{pruebaBean.test()} only returns the result correctly on the first page that executes the project, that is, the default page set in web.xml , when changing pages just return #{prueba.test()} as is.

I have a configuration file of the beans face-config.xml with the following:

<managed-bean>
    <managed-bean-name>pruebaBean</managed-bean-name>
    <managed-bean-class>Beans.PruebaBean</managed-bean-class>
    <managed-bean-scope>request</managed-bean-scope>
</managed-bean>

and a simple and basic Bean test:

public class PruebaBean implements Serializable {

/**
 * Creates a new instance of UsuarioBean
 */
public PruebaBean() {
}
public String test(){
return "prueba";
}

}

I assume that something is missing in the configuration to cover all the pages, but I do not know what it is, if you help me, I would appreciate it.

    
asked by Pablo 07.11.2017 в 16:23
source

1 answer

0

What I see is that you have defined the scope of the bean as a request. Then the values of that bean are available in a single http request.

They try to change the scope of your bean to session and it will be maintained on all pages

    
answered by 07.11.2017 / 17:51
source