日期:2014-05-16  浏览次数:20321 次

关于Java servlet接收Ext参数的问题
刚学Ext遇到一个问题:
这里是我的javascript代码:
Ext.onReady( function (){
 
  Ext.Ajax.on('requestcomplete',function (_conn,_response,_options){
  alert(_response.responseText);
  });
//Ext.Ajax.request({url:'servlet/AjaxServer',method:'GET',params:{name:'张三',age:'123'}});
var xml = '<?xml version="1.0" encoding="UTF-8"?>';
xml += '<params>';
xml += '<param>';
xml += '<name>';
xml += '张三';
xml += '</name>';
xml += '</param>';
xml += '</params>';


  Ext.Ajax.request({url:'servlet/AjaxServer',method:'POST',xmlData:xml});
  });
也就是说我在页面中拼接了一段XML参数传递到了AjaxServer这个Servlet上,可是我现在怎么才能在servlet中获取到这段提交上来的参数呢?request.getParamet ? 还是该怎么写才对


还有谁有Ext Java方向的教程的,能不能发到我邮箱来,或者是发个链接。
邮箱地址是:710571977@qq.com

------解决方案--------------------
Java code
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        BufferedReader reader = req.getReader();
        String s = "";
        StringBuilder sb = new StringBuilder();
        while ((s = reader.readLine()) != null) {
               sb.append(s);
        }
        System.out.println(sb.toString());
    }