-
Jan 12th, 2012, 06:07 AM
#1
Cannot seem to get all my data as JSON back from spring
Hi guys ,
Am new here so kindly bear with me. I am working on an extjs-spring-ibatis application .My problem is that while the data seems to get back from the ORM (ibatis in this case) I cannot seem to get spring to push it all out to the front end. Some of the columns of the data is not converted to JSON .
Here is the query output that I have obtained using the tail command:
2012-01-12 14:18:15,635 DEBUG [java.sql.Connection] - {conn-100007} Preparing Statement: select classes_id, classes_location, classes_name, classes_form, classes_size, students_registration_number, teachers_registration_number from Classes
The out out data is the following:
2012-01-12 14:18:15,640 DEBUG [java.sql.ResultSet] - {rset-100009} Result: [2, Quisque, FRM3A, FRM1, 30, U1P 3R8, O9O 3G4]
'
However only the last two columns are converted.The JSON output out of Firebug is only the following
2012-01-12 14:18:15,749 DEBUG [org.springframework.web.servlet.view.json.writer.s ojo.SojoJsonStringWriter] - {"count":30,"success":true,"results":[{"teachersRegistrationNumber":"O9O 3G4","studentsRegistrationNumber":"U1P 3R8"}]}
I cannot seem to find out what the issue is because it is pretty straight-foward code
public ModelAndView classList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
String strStart = request.getParameter("start");
String srtLimit = request.getParameter("limit");
String sortbyField = request.getParameter("sort");
String sortDirection = "DESC";
String orderbyField = "id ";
if (sortbyField != null && sortbyField.length() > 1) {
if (sortbyField.equalsIgnoreCase("id")) {
sortbyField = "id";
}
orderbyField = sortbyField;
}
int limit = 10;
int start = 0;
if (strStart != null) {
if (!strStart.equalsIgnoreCase("")) {
start = Double.valueOf(strStart).intValue();
}
}
if (srtLimit != null) {
if (!srtLimit.equalsIgnoreCase("")) {
limit = Double.valueOf(srtLimit).intValue();
}
}
int end = start + limit;
int classResultsCount = classesDao.countByExample(new ClassesExample());
Map<String, Object> params = new HashMap<String, Object>();
params.put("minRowToFetch", start);
params.put("maxRowToFetch", end);
params.put("orderbyField", orderbyField);
params.put("sortDirection", sortDirection);
List<Classes> classListResults = classesDao.selectByExample(new ClassesExample());
Map<String, Object> map = new HashMap<String, Object>();
map.put("success", true);
map.put("count", classListResults);
map.put("results", classResultsCount);
return new ModelAndView("jsonView",map);
} catch (Exception e) {
rreturn new ModelAndView(e);
}
}
.Any help would be greatly appreciated
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules