Answer the question
In order to leave comments, you need to log in
How to write an ajax request that returns an .xhtml page in JSF?
I am writing a project using JSF.
One of the .xhtml pages has the following table of users.
<ui:repeat value="#{UsersAction.usersList}" var="item">
<tr style="cursor: pointer;" onclick="javascript:load(#{item.id}, this)">
<td><h:outputText value="#{item.username}" /></td>
function load(id,e) {
console.log(id);
$.ajax({
type: 'POST',
url:'#{UsersAction.asyncLoadUser()}?id=' + id,
dataType: 'text',
success: function(data){
$("#table_div").html(data);
},
error : function(xhr, errmsg) {alert("No values found..!!");}
});
}
public String asyncLoadUser() {
loadUser = usersLogic.selectUserById(id);
return "editUser.xhtml";
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question