我在备用bean中有此方法,当用户单击底部时,将调用此方法以获取值并在数据库中更新这些值。
public String doApproverActionSendForAwardTeam() {
IIMDelegate iimDelegate = new IIMDelegate();
try {
if (isUpdateMode) {
addIdeaDto.setIdeaId(hiddenIdeaId);
addIdeaDto.setSendForAwardNotes(addIdeaDto.getSendForAwardNotes());
addIdeaDto.setStatusCode(7);
if (addIdeaDto.getSendForAwardNotes() == null) {
addInformationMessage("enter the note...");
return null;
}
iimDelegate.approverActionSendForAwardTeam(addIdeaDto);
addPointForApprover();
addInformationMessage(" Done ...");
return "goSearchIdeasApproverUI";
}
} catch (Exception e) {
e.printStackTrace();
addErrorMessage(" Error...");
}
return null;
}
问题是当我单击底部时,如果输入文本为空,则显示消息以输入值,而在输入值后,该消息保持不变,则显示并显示消息,这表示没有用于此输入和方法无法完成执行。
我确保值绑定正确,但是我不知道为什么会这样发生,这不是第一次使用信息消息。
这是jsp页面:
<tr>
<td><rich:panel>
<f:facet name="header">
<h:outputText value=" send idea "></h:outputText>
</f:facet>
<table>
<tr>
<td>
<table>
<tr>
<td width="80px" align="left"><h:outputLabel
value="note"></h:outputLabel></td>
<td width="5px"> </td>
<td><h:inputText id="notesId3" maxlength="100" style="width:700px"
value="#{ideaDetailsBean.addIdeaDto.sendForAwardNotes}"></h:inputText>
</td>
</tr>
</table>
</td>
</tr>
</table>
</rich:panel></td>
</tr>
<tr>
<td width="100%" align="center">
<table>
<td width="3px"><h:commandButton image="6.png" immediate="true"
action="#{ideaDetailsBean.doApproverActionSendForAwardTeam}">
</h:commandButton></td>
</table>
</td>
</tr>
addIdeaDto类:
public class AddIdeaDto {
private Long ideaId;
private Integer statusCode;
private String sendForAwardNotes;
public Long getIdeaId() {
return ideaId;
}
public void setIdeaId(Long ideaId) {
this.ideaId = ideaId;
}
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public String getSendForAwardNotes() {
return sendForAwardNotes;
}
public void setSendForAwardNotes(String sendForAwardNotes) {
this.sendForAwardNotes = sendForAwardNotes;
}
}
如果停留在该位置,则表示其值始终为空
if (addIdeaDto.getSendForAwardNotes() == null) {
addInformationMessage("enter the note...");
return null;}
即使我输入值,它也只显示信息消息,并指出在此方法之前,我没有在任何地方使用SendForAwardNotes