在后台获取Jmesa中被选中的行(check=true)
程序员文章站
2022-04-05 14:44:55
...
/**
* To remove a AssayReturntypes
*
* @param request HttpServletRequest
* @param response HttpServletResponse
*/
@RequestMapping
public void removeStudys(HttpServletRequest request, HttpServletResponse response) {
WebContext webContext = new HttpServletRequestWebContext(request);
WorksheetState state = new SessionWorksheetState("studysTable", webContext);
Worksheet worksheet = state.retrieveWorksheet();
Collection<WorksheetRow> rows = worksheet.getRows();
List<Study> studys = new ArrayList<Study>();
StringBuffer buffer = new StringBuffer();
for (WorksheetRow row : rows) {
String idStr = row.getUniqueProperty().getValue();
Study study = new Study();
if(!StringUtils.isEmpty(idStr) && StringUtils.isNumeric(idStr)) {
study.setId(Integer.parseInt(idStr));
studys.add(study);
}
buffer.append(idStr);
}
if (!studyService.removeStudy(studys)) {
MessageUtils.outputJSONResult(buffer.toString(), response);
}
}
其中WorksheetState state = new SessionWorksheetState("studysTable", webContext);的studysTable为jmesa的id。