我在我的项目中使用数据表行扩展。我有一个主面板网格,<p:rowExpansion>
我在主面板网格中有几个面板网格。我正在将输入文本(位于主面板网格中的值)正确地传递给 bean。但是我无法将其他输入文本值(位于其他面板网格中)转换为 bean。当我将值保存到我的 oracle 数据库时,我得到空结果。
evmSaveRecord.xhtml
<h:form id="form_2" enctype="multipart/form-data">
<p:dataTable var="questions" value="#{EVMView.loadQuestions(EVMView.strSO,allHeaders)}" id="mydatatable2" rowExpandMode="single">
<p:ajax event="rowToggle" rendered="answerText" update="answertype_menu" listener="#{EVMView.onRowToggle}"/>
<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,questions.question_ID)}" 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:panelGrid columns="2" id="panelwv2" rendered="#{EVMView.visibleParam1}">
<p:outputLabel for="param1" value="#{EVMView.param1Name}"/>
<p:inputText id="param1" value="#{EVMView.param1}"/>
</p:panelGrid>
<p:panelGrid columns="2" id="panelwv3" rendered="#{EVMView.visibleParam2}">
<p:outputLabel for="param2" value="#{EVMView.param2Name}"/>
<p:inputText id="param2" value="#{EVMView.param2}"/>
</p:panelGrid>
<p:panelGrid columns="2" id="panelwv4" rendered="#{EVMView.visibleParam3}">
<p:outputLabel for="param3" value="#{EVMView.param3Name}"/>
<p:inputText id="param3" value="#{EVMView.param3}"/>
</p:panelGrid>
<p:panelGrid columns="1" id="panelwv1" closable="true" toggleable="true" widgetVar="panel_wv1">
<h:form>
<p:fileUpload listener="#{fileUploadView.handleFileUpload}" mode="advanced" dragDropSupport="false"
multiple="true" sizeLimit="1000000" fileLimit="3"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/>
</h:form>
</p:panelGrid>
<p:commandButton value="Save EVM Record" style="width:35%;">
<p:ajax listener="#{EVMView.saveRecord()}" update="growl answertype_menu"/>
</p:commandButton>
</p:panelGrid>
</p:rowExpansion>
</p:dataTable>
</h:form>
EVMView.java
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;
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;
}
我正在像这样将值保存到我的 oracle 数据库中
this.evmParameters.setParamValue(getParam1());
evmService.saveParameter(evmParameters);
但是当我打开我的数据库表时,参数值为null。是关于主面板网格中的面板网格吗?