Note that there are some explanatory texts on larger screens.

plurals
  1. POupdating an object in spring webflow not showing up on the UI
    primarykey
    data
    text
    <p>I'm really getting confused because I'm pretty new to this whole topic. I'm currently developing a project using spring webflow. In my webinterface a user has to type in a username that is than stored in a bean.</p> <p>The Form:</p> <pre><code> &lt;fieldset&gt; &lt;legend&gt;User Details&lt;/legend&gt; &lt;h:outputText value="Please enter the Name for your Broker: " /&gt; &lt;h:inputText id="brokerName" value="#{brokerBean.brokerName}"/&gt; &lt;h:outputText value="Please enter the password for your Broker: " /&gt; &lt;h:inputSecret id="password" value="#{brokerBean.password}"/&gt; &lt;/fieldset&gt; &lt;p:commandButton value="Register Broker" action="register" ajax="false"/&gt; </code></pre> <p>The according bean:</p> <pre><code>public class HumanBrokerBean implements Serializable{ /** The Constant serialVersionUID. */ private static final long serialVersionUID = 1L; /** The broker name. */ private String brokerName; /** The password. */ private String password; private double cashPosition = 0; ... getters &amp; setters... </code></pre> <p>After typing in the username the user is forwarded to the next page where his current <code>cashPosition</code> should be displayed and updated every 5 seconds, because the value might have changed (managed that with PrimeFaces poll). This is working so far.</p> <p>When the user has typed in his username and some other values he presses a button and a transition of the according flow is fired.</p> <pre><code>&lt;view-state id="view"&gt; &lt;transition on="register" to="mainpage"&gt; &lt;evaluate expression="brokerBean.checkCredentials(flowRequestContext)" /&gt; &lt;evaluate expression="connectionBean.connect(brokerBean.brokerName, brokerBean.password, brokerBean)" /&gt; &lt;/transition&gt; &lt;/view-state&gt; </code></pre> <p>And the method of the ConnectionBean:</p> <pre><code>public boolean connect(String username, String password, HumanBrokerBean brokerBean){ ConnectionService connection = new ConnectionService(); //if there have been problems while establishing the connection if(!connection.connect(username, password, this.serverConnection, byPass, brokerBean)){ return false; } //if connection was established return true; } </code></pre> <p>To update the values of the bean, I forwarded the bean object to some other class</p> <pre><code>public class ConnectionService { public boolean connect (String username, String password, String serverURL, boolean bypass, HumanBrokerBean brokerBean){ .... } } </code></pre> <p>When i try to outprint the variable-values of the bean object with</p> <pre><code>System.out.println("Brokername :"+brokerBean.getBrokerName()) </code></pre> <p>I'm getting the correct results. When I now try to update the <code>cashPosition</code> with</p> <pre><code>brokerBean.setCashPosition(); </code></pre> <p>The correct result is not displayed in my webinterface poll-section. The initial value of zero is returned always. </p> <p>As mentioned above, I implemented the polling function with primefaces-poll, which uses AJAX.</p> <pre><code>&lt;h:form&gt; &lt;h:outputText id="txt_cash" value="#{brokerBean.cashPosition}" /&gt; &lt;p:poll interval="3" update="txt_cash" /&gt; &lt;/h:form&gt; </code></pre> <p>And the AJAX response I always get... returns always 0.0, which is the initial value of the cashPosition of each Broker...</p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;partial-response&gt;&lt;changes&gt;&lt;update id="j_idt16:txt_cash"&gt;&lt;![CDATA[&lt;span id="j_idt16:txt_cash"&gt;0.0&lt;/span&gt;]]&gt;&lt;/update&gt;&lt;update id="javax.faces.ViewState"&gt;&lt;![CDATA[e1s2]]&gt;&lt;/update&gt;&lt;/changes&gt;&lt;extension primefacesCallbackParam="validationFailed"&gt;{"validationFailed":false}&lt;/extension&gt;&lt;/partial-response&gt; </code></pre> <p>For me that means, that there are two different instances of my <code>BrokerBean</code> but I'm not sure why. I think I will have to use some annotation in my bean, but I'm not sure which one. </p> <p>What would I need to do to make this scenario run?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload