Servlets 如何从servlet响应到YUI?

Servlets 如何从servlet响应到YUI?,servlets,Servlets,我用YUI向服务器发送io,如何回复YUI? 以下是代码: var user = { userName: username, password: password, customerId: customerId }; var success = function (ioId, o) {

我用YUI向服务器发送io,如何回复YUI? 以下是代码:

var user = {
                   userName:   username,
                   password:   password,
                   customerId: customerId
                  };

           var success = function (ioId, o) {
               responseContent   = Y.JSON.parse(o.responseText);
               if (responseContent.code == 0) {
                     window.location = 'Home.jsp';
                  }
           };
           var failure = function (ioId, o) {
                 //do something
              };
           var cfg = {
                    method: 'GET',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                    sync: false,
                    data: user,
                    on:      {
                        'success': success,
                        'failure': failure
                     }
           };

           new Y.IO().send("http://localhost:7778/web/LoginController", cfg);

重定向无效,我决定由YUI重定向。谢谢

我不知道如何从servlet(不在页面中)将数据重新发送到页面。您能举个例子说明您想做什么吗?
var success = function (ioId, o) {
           responseContent   = Y.JSON.parse(o.responseText);
           if (responseContent.code == 0) {
                 window.location = 'Home.jsp';
              }


             //Like this?
             responseDiv.innerHTML = responseContent.yourData;
       };