是否可以将类继承到@managedbean

时间:2014-01-22 19:29:09

标签: jsf jsf-2 primefaces el

我正在使用jsf 2.1.26和primefaces 3.5 这是代码..

HescoBusinessBean

 public abstract class HescoBusinessBean {

    private String mod = "";
    // setter and getter
    }

BudgetReservedBean

@ManagedBean(name = "budgetReservedBean")
@ViewScoped
public class BudgetReservedBean extends HescoBusinessBean implements Serializable {

// other beans properties with setter and getter
}

BudgetReservedAction

@ManagedBean
@RequestScoped
public class BudgetReservedAction implements Serializable {

@ManagedProperty(value = "#{budgetReservedBean}")
    private BudgetReservedBean budgetReservedBean;

// setter and getter

}

abc.xhtml

<h:outputText value="#{budgetReservedAction.budgetReservedBean.mod}" />
<!--where 'mod' property in HescoBusinessBean-->

//在服务器日志上收到错误

org.apache.el.parser.ParseException: Encountered " "mod" "mod "" at line 1, column 43.
Was expecting:
    <IDENTIFIER> ...

任何人都可以帮助我吗?提前谢谢

1 个答案:

答案 0 :(得分:3)

mod是EL保留字。请参阅here所有保留字的列表。

您的bean继承实现是正确的。