JSF Help (4)

1 Name: #!/usr/bin/anonymous : 2007-03-30 14:02 ID:sLSe65fU

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?

2 Post deleted by moderator.

3 Post deleted by moderator.

4 Name: #!/usr/bin/anonymous : 2007-04-06 02:25 ID:wVxA5Mlb

> 1
This thread has been closed. You cannot post in this thread any longer.