【问题标题】:Call to Bean from xhtml not work从 xhtml 调用 Bean 不起作用
【发布时间】:2018-11-05 08:19:09
【问题描述】:

我必须在一个我不知道但它适用于我知道的 jsf 的框架中创建新功能,我生成 xhtml 但在调用 Bean # {mangeBean.data} 时,它不起作用。

这就是我在 XML 声明中的内容:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

我应该考虑如何调用 Bean?

【问题讨论】:

    标签: java html jsf xhtml


    【解决方案1】:

    您必须使用 ManagedBean 批注对该 bean 进行批注。例如:

        @ManagedBean
        @RequestScoped
        public class MyBean implements Serializable {
    
            //Your presentation logic    
        }
    

    【讨论】:

      猜你喜欢
      • 2013-06-10
      • 1970-01-01
      • 2012-01-26
      • 1970-01-01
      • 2018-04-26
      • 2014-07-20
      • 2010-11-04
      • 2015-04-20
      • 2013-04-19
      相关资源
      最近更新 更多