好的,我有这样的事情:
<a4j:form ignoreDupResponses="true">
<rich:tabPanel switchType="ajax" immediate="true" id="panelId">
<rich:tab label="Name" name="NAME" action="#{bean.clearData()}">
<h:inputText value="#{bean.value1}" required="true"/>
<h:inputText value="#{bean.value2}" required="true"/>
<rich:messages/>
<a4j:commandButton action="#{bean.someAction()}" value="OK"
reRender="panelId" />
</rich:tab>
<rich:tab label="Name2" name="NAME2">
<!-- Some content -->
</rich:tab>
</rich:tabPanel>
</a4j:form>
bean.someAction()
是一个保存在我的数据库value1
和value2
.
是一个通过 bean 清除和从 beanbean.clearData()
清除的函数,或者如果它已经保存在 DB 中则加载它。value1
value2
这是我的问题......当我输入value1
一些值,然后我value2
留空时,我会得到一些打印在<rich:messages/>
.
然后我切换到选项卡“Name2”,然后返回选项卡“Name1”,网页将显示 any 的旧值<h:inputText/>
,因为我执行bean.clearData()
的值在我的 bean 中是空的,而且它们甚至不在对话。
编辑:我的表单保留数据并且不清除它,即使它不再在 bean 中。
我能想到的只是浏览器缓存数据,并且我想避免在数据未保存在我的数据库中时加载数据。有谁知道如何解决这个问题?我在 h:inputText 中尝试了 autocomplete="off" ,但没有结果。
PS:使用火狐12.0