سؤال

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