2013-08-18 39 views
7

Tôi gặp sự cố khi kết nối Trang xhtml của tôi với bean được quản lý, tác vụ trên commandButton hoạt động nhưng khi nói đến giá trị truyền, nó không hoạt động. đây là mã JSF của tôi:Cú pháp bất hợp pháp cho hoạt động thiết lập

<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> 

Tôi đang sử dụng nha phiến để ánh xạ dữ liệu để Mongo db, tôi cũng có một entitie gọi profil và một hạt đậu để quản lý authenfication. đây là athentication tôi đậu 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 

đây là mã profil entitie tôi:

@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 ... 

đây là eror tôi nhận được khi tôi gửi một số dữ liệu và nhấp vào nút gửi:

javax.el.PropertyNotWritableException: /index.xhtml @29,125 value=" #{authenticationBean.profil.login }": Illegal Syntax for Set Operation 
+0

Có vẻ như bạn đang thiếu trình cài đặt. Vui lòng thêm mã của bạn cho người định cư cho câu hỏi. – unwichtich

Trả lời

14

Xem xét kỹ hơn giá trị và so sánh với tất cả các hướng dẫn/ví dụ về JSF sane cố gắng chỉ cho bạn:

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

Khoảng trắng quan trọng trong thuộc tính và biểu thức EL. Loại bỏ nó:

value="#{authenticationBean.profil.login}" 
Các vấn đề liên quan