From: tim

I set up an ajax request which triggers the onprerender function. In that
function I have:

forward to URL
"http://localhost:9080/site/page2.faces?userid=";
+ useridh;

It doesn't work, and doesn't show any errors that might lead me to why.

If you put the Forward To in a separate function and invoke it from a
command button, it works file.

Anyone know of issues with the forward statement within the onprerender
function?

I haven't done this specifically, Tim, but I can see why it might not work.
An Ajax request causes the browser to request a chunk of HTML which is then
used to refresh a portion of the current page. This is completely different
from a standard HTTP POST request, which happens when you click on a submit
button. When the browser executes a POST, it expects to completely replace
the current contents with the next request.

So, you're initiating a refresh request, but then sending a whole new page
of data. The browser looks at the incoming data and can't figure out what
to do with it because it's not in the correct format, and probably just
throws it away.

It would probably help from a debug standpoint if an Ajax refresh would
notify you when an invalid stream was received, but for now, you're
basically telling the system to do something it doesn't know how to do.

I would say that the easiest way to force this behavior is to send the
actual refresh with a hidden field that says you need a redirect. Have the
JavaScript on the page check that field after the response and if it is set,
click on the command button that you mentioned.

It's sort of brute force, but it's the only way I can think of off the top
of my head, and it should work.

Joe


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.