Hi guys, I'm currently taking a unit where we're using Netbeans. In one of my tutes, we were asked to just do a simple form that takes 2 integers as input and then outputs the result after the user clicks on a button.
The following is the code for the form which my lecturer provided:
<f:view>
<h:form id="AddForm">
<h:inputText id="First" value="#{First}"/>
+
<h:inputText id="Second" value="#{Second}"/>
<h:commandButton id="submit" action="Success" value="="/>
<% Sum = First + Second; %>
<h:outputText id="Sum" value="#{Sum}"/>
</h:form>
</f:view>
The problem is with this line:
<h:outputText id="Sum" value="#{Sum}"/>
As it is, the form will not display the variable "Sum", which is the result of adding "First" and "Second". In fact, it displays nothing.
However, when changed to this:
<h:outputText id="Sum" value="#{First + Second}"/>
The result is displayed.
Could anybody please tell me why it is like this?
> 1