我在数据表中显示我的数据库数据。在行扩展中,我设置了一些值并将它们保存到数据库中。我在行扩展中有一个输入文本,当我提交表单时,输入文本的值在我的支持 bean 中返回null 。
<h:form id="form_2" enctype="multipart/form-data">
<p:panel>
<p:dataTable var="questions" value="#{EVMView.loadQuestions(EVMView.strSO)}" id="mydatatable2" rowExpandMode="single" editable="true">
<p:ajax event="rowToggle" rendered="answerText" update="answertype_menu" listener="#{EVMView.onRowToggle(questions.question_ID)}"/>
<p:column style="width:2rem">
<p:rowToggler/>
</p:column>
<p:column headerText="Question">
<h:outputText value="#{questions.questions}"/>
</p:column>
<p:rowExpansion>
<p:panelGrid columns="2" id="panelmain">
<p:outputLabel for="answertype_menu" value="Answer Type : "/>
<p:selectOneMenu id="answertype_menu" filter="true" filterMatchMode="contains" value="#{EVMView.selectedOption}" required="true" requiredMessage="Select Sales-Order" height="333">
<f:selectItem itemLabel="Select One" itemValue="" noSelectionOption="true"/>
<f:selectItems value="#{EVMView.options(EVMView.selectedModule)}" var="values" itemLabel="#{values.evmOption}" itemValue="#{values.evmOption}"/>
<p:ajax event="change" update="answerText" listener="#{EVMView.getAnswers}" rendered="answerText"/>
</p:selectOneMenu>
<p:outputLabel for="answerText" value="Answer:" />
<p:inputText id="answerText" value="#{EVMView.answer}" style="width:400px;" readonly="#{EVMView.readOnlyText}"/>
<p:outputLabel for="param1" value="#{EVMView.param1Name}" rendered="#{EVMView.visibleParam1}"/>
<p:inputText id="param1" value="#{EVMView.param1}" rendered="#{EVMView.visibleParam1}"/>
<p:outputLabel for="param2" value="#{EVMView.param2Name}" rendered="#{EVMView.visibleParam2}"/>
<p:inputText id="param2" value="#{EVMView.param2}" rendered="#{EVMView.visibleParam2}"/>
<p:outputLabel for="param3" value="#{EVMView.param3Name}" rendered="#{EVMView.visibleParam3}"/>
<p:inputText id="param3" value="#{EVMView.param3}" rendered="#{EVMView.visibleParam3}"/>
<p:fileUpload listener="#{fileUploadView.handleFileUpload}" mode="advanced" dragDropSupport="false"
multiple="true" sizeLimit="1000000" fileLimit="3"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/>
<p:commandButton value="Save EVM Record" action="#{EVMView.saveRecord}" process="@this" update="growl"/>
</p:panelGrid>
</p:rowExpansion>
</p:dataTable>
</p:panel>
</h:form>
我的后备豆的一部分
@ManagedBean(name="EVMView")
@ViewScoped
public class EVMView {
@EJB
private PublicService publicService;
@EJB
private EVMService evmService;
private EVMQuestions evmQuestions=new EVMQuestions();
@ManagedProperty(value = "#{loginBean}")
LoginBean loginBean;
private String strSO;
private List<SalesOrder> salesOrders;
private List<String> allModules;
private List<String> allHeaders;
private List<EVMQuestions> allQuestions;
private String selectedOption;
private List<EVMOptions> optionList;
private String answer;
private String selectedModule;
private String receivedAnswer;
private int questionID;
private boolean readOnlyText=true;
private String param1Name;
private boolean visibleParam1=false;
private String param1;
private String param2Name;
private String param2;
private boolean visibleParam2=false;
private String param3Name;
private String param3;
private boolean visibleParam3=false;
private String mySessionUsername;
private String mySessionFTEC;
private String savedDate;
private EVMResponses evmResponses;
private EVMParameters evmParameters;
private String engineType;
private String selectedHeader;
public String getParam3Name() {
return param3Name;
}
public void setParam3Name(String param3Name) {
this.param3Name = param3Name;
}
public String getParam3() {
return param3;
}
public void setParam3(String param3) {
this.param3 = param3;
}
public boolean isVisibleParam3() {
return visibleParam3;
}
public void setVisibleParam3(boolean visibleParam3) {
this.visibleParam3 = visibleParam3;
}
public boolean isVisibleParam2() {
return visibleParam2;
}
public void setVisibleParam2(boolean visibleParam2) {
this.visibleParam2 = visibleParam2;
}
public String getParam2Name() {
return param2Name;
}
public void setParam2Name(String param2Name) {
this.param2Name = param2Name;
}
public String getParam2() {
return param2;
}
public void setParam2(String param2) {
this.param2 = param2;
}
public String getParam1Name() {
return param1Name;
}
public void setParam1Name(String param1Name) {
this.param1Name = param1Name;
}
public boolean isVisibleParam1() {
return visibleParam1;
}
public void setVisibleParam1(boolean visibleParam1) {
this.visibleParam1 = visibleParam1;
}
public String getParam1() {
return param1;
}
public void setParam1(String param1) {
this.param1 = param1;
}
public boolean isReadOnlyText() {
return readOnlyText;
}
public void setReadOnlyText(boolean readOnlyText) {
this.readOnlyText = readOnlyText;
}
public int getQuestionID() {
return questionID;
}
public void setQuestionID(int questionID) {
this.questionID = questionID;
}
public String getReceivedAnswer() {
return receivedAnswer;
}
public void setReceivedAnswer(String receivedAnswer) {
this.receivedAnswer = receivedAnswer;
}
public List<String> getAllHeaders() {
return allHeaders;
}
public void setAllHeaders(List<String> allHeaders) {
this.allHeaders = allHeaders;
}
public String getSelectedModule() {
return selectedModule;
}
public void setSelectedModule(String selectedModule) {
this.selectedModule = selectedModule;
}
public String getAnswer() {
return answer;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public void saveRecord()
{
System.out.println(this.param1);
}
我不明白为什么我会得到null。