JSF中的页面加载事件 [英] Page On load event in JSF

查看:341
本文介绍了JSF中的页面加载事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在页面加载期间为下拉菜单分配值.我按照此链接中给出的方法进行操作.

I am trying to assign values to my dropdown during page load. I followed the way which is given in this link.

在页面加载时调用JSF托管Bean操作

根据链接,我尝试同时使用批注和构造函数类型.

As per the link, i have tried using both the annotation and constructor type.

但这对我来说是个例外,

but its an exception for me,

 SEVERE: An exception occurred
 javax.faces.FacesException: java.lang.reflect.InvocationTargetException

 Caused by: java.lang.reflect.InvocationTargetException
 Caused by: javax.el.ELException: Detected cyclic reference to managedBean loginBean
 Caused by: javax.faces.el.EvaluationException: Detected cyclic reference to managedBean loginBean

我刚刚尝试在带注释的方法或构造函数中调用函数, 就是

I have just tried to call a function, in that annotated method or constructor, that is,

     @PostConstruct
public void init()
{
receiveclass r=new receiveclass();
r.retrieve();

} 

我无法找出问题所在.

推荐答案

检测到对ManagedBean loginBean的循环引用

Detected cyclic reference to managedBean loginBean

您要在彼此中将两个不同的托管bean作为@ManagedProperty注入.这是不允许的.它应该是单向注射.从另一个bean中删除引用一个bean的@ManagedProperty.

You're injecting two different managed beans in each other as @ManagedProperty. This isn't allowed. It should be an one-way injection. Remove the @ManagedProperty referencing the one bean from the other bean.

这篇关于JSF中的页面加载事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆