【发布时间】:2017-09-18 00:43:52
【问题描述】:
我创建了一个 JSF 应用程序,但我不确定应该在 faces-config 中添加什么?
我的一个 ManagedBeans 如下所示:
@ManagedBean(name = "ProfileBean")
@ViewScoped
public class ProfileBean implements Serializable
我的应用程序上下文
<context:annotation-config />
<bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor" />
<bean id="QuestionDao" class="code.elephant.dao.QuestionDao"></bean>
<bean id="QuestionService" class="code.elephant.service.QuestionService">
<constructor-arg ref="QuestionDao"/>
</bean>
<bean id="QuestionBean" class="controller.QuestionBean">
<constructor-arg ref="QuestionService"/>
</bean>
<bean id="UserDao" class="code.elephant.dao.UserDao"></bean>
<bean id="UserService" class="code.elephant.service.UserService">
<constructor-arg ref="UserDao"/>
</bean>
<bean id="LoginBean" class="controller.LoginBean">
<constructor-arg ref="UserService"/>
</bean>
<bean id="ProfileBean" class="controller.ProfileBean">
<constructor-arg ref="UserService" />
<property name="_LoginBean" ref="LoginBean"></property>
</bean>
我的面孔配置
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
我看到了一些在java-faces.config 中定义<managed-beans> 的示例,但我已经在java 类中使用了@ManagedBean 注释。这有必要吗?我的 jsf spring 设置是否正确?我是否还应该在faces-config 中定义托管bean?
【问题讨论】: