0

I am getting error while running this snippet as /facelet/crew/objectMapGossip.xhtml @14,94 value="#{objcetMapBean.searchCrewParam.staffNum}": Property 'staffNum' not readable on type java.lang.String please help me out from this small error .. I am new to jsf so stucking at things basic ... Thanks in advance :-)

This is my backing bean... import javax.faces.bean.ManagedBean;

@ManagedBean(name = "objcetMapBean")

public class ObjectMapGossip {
private SearchCrew1 searchCrewParam = new SearchCrew1("212","kart","asd");

public SearchCrew1 getSearchCrewParam() {
    return searchCrewParam;
}

public void setSearchCrewParam(SearchCrew1 searchCrewParam) {
    this.searchCrewParam = searchCrewParam;
}

public String search() {
    return "success";
}

}

class SearchCrew1 {

public SearchCrew1() {
    super();
}
 /**
 * @param staffNum
 * @param surName
 * @param rank
 */
public SearchCrew1(String staffNum, String surName, String rank) {
    super();
    this.staffNum = staffNum;
    this.surName = surName;
    this.rank = rank;
}

private String staffNum;

private String surName;

private String rank;

public String getStaffNum() {
    return staffNum;
}

public void setStaffNum(String staffNum) {
    this.staffNum = staffNum;
}

public String getSurName() {
    return surName;
}

public void setSurName(String surName) {
    this.surName = surName;
}

public String getRank() {
    return rank;
}

public void setRank(String rank) {
    this.rank = rank;
}

}

This is my jsf page

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body>
    <ui:composition template="/facelet/layout/mainlayout.xhtml">
        <ui:define name="content">
            <h:form>
                <div align="left">
                    <h:outputText value="Staff Number: " />
                    <h:inputText id="staffnum" size="6" value="#    {objcetMapBean.searchCrewParam.staffNum}" />
                    <h:outputText value="Surname: " />
                    <h:inputText id="surname" size="10" maxlength="25"  value="# {objcetMapBean.searchCrewParam.surName}"  />
                    <h:outputText value="Rank: " />
                    <h:inputText id="rank" size="3"  value="#{objcetMapBean.searchCrewParam.rank}"  />
                    <h:commandButton value="Search" action="#{objcetMapBean.search}" />
                </div>
        </h:form>
        </ui:define>
    </ui:composition>
    </h:body>
</html>
4

1 回答 1

0

我们可以h:dataTable轻松地使用 from jsf 标记和映射。 http://www.mkyong.com/jsf2/jsf-2-datatable-example/

于 2012-11-28T16:08:09.910 回答