tags:

views:

28

answers:

0

hi all . I'm new to spring, currently i use the request scope and get the following exceptions:

javax.el.PropertyNotFoundException: /login/login.xhtml @11,86 action="#{loginViListWeb.nextPage}": Target Unreachable, identifier 'loginViListWeb' resolved to null

the part of the .xhtml is:

<h:outputText value="#{loginViListWeb.empName}"/>
            <h:commandLink id="nextPage" value="nextPage" action="#{loginViListWeb.nextPage}">
                <f:param name="name" value="mark"/>
            </h:commandLink>

the backing bean is:

@Component("loginViListWeb")
@Scope("request")
public class LoginViListWeb extends BaseWeb<EmpViEn> {
    ...snip....

    public LoginViListWeb() throws Exception {
        super(EmpViEn.class);   
    }

    public String nextPage() throws Exception{
        ...snip...
        return "nextPage";
    }

    @Override
    public EmpViEn readValue() {
        ...snip...
    }
}

I had configurated spring to scan the entire package. I used junit to test that the bean is instantiated correctly if using scope("singleton") . Test code as:

 ApplicationContext ctx = new FileSystemXmlApplicationContext("WebContent/WEB-INF/spring_config.xml");       
             LoginViListWeb loginWeb = (LoginViListWeb)ctx.getBean("loginViListWeb");

So I'm pretty sure that works OK. But when using scope("request") ,the xhtml page was calling then when i click the nextPage button,i got the exception above.

Anyone can help me? I really appreciate it .