我正在使用JSF-2.2。我在强制输入字段中写了一个值。如果删除它,JSF会将旧值再次写入输入字段。我该如何删除或阻止它?
豆:
public class CommentBean{
@NotNull
@Getter
@Setter
private String comment;
}
XHTML:
<h:form>
<h:inputText value="#{commentBean.comment}">
<h:commandButton
styleClass="button"
value="Remove"
action="#{commentBean.save()}">
<f:ajax execute="@form" resetValues="true"/>
</h:commandButton>
</h:form>
的web.xml:
<context-param>
<param-name>
javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL
</param-name>
<param-value>true</param-value>
</context-param>