***Action extends BaseAction
<bean name="/school/teaching/getTeacherAppointment" class="com.**.school.teaching.action.TeacherAppointmentAction" singleton="false" >
<property name="learnRecordService">
<ref bean="learnRecordService" />
</property>
</bean>
public class TeacherAppointmentAction extends BaseAction {
private ILearnRecordService learnRecordService;
set,
get,
String schoolID = request.getParameter("schoolId");
String schoolCode = request.getParameter("school_code");
String dateIndex = request.getParameter("dateIndex");
writer = response.getWriter();
String json = JSONObject.fromObject(bean).toString();
// json = URLEncoder.encode(json, "UTF-8");
// System.out.println("origin_str = "+JSONObject.fromObject(bean).toString());
System.out.println("json = " + json);
writer .write(json);
}
learnRecordService以set,get的方式注入action中
返回json给前台,需要依赖外部jar包,通过response.getwriter()进行输出