日期:2014-05-16 浏览次数:20342 次
<script language="javascript" type="text/javascript" src="/7e/js/util/jquery.js"></script> <!-- 添加jquery调用action --> <script type="text/javascript" language="javascript"> $(document).ready( function() { $.ajax({ url: "/7e/s/ajaxFindAllStudents.action", type: "POST", dataType:"json", success: function(data){ /* alert(data); */ $.each(data.studentList,function(i,value){ $("#ajaxtest").append("<table><tr><td>"+value.uid +"</td><td>"+value.username+"</td><tr></table>" ); }); }, error:function(){ alert("失败"); } }); }); </script> </head> <body> <div id="ajaxtest"> </div>
<package name="student" extends="json-default" namespace="/s"> <action name="ajaxFindAllStudents" class="studentAction" method="findAllStudent"> <result type="json"> <param name="excludeProperties">stdCourseService,studentService,courseservice,frontcoursebuy </param> </result> </action> </package> ----------------------action.java @Data private String studentList ; private List<Map> frontcoursebuy; private IStdCourseService stdCourseService; private IStudentService studentService; private ICourseservice courseservice; public String findAllStudent() { studentList = studentService.findAllStudent(); return SUCCESS; }