HI All,
DO any one have any clue about this probelm.......???
i am really stuck here.....
On Thu, Oct 16, 2008 at 3:33 PM, shekher awasthi
<[EMAIL PROTECTED]>wrote:
> Hi All,
>
> I am trying to integrate struts2 with YUI ,but facing some problems with
> this. I want that when my action get called by YUI it must return a
> arrayList of string which i must be able to handle using the YUI.
>
> For this i took the help of example from YUI site and able to hit the
> action
> but my problem is that how can i get the access to the arraylist which my
> action is populating when its execute methos is called .below i m pasting
> the code from my action calss as well as the YUI code.
> Plaese let me know how can i get this arraylist in my YUI code
> *
> YUI CODE*
>
> <div id="container"></div>
> <script type="text/javascript" language="javascript">
>
> var div = document.getElementById('container');
>
> var handleSuccess = function(o){
> alert("pass");
>
>
> if(o.responseText !== undefined){
> alert("test11");
>
> div.innerHTML = "<li>Transaction id: " + o.tId + "</li>";
> div.innerHTML += "<li>HTTP status: " + o.status + "</li>";
> div.innerHTML += "<li>Status code message: " + o.statusText +
> "</li>";
> div.innerHTML += "<li>HTTP headers: <ul>" + o.getAllResponseHeaders
> + "</ul></li>";
> div.innerHTML += "<li>Server response: " + o.getList().toString +
> "</li>";
> div.innerHTML += "<li>Argument object: Object ( [foo] => " +
> o.argument.foo +
> " [bar] => " + o.argument.bar +" )</li>";
> }
>
>
> }
>
> var handleFailure = function(o){
> alert("fail");
> YAHOO.log("The failure handler was called. tId: " + o.tId + ".",
> "info", "example");
>
> if(o.responseText !== undefined){
> div.innerHTML = "<ul><li>Transaction id: " + o.tId + "</li>";
> div.innerHTML += "<li>HTTP status: " + o.status + "</li>";
> div.innerHTML += "<li>Status code message: " + o.statusText +
> "</li></ul>";
> }
> }
>
> var callback =
> {
> success:handleSuccess,
> failure:handleFailure,
> argument: { foo:"foo", bar:"bar" }
> };
>
> var sUrl = "YUITestAction.action";
>
>
>
> function makeRequest(){
> alert("test");
>
> var request = YAHOO.util.Connect.asyncRequest('GET', sUrl, callback);
>
>
>
> }
> </script>
>
> *MY ACTION CLASS*
>
> public class YUITestAction extends ActionSupport{
>
> /**
> *
> */
> private static final long serialVersionUID = 1926031204500756104L;
> ArrayList<String> list=new ArrayList<String>();
> public String execute() throws Exception{
> System.out.println("inside the execute method");
>
> return SUCCESS;
> }
>
> public ArrayList<String> getList(){
>
> list.add("test1");
> list.add("test2");
> list.add("aum");
> list.add("arun");
> list.add("mannu");
> list.add("umesh");
>
> return list;
> }
> }
>
> any help in this regard is much appricaited
>
> --shekher
>