我是 jsf 的新手,正在做以下事情:例如,我要求用户填写表格,然后提交。提交后,我想显示提交是否成功。为此,我创建另一个 html 页面,并在提交后,如果成功,我将页面重定向到这个新的成功 html 页面。所以,我的项目中有很多网页。我的问题是,这是一件坏事吗?除了创建许多“成功”页面之外,还有其他解决方案可以尝试吗?这是我的做法:
<h:form>
<h:panelGrid columns="2">
<h:outputText value="Select one:"></h:outputText>
<rich:select defaultLabel="Select..." value="#{account.accountCurrency}" >
<f:selectItem itemValue="a" itemLabel="a" />
<f:selectItem itemValue="b" itemLabel="b" />
<f:selectItem itemValue="c" itemLabel="c" />
</rich:select>
<h:commandButton value="Submit" action="#{selection.approve}" ></h:commandButton>
</h:panelGrid>
</h:form>
在我的托管 bean 中,我执行以下操作:
public void approve() {
// check whether it is successful, then redirect to successful page
}
谢谢