By Valter Silva


2012-01-24 14:46:07 8 Comments

I have to stream a webcam video, so I use ustream to do that, which generate a flash embed code for me, and I have a button to turn off/on the light, but when I press the button it refresh the whole page and so the flash component.

There's some way to not refresh the page and still send to command ? Well for now it's this way:

        <h:form id="form_supervisory">
            <h:panelGrid>
                <h:column>
                    <iframe width="480" height="296" src="http://www.ustream.tv/embed/9599890" scrolling="no" frameborder="0" style="border: 0px none transparent;">    </iframe>
                    <h:commandButton value="Lâmpada" action="#{supervisoryc.invertBo}" />
                    <h:graphicImage value="#{supervisoryc.imageBo}" />
                </h:column>
            </h:panelGrid>
        </h:form>

1 comments

@BalusC 2012-01-24 14:49:29

Make use of Ajax. It's a matter of nesting <f:ajax> inside the command button of interest.

<h:commandButton ...>
    <f:ajax execute="@form" render="@none" />
</h:commandButton>

Particularly the render="@none" (which is the default value anyway, you could just omit the attribute altogether) will instruct JSF to re-render just nothing after the submit. If you intend to re-render only a specific component instead of the whole page, then you could also specify the ID of that specific component in render attribute.

<h:commandButton ...>
    <f:ajax execute="@form" render="result" />
</h:commandButton>
<h:panelGroup id="result">...</h:panelGroup>

See also:

@eskalera 2014-05-12 17:34:38

Thanks @BalusC. I thought <h:commandButton ajax="true"> was default though. But it doesnt' work without ajax tag. Any idea why?

@BalusC 2014-05-12 17:41:56

@eskalera: you're confusing standard JSF with PrimeFaces.

Related Questions

Sponsored Content

9 Answered Questions

[SOLVED] Check if page gets reloaded or refreshed in JavaScript

27 Answered Questions

[SOLVED] How can I refresh a page with jQuery?

13 Answered Questions

[SOLVED] Refresh a page using PHP

  • 2012-09-12 07:43:33
  • Aan
  • 919309 View
  • 134 Score
  • 13 Answer
  • Tags:   php refresh

8 Answered Questions

[SOLVED] append to url and refresh page

25 Answered Questions

[SOLVED] How to refresh Android listview?

2 Answered Questions

1 Answered Questions

2 Answered Questions

[SOLVED] How to enable/disable primefaces commandButton?

1 Answered Questions

Disable JSF page for few seconds on commandButton click

  • 2014-02-17 10:34:59
  • Priyatam Roy
  • 104 View
  • -1 Score
  • 1 Answer
  • Tags:   jsf commandbutton

1 Answered Questions

[SOLVED] How to make commandButton don't reload / refresh the page

  • 2013-10-29 13:01:15
  • Paladini
  • 4185 View
  • 0 Score
  • 1 Answer
  • Tags:   javascript ajax jsf

Sponsored Content