Illegal Syntax for Set Operation
Asked Answered
A

1

15

I have a problem in connecting My xhtml page to the managed bean, the action on the commandButton works but when it comes to passing values it doesn't work. here is my jsf code:

 <h:form id="form" class="form-signin">
            <p:panel id="panel" header=" Authentification" style="" >
                <h:panelGrid columns="2" rowClasses="3">  
                    <h:outputLabel  for="login" value="Nom d'utilisateur :"  styleClass=""/>  
                    <p:inputText id="login" value=" #{authenticationBean.profil.login }" required="true" label="login" >  
                        <f:validateLength minimum="4" />  
                    </p:inputText>  
                    <h:outputLabel for="password" value="Mot de passe :" /> 
                    <p:password id="password" value=" #{authenticationBean.profil.password }" required="true" label="password" styleClass=""/> 

                    <p:row>
                        <p:commandButton id="loginButton" value="Login" ajax="false" action="#{authenticationBean.validate}" />
                        <h:messages id="messages" globalOnly="false"/>
                    </p:row> 
                </h:panelGrid>
            </p:panel> 
        </h:form>

i'm using morphia to map data to mongo db, i have also an entitie called profil and one bean to manage authenfication. here is my athentication bean Code :

public class AuthenticationBean implements Serializable {
private static final long serialVersionUID = 1L;
private Profil profil;
private ProfilDAO profileDao = DAOFactory.getProfilDAO();

public void validate() {
    FacesMessage message = new FacesMessage("Succès de l'inscription !");
    FacesContext.getCurrentInstance().addMessage(null, message);

}
// getters and setters 

here is my profil entitie code :

@Entity("profils")
public class Profil {
@Id protected ObjectId _id;
protected String nomProfil,prenomProfil,login,password;
@Embedded protected List<Droit> droits;
@Reference protected Admin admin;
public Profil() {
}
//getters and setters ...

this is the eror i get when i submit some data and click the submit button :

javax.el.PropertyNotWritableException: /index.xhtml @29,125 value=" #{authenticationBean.profil.login }": Illegal Syntax for Set Operation
Ambiversion answered 18/8, 2013 at 18:18 Comment(1)
Looks like you're missing a setter. Please add your code for setters to the question.Glaucous
A
24

Look closer at the value and compare with what all sane JSF tutorials/examples try to show you:

value=" #{authenticationBean.profil.login }"

Whitespace is significant in attributes and EL expressions. Get rid of it:

value="#{authenticationBean.profil.login}"
Amplifier answered 18/8, 2013 at 23:50 Comment(2)
Thanks. I had a similar problem with Primefaces having a space after the curly brace and getting the same error <p:column ... filterValue="#{myView.filterConfig.category} "/>Javier
It is very hard to see ! it could be a bottleneckAmbiversion

© 2022 - 2024 — McMap. All rights reserved.