You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Kazim Raza <ka...@hotmail.com> on 2007/10/31 07:30:46 UTC
Problem while Requesting a .JSF page from Ajax Call
Hi,
"I want to request a JSF page within a JSF page as an AJAX Request using
Prototype."
I have done is:-
I am writing a JSF page say "welcome.faces" and after this page loads up I
am sending an Ajax Request Like
-- Used prototype.js here.
new Ajax.Request('another.faces',{method: 'post', onSuccess:
function(transport){
var str = transport.responseText;
$('anotherjsp').update();
$('anotherjsp').update(str);
}});
I have a div "anotherjsp" and i want to place the generated response from
the requested jsp into it. I am having the problem that the inner page that
i am requesting also contains the <f:view> tag so after the page is
requested and its response is rendered to div when i do some Ajax call from
that response it will give me alert message that "View state couldn't be
restored do u want to reload page". I have fixed that error by writing a
view Handler.
public UIViewRoot restoreView(FacesContext context, String viewId)
{
String base_view = "/welcome.jsp";/*(String)
((HttpServletRequest)context.getExternalContext().getRequest()).getAttribute("base_view_id")*/;
if (base_view != null) {
UIViewRoot parent = _viewHandler.restoreView(context,
base_view);
UIViewRoot child = _viewHandler.restoreView(context, viewId);
// Add the chile to the parent.
return parent;
}
return _viewHandler.restoreView(context, viewId);
}
It will restored the view but after that it stops giving that alert but did
not displaying the results of the Ajax call.
--
View this message in context: http://www.nabble.com/Problem-while-Requesting-a-.JSF-page-from-Ajax-Call-tf4723088.html#a13503596
Sent from the MyFaces - Users mailing list archive at Nabble.com.