문제

I have an "ajax execute"-tag embedded in a commandLink-Tag in my JSF-File, which works pretty well.

My problem: I want to execute this ajax-call directly by using a Get-Request.So far, I'm using only one html-file(index.html) without any parameters.

Is there any way to call an AJAX-tag directly by using url/get-parameters but keeping the ajax-tag in jsf?

Thanks guys

도움이 되었습니까?

해결책

To answer the question in your question title, "How to redirect to Ajax-call in JSF?", just add ?faces-redirect=true to the navigation case outcome.

public String submit() {
    // ...

    return "index?faces-redirect=true";
}

To answer the question in your question body, "I want to execute this ajax-call directly by using a Get-Request", replace the POST command link by a normal GET link <h:link> or <h:outputLink> wherein you pass the parameters as <f:param>.

<h:link value="link" outcome="index">
    <f:param name="foo" value="bar" />
</h:link>

They can be collected and processed in the target page by <f:viewParam> or @ManagedProperty.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top