arraylist からデータを入力しているときに、jsf panelgrid で問題が発生しました。次のようなエラーが発生しています。javax.el.PropertyNotFoundException: /facelet/crew/searchCrew.xhtml @14,95 value="#{searchCrewBean.searchCrewParam.staffNum}": Target Unreachable, 'searchCrewParam' returned null
以下のコードを見つけてください。親切に助けてください..
以下の JSF コード:
<?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>
<h:panelGrid columns="7" border="2" title="Crew information"
rendered="true">
<f:facet name="header">
<h:panelGroup border="2">
<h:inputText value="Staffnum" size="6" />
<h:inputText value="Surname" size="10" maxlength="25" />
<h:inputText value="Age" size="2" />
<h:inputText value="Rank" size="3" />
<h:inputText value="Type" size="1" />
<h:inputText value="Scexpiry" size="10" />
<h:inputText value="Mailboxno" size="4" />
</h:panelGroup>
<ui:repeat var="o" value="#{searchCrewBean.listOfSearchCrew}">
<h:panelGroup rendered="true">
<h:inputText id="staffnum" value="o.staffNum" size="6" />
<h:inputText id="surname" value="o.surName" size="10"
maxlength="25" />
<h:inputText id="age" value="o.age" size="2" />
<h:inputText id="rank" value="o.rank" size="3" />
<h:inputText id="type" value="o.type" size="1" />
<h:inputText id="scexpiry" value="o.scExpiry" size="10" />
<h:inputText id="mailboxno" value="o.mailBoxNo" size="4" />
</h:panelGroup>
</ui:repeat>
</h:panelGrid>
</h:form>
</ui:define>
</ui:composition>
</h:body>
</html>
ここに私のバッキングビーン...
@ManagedBean(name="searchCrewBean")
public class SearchCrewBean {
private ArrayList<Crew> listOfSearchCrew ;
public ArrayList<Crew> getListOfSearchCrew() {
return listOfSearchCrew;
}
public void setListOfSearchCrew(ArrayList<Crew> listOfSearchCrew) {
this.listOfSearchCrew = listOfSearchCrew;
}
//business logic goes here to add listofcrew
}
ここで私の乗組員クラス...
パブリック クラス クルー {
private String staffNum;
private String surName;
private Integer age;
private String rank;
private Character type;
private String scExpiry;
private Long mailBoxNo;
}
@Akselwillgert 以下のプライベート ArrayList listOfCrew として乗組員リストをロードしています。プライベート ArrayList listOfSearchCrew ;
public void loadCrew()
{
listOfCrew = new ArrayList<Crew>();
listOfCrew.add(new Crew("000212", "HATHELY", 70, "CPT",'T',"13.03.2013",Long.parseLong("1012")));
listOfCrew.add(new Crew("000213", "MIKE", 52, "F/O",'T',"14.03.2013",Long.parseLong("1013")));
listOfCrew.add(new Crew("000214", "JOHN", 45, "S/O",'T',"15.03.2013",Long.parseLong("1014")));
listOfCrew.add(new Crew("000215", "NOTE", 35, "CPT",'T',"16.03.2013",Long.parseLong("1015")));
listOfCrew.add(new Crew("000216", "KARTHIK", 27, "CPT",'T',"17.03.2013",Long.parseLong("1016")));
listOfCrew.add(new Crew("000217", "JESSIE", 30, "PUR",'C',"18.02.2013",Long.parseLong("1017")));
listOfCrew.add(new Crew("000218", "LISSA", 29, "F/A",'C',"19.02.2013",Long.parseLong("1018")));
listOfCrew.add(new Crew("000219", "MARKUS", 40, "CPT",'T',"13.03.2013",Long.parseLong("1019")));
listOfCrew.add(new Crew("000220", "JONTHAN", 46, "F/O",'T',"13.03.2013",Long.parseLong("1020")));
listOfCrew.add(new Crew("000221", "BATMAN", 33, "S/O",'T',"13.03.2013",Long.parseLong("1021")));
}
まだ同じ問題に直面しています...
@ManagedBean(name="searchCrewBean")
public class SearchCrewBean {
private SearchCrew searchCrewParam;
}
public class SearchCrew {
private String staffNum;
private String surName;
private String rank;
//getters and setters goes here..
}