| 
 求助啊 function AjaxGetData( index, size) {
        $.ajax({
            url: "${pageContext.request.contextPath}/showAllProduct.do",
            type: "Get",
            data: "pagenum=" + index + "&pagesize=" + size,
            dataType: "json",
            success: function (json) {
                
                 var html = "";
                 html += "<table>";
                 html += "<thead>";
                 html += "<tr><td>商品编号</td><td>商品名</td><td>商品规格</td><td>计量单位</td><td>商品类别</td><td>产地</td><td>建议采购价格</td><td>建议销售价格</td><td>操作</td></tr>";         
                 html += "</thead>";
                 html += "<tbody>";      
               for(position in json){
	              	html += "<tr>";
	                html += "<td>"+json[position].productID+"</td>";
	                   html += "<td>"+json[position].name+"</td>";
	                   html += "<td>"+json[position].model+"</td>";
	                   html += "<td>"+json[position].baseunit+"</td>";
	                   html += "<td>"+json[position].type.type+"</td>";
	                   html += "<td>"+json[position].productAddress+"</td>"; 
	                   html += "<td>"+json[position].suggestPrice+"</td>"; 
	                   html += "<td>"+json[position].salePrice+"</td>"; 
	                   html+="<td><input type=""button"" value=""修改"" onclick=""update("+json[position].productID+")""/><input type=""button""value=""删除"" onclick=""deleteEmployee("+json[position].productID+")""/></td>";
	                   html += "</tr>";
               }
               html += "</tbody>";
              
              html += "<tfoot>";
              html += "<tr>";
              html += "<td colspan=""7"">";
              html += "<a href=""javascript:void"" onclick=""GoToFirstPage()"" id=""aFirstPage"" >首页   </a>";
              html += "<a href=""javascript:void"" onclick=""GoToPrePage()"" id=""aPrePage"" >上一页   </a>";
              html += "<a href=""javascript:void"" onclick=""GoToNextPage()"" id=""aNextPage"">下一页   </a>";
              html += "<input type=""text"" size=""4"" /><input type=""button"" value=""Jump"" onclick=""GoToAppointPage(this)"" /> ";
              html += "</td>";
              html += "</tr>";
              html += "</tfoot>";
              html += "</table>";
              //alert(html);
               $(""#result"").html("");
               $(""#result"").html(html);
                          
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                alert(XMLHttpRequest);
                alert(textStatus);
                alert(errorThrown);
            }
        });
    }
后台代码如下: 	@RequestMapping("/showAllProduct.do")
	public @ResponseBody List<Product> getAllProduct(String pagenum,String pagesize){
		int page = 0;
		int size = 0;
		if (pagenum == null || Integer.parseInt(pagenum) < 1){
			page = 1;
		}else{
			page = Integer.parseInt(pagenum);
		}
		if (pagesize == null || Integer.parseInt(pagesize) < 1){
			size = 1;
		}else{
			size = Integer.parseInt(pagesize);
		}
		List<Product> list = null;
		try{
			list = productService.getProducts(page, size);
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
		return list;
	}
 | 
|
10分  | 
  data: “pagenum=” + index + “&pagesize=” + size, 
dataType: “json”, success: function (json) { 参数是不是应该传data?  | 
10分  | 
 既然是500错误,那估计是你查数据库部分出错了,有空指针或者什么的 
 | 
| 
 不是,我debug了。后台查询到了数据。没有问题  | 
|
| 
 我在另外一个页面是可以使用的,没有问题。  | 
|
| 
 500是你后台中的代码存在问题,你看500的错误日志,断点查找很快可以找到! 
 | 
|
| 
 贴异常吧,看哪行报错  | 
|
 没有异常信息,这个ajax返回调用的是error方法,报的就是那个Internal Server Error  | 
|
10分  | 
 后台数据有转json格式? 
 | 
| 
 LZ 
Product这个bean里有没有空构造器??  | 
|
 后台使用的就是@ResponseBody?这个注解的。我在另外一个类里面是可以的  | 
|
 有的,我空的构造方法  | 
|
10分  | 
 奇怪啊,不知道怎么回事了, 
LZ多提供点信息吧  | 
| 
 请问lz这个问题解决了没有啊 我现在跟你遇到同样的问题 求解决方法啊 
 | 
|
| 
 我今天也遇到类似的问题了,好像是字段太多导致的? 
 | 
|
| 
 PECL json的版本太低 
(PHP 5 >= 5.2.0, PECL json >= 1.2.0)  | 
|
| 
 我也出现了这个问题,后来发现是从后台取到的数据有为null的值(但是前台没有引用到这个数据,不知道为什么还会报500错),设置之后就没有报错了 
 | 
|