javax.el.PropertyNotWritableException:集合操作的非法语法

时间:2014-09-19 06:25:05

标签: jsf el jsf-2.2

我收到了这个错误" javax.el.PropertyNotWritableException:/staffComposeMail.xhtml @ 55,218 value ="#{emailBean.staffToEmail.firstName}#{emailBean.staffToEmail.lastName}(#{emailBean。 staffToEmail.email})":设置操作的非法语法"当我尝试提交表格时。

这就是我的网页的样子。带红色下划线的文本分别代表emailBean.staffToEmail.firstName,emailBean.staffToEmail.lastName和emailBean.staffToEmail.email。

enter image description here

我的一个页面中的输入框

<input type="text" class="form-control" jsf:value="#{emailBean.staffToEmail.firstName} #{emailBean.staffToEmail.lastName} (#{emailBean.staffToEmail.email})"/>

有关如何解决此问题的任何想法?

编辑:在emailBean中添加

package managedbean;

import entities.Staff;
import entities.StaffEmail;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import sessionBeanInterface.emailSessionBeanLocal;
import sessionBeanInterface.staffSessionBeanLocal;

/**
 *
 * @author 
 */
@ManagedBean(name = "emailBean")
@SessionScoped
public class EmailBean implements Serializable {

    @PostConstruct
    public void init() {
        setStaffToEmail(new Staff());
        email = new StaffEmail();

    }

    @EJB
    private emailSessionBeanLocal emailSession;
    @EJB
    private staffSessionBeanLocal staffSession;
    private StaffEmail email;
    private String emailWithFirstName;
    private String personTo;
    private Staff staffToEmail;

    /**
     * @return the emailSession
     */
    public emailSessionBeanLocal getEmailSession() {
        return emailSession;
    }

    /**
     * @param emailSession the emailSession to set
     */
    public void setEmailSession(emailSessionBeanLocal emailSession) {
        this.emailSession = emailSession;
    }

    /**
     * @return the email
     */
    public StaffEmail getEmail() {
        return email;
    }

    /**
     * @param email the email to set
     */
    public void setEmail(StaffEmail email) {
        this.email = email;
    }

    /**
     * @return the emailWithFirstName
     */
    public String getEmailWithFirstName() {
        return emailWithFirstName;
    }

    /**
     * @param emailWithFirstName the emailWithFirstName to set
     */
    public void setEmailWithFirstName(String emailWithFirstName) {
        this.emailWithFirstName = emailWithFirstName;
    }

    /**
     * @return the personTo
     */
    public String getPersonTo() {
        return personTo;
    }

    /**
     * @param personTo the personTo to set
     */
    public void setPersonTo(String personTo) {
        this.personTo = personTo;
    }

    /**
     * @return the staffToEmail
     */
    public Staff getStaffToEmail() {
        return staffToEmail;
    }

    /**
     * @param staffToEmail the staffToEmail to set
     */
    public void setStaffToEmail(Staff staffToEmail) {
        this.staffToEmail = staffToEmail;
    }

    /**
     * @return the staffSession
     */
    public staffSessionBeanLocal getStaffSession() {
        return staffSession;
    }

    /**
     * @param staffSession the staffSession to set
     */
    public void setStaffSession(staffSessionBeanLocal staffSession) {
        this.staffSession = staffSession;
    }
}

1 个答案:

答案 0 :(得分:1)

您只能为jsf:value属性分配一个值,如下所示:

jsf:value="#{emailBean.someString}"

然后,在您的EmailBean上,您可以拆分这个&#34; someString&#34;进入&#34; firstName&#34;,&#34; lastName&#34;和#34; staffToEmail&#34;属性。