In JSF how to hide resultBean until doAction executed?
I am adding a web service into JSF page. The page should take some input and give some output after the submit button clicked. My problem is that before the button clicked there is a empty from displayed on the page. I want know how to hide it if the form is em开发者_如何学编程pty.
The following is my jsp code
<h:form styleClass="form" id="form1">
<table>
<tbody>
<tr>
<td align="left">Number:</td>
<td><h:inputText styleClass="inputText" id="trainNumber1"
value="#{xxx_PortType_Display.paramBean.Request.Number}">
</h:inputText></td>
</tr>
</tbody>
</table>
<hx:commandExButton id="buttonDoAction1" styleClass="commandExButton"
type="submit" value="Submit"
action="#{xxx_PortType_Display.doAction}">
</hx:commandExButton>
<table>
<tbody>
<tr>
<td align="left">Result:</td>
<td><h:outputText styleClass="outputText" id="quotaCount1"
value="#{xxx_PortType_Display.resultBean.result}">
</h:outputText></td>
</tr>
</tbody>
</table>
</h:form>
I don't want to “Result:” displayed before the doAction execute/button clicked.
Thanks
Use the rendered
attribute.
<h:panelGroup rendered="#{not empty xxx_PortType_Display.resultBean.result}">
<table>
<tbody>
<tr>
<td align="left">Result:</td>
<td><h:outputText styleClass="outputText" id="quotaCount1"
value="#{xxx_PortType_Display.resultBean.result}">
</h:outputText></td>
</tr>
</tbody>
</table>
</h:panelGroup>
Output result: via outputText and use rendered attribute on it. Even better, put whole part with result into some component and set rendered on that component.
精彩评论