Hey Joe,
Here's what im trying to do and maybe you have a different way to approach
it.
I have a datatable with a couple of columns, user & queue. I load the table
using the Get statement. I would like the user to be able to click on either
the user or queue fields (would become links I guess). Once they make there
clicking selection, a new webpage would be called passing the value of what
they clicked.
So...
Tim 100
Joe 200
John 634
Dave 343
If the user clicks on Joe, I would want them to be directed to users.jsp
page with "joe" as a parm that I will get and process in my oncontruction
function. If they click on 634, I would like them to be directed to
queue.jsp with 634 as a parm.
What do you think?
-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Joe Pluta
Sent: Tuesday, January 08, 2008 10:30 AM
To: 'Web Enabling the AS400 / iSeries'
Subject: Re: [WEB400] EGL onprerender function using Forward statement issue
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.