You down with OOP? Yeah you know me!
Originally posted by Justin Fox:
I think when you use ajax, sessions won't work ... Inform me if I am wrong though.
Hi Bear,
Im also trying to send an arraylist object in request or session, using ajax call struts action is called. Just now i gone through your thread,
can you provide any sample code for how to set an array object in session and obtain it in jsp using ajax call.
As for as now ajax call is made to struts action and im in printwriter im printing my result and in javascript by using xmlhttp.responseText(), im getting it and using in jsp page.
In my application, im having select box, in it onchange event im calling ajax call and i have to return a array list and by using the list i have to paint a table using Display tag..
Please help me out in this...
Looking forward for your reply......
Please provide me some sample code....
Thanks and regards,
Prabhu.
Since JavaScript has no ArrayList, you need to use a JavaScript array, And since you can only send text as a response, you can't send it directly. The easiest way to send the data is to use an interchange format known as JSON, which looks like JavaScript literals.Im also trying to send an arraylist object in request or session, using ajax call struts action is called. Just now i gone through your thread,
can you provide any sample code for how to set an array object in session and obtain it in jsp using ajax call.
If "display tag" is a JSP action (tag) you are not going to be able to do that. Ajax is a JavaScript mechanism. You cannot cause JSP on a page to re-evaluate using Ajax. The page executed before it was sent to the browser and only a new request can cause a re-execution. That's the whole point of Ajax -- to be able to make requests without having to repaint the entire page.In my application, im having select box, in it onchange event im calling ajax call and i have to return a array list and by using the list i have to paint a table using Display tag..
Hi Bear,
Thank you for your info. I will post a new thread for my future post.
As you said, by using JSON we can get the array which is obtained using our struts action, in our jsp..... am i right...?
As you said by by using 'EVAL' function.....
I do not know much about JSON.... but i will read about it...But for now... im having an array list in my struts action.... and how to set it in session and obtain it in jsp....
Please provide me the solution for this....
in your older post you have said that, we can obtain a session in our jsp page which is set in our action class, by using JSON.....
I need sample code for that.....
It would be helpful for me, but i wont stop here and go through JSON and know about it... its sure.... Mr.Bear...
Looking forward for your reply...
Regards,
Prabhu.
No differently than when not using Ajax. From the server point of view there is no difference between a full-page request and an Ajax request. You can use the same server-side mechanisms regardless of how the request was initiated.for now... im having an array list in my struts action.... and how to set it in session and obtain it in jsp....
No, I didn't say that. I said that the session is available to server-side resources regardless of whether Ajax is being used or not.in your older post you have said that, we can obtain a session in our jsp page which is set in our action class, by using JSON.....
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |