javax.el.PropertyNotWritableException: /index.xhtml @29,118 value=“”: Illegal Syntax for Set Operation

后端 未结 1 1993
一生所求
一生所求 2021-01-13 15:33

I want to create a login screen with localization option to translate the name and when i change from the default English to Arabic it crash

here is the faces.config

相关标签:
1条回答
  • 2021-01-13 16:03

    Please carefully read the exception message. The answer is straight in there.

    javax.el.PropertyNotWritableException: /index.xhtml @29,118 value="": Illegal Syntax for Set Operation

    At line 29, character 118 of /index.xhtml you've a value="". This is not a valid syntax for an EL value expression which should be writable through a setter method.

    Normally, you specify the value attribute like so value="#{bean.property}" wherein the bean has a getProperty() and a setProperty() method conform javabeans specification.

    It's likely this one:

    <h:inputText  styleClass="form-login" title="Username" value="" size="30" maxlength="2048" />
    

    I'm not sure why you specified the value like that. This is plain wrong. You should either remove it altogether

    <h:inputText  styleClass="form-login" title="Username" size="30" maxlength="2048" />
    

    or bind it to a valid bean property

    <h:inputText  styleClass="form-login" title="Username" value="#{someBean.userName}" size="30" maxlength="2048" />
    

    Please note that this problem has nothing to do with changing the JSF locale.


    Unrelated to the concrete problem, nesting forms is illegal in HTML and therefore also in JSF. You should split the language selection and the user login over 2 separate forms. You don't want to submit the login data when you change the language. Further, you may find the hints in this answer helpful as to how to properly change the JSF locale: Localization in JSF, how to remember selected locale per session instead of per request/view

    0 讨论(0)
提交回复
热议问题