jsf 2.0 managed bean's property not found

后端 未结 1 668
青春惊慌失措
青春惊慌失措 2021-01-05 19:26

JSF error: /fstation/search.jspx(24,62) \'#{vManager.fStations}\' Property \'fStations\' not found on type vm.beans.VisitorManagertype

vManager is my ma

相关标签:
1条回答
  • 2021-01-05 20:07

    If a property name starts with two or more uppercased characters, then it will be assumed to be in exactly that case. The getter getFStations() indicates a property name of FStations, so you should then access it as such:

    <h:dataTable value="#{vManager.FStations}" var="row">
    

    This is specified in chapter 8.8 of the JavaBeans Specification:

    8.8 Capitalization of inferred names.

    ...

    Thus when we extract a property or event name from the middle of an existing Java name, we normally convert the first character to lower case. However to support the occasional use of all upper-case names, we check if the first two characters of the name are both upper case and if so leave it alone. So for example,

    • “FooBah” becomes “fooBah”
    • “Z” becomes “z”
    • “URL” becomes “URL”

    We provide a method Introspector.decapitalize which implements this conversion rule.

    Note that the property name is definied/resolved based on getter method name, not on private field name.


    Unrelated to the concrete problem, I however strongly recommend to not abbreviate property names like that. Your code is this way not self-documenting. Don't be lazy and write words full out:

    <h:dataTable value="#{visitorManager.fireStations}" var="fireStation">
    

    or maybe:

    <h:dataTable value="#{visitor.fireStations}" var="fireStation">
    
    0 讨论(0)
提交回复
热议问题