How to assign text to variable after constant time through form?
<p>I need to assign a string value to a variable through a form, 10 seconds after, the form is processed.</p>

<p>Everything works, but how to make the form return when pressing submit?</p>

<p>Here is my code:</p>

<pre><code>&lt;h:body&gt;
&lt;script type="text/javascript"&gt;
    setInterval(function () {
        $("#text").load("/x");
    }, 1000);
&lt;/script&gt;
&lt;h:form&gt;
    &lt;h:inputText value="#{indexBean.text}"/&gt;
    &lt;h:commandButton value="Ok" action="#{indexBean.storeText()}"/&gt;
&lt;/h:form&gt;
&lt;h:panelGroup layout="block" id="text"/&gt;
</code></pre>

<p></p>

<pre><code>    public void storeText(final String text) {
    new Runnable() {
        @Override
        public void run() {
            try {
                Thread.sleep(10000);
                setText(text);
            } catch (InterruptedException e) {
                e.printStackTrace();
        }
    }.run();
}
</code></pre>

<p>Any suggestions?</p>
