Reputation: 1297
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
Upvotes: 0
Views: 1088
Reputation: 1108632
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
.
Upvotes: 2