直接上代码

 $(function(){
		var a = '';
		$.get("productType1_findAll.action",function(data){
		console.info(data);
			$.each(data.productTypeList,function(i,element){
			console.info(element.id);
				 a += "<a class='outer' href='goodsDetail_findGoods.action?producttype.id="+element.id+"'><span id='span1' class='inner'><b class='text'>"+element.productTypeName+"</b></span></a><br>"; 		
			})		;
		 $("#word1").html(a); 	
		},"json");
	}) ;

 

<div class="word" id="word1">							
  <a class="outer" href="#">
    <span id="span1" class="inner">
      <b class="text"></b>
    </span>
  </a> </div>

 acton方法

    public String findAll(){
		productTypeList=productTypeService.findAll(producttype);
		return "success";
	}

 dao实现类方法

@Override
    public List<Producttype> findAll(Producttype producttype) {    
        return hibernateTemplate.loadAll(Producttype.class);
    }

 

 posted on 2017-07-27 20:59  城管也会敲代码  阅读(507)  评论(0编辑  收藏  举报