Vish
Vish

Reputation: 879

URL in popup JSF

i have following scenario first i need to send request to back end,that will return a URL..i need to open the URL in the popup.. i am confused for this

i have tried opening popup both using the prime-faces and web flow but i don't have clearly how to open popup using new url each time

we are using JSF, prime faces and spring webflow

Upvotes: 1

Views: 2408

Answers (1)

BalusC
BalusC

Reputation: 1109532

Use JavaScript's window.open function.

E.g.

<h:form>
    <h:commandButton value="Submit" action="#{bean.submit}">
        <f:ajax render="popup" />
    </h:commandButton>

    <h:panelGroup id="popup">
        <ui:fragment rendered="#{not empty bean.url}">
            <script>window.open('#{bean.url}');</script>
        </ui:fragment>
    </h:panelGroup>
</h:form>

with

private String url;

public void submit() {
    this.url = sendRequestToServiceAndRetrieveURL();
}

// ...

Upvotes: 2

Related Questions