使用h:commandLink重置表单

时间:2015-08-15 21:19:33

标签: jsf jsf-2.2

我可以使用而不是<h:commandButton value="Reset" class="link" type="reset" />

此代码重置表单值?

<h:commandLink value="Reset" class="link" type="reset" style="margin: 20px;">
   <f:ajax execute="@form" render="@form"/>
</h:commandLink>

1 个答案:

答案 0 :(得分:0)

h:commandLinkh:commandButton的行为不同type="reset",因为h:commandLink属性type定义了此超链接指定的资源的内容类型(例如{ {1}})。

使用此代码:

text/ html, image/gif

输入值将被提交。这不是你想要的。