JSP中获取ExtJS.Ajax前台传接的JSON数据

JSP中获取ExtJS.Ajax前台传递的JSON数据
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="java.io.BufferedReader" %>
    <%@ page import="net.sf.json.*" %>
 <%
 
 BufferedReader in=request.getReader();
 StringBuffer jsonStr=new StringBuffer();
 String str="";
 while((str=in.readLine())!=null){
	 jsonStr.append(str);
 }
 
 JSONObject jsonObj= JSONObject.fromObject(jsonStr.toString());
 String name= jsonObj.getString("userName");
 String pwd= jsonObj.getString("passWord");
 String msg="";
 if(name.equals("Tom")){
	 msg="登录成功";
 }else
 {
	 msg="登录失败";
 }
 
 response.getWriter().write(msg); 
 
 %>
JSON数据接收的特定过程。

必须的数据包:

      1.commons-lang.jar

      2.commons-beanutils.jar

      3.commons-collections.jar

      4.commons-logging.jar 

      5.ezmorph.jar

      6.json-lib-2.2.2-jdk15.jar



否则JSONObject  报错,并且不能接收。