📄 boardsavemanage.java
字号:
package com.laoer.bbscs.web.action;
import javax.servlet.http.*;
import org.apache.struts.action.*;
import com.laoer.bbscs.service.*;
import com.laoer.bbscs.web.form.*;
import com.laoer.bbscs.web.servlet.*;
import java.util.*;
import com.laoer.bbscs.bean.BoardSave;
import com.laoer.bbscs.comm.BBSCSUtil;
import org.apache.commons.lang.math.NumberUtils;
public class BoardSaveManage
extends BaseAction {
private BoardSaveService boardSaveService;
private BoardService boardService;
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
BoardSaveManageForm boardSaveManageForm = (BoardSaveManageForm) form;
UserSession us = this.getUserSession(request);
if (boardSaveManageForm.getAction().equalsIgnoreCase("index")) {
boardSaveManageForm.setAction("dels");
List bslist = this.getBoardSaveService().findBoardSavesByUid(us.getId());
List blist = this.getBoardService().findBoardsInIDs(this.getBoardIds(bslist));
request.setAttribute("blist", blist);
return mapping.findForward("boardSaveManage");
}
if (boardSaveManageForm.getAction().equals("dels")) {
ActionMessages messages = new ActionMessages();
if (boardSaveManageForm.getIds() == null || boardSaveManageForm.getIds().length == 0) {
messages.add("error.parametererror", new ActionMessage("error.parametererror"));
this.saveErrors(request, messages);
return mapping.findForward(this.FORWARD_ERROR);
}
try {
this.getBoardSaveService().removeBoardSaveByBidsUid(us.getId(),
this.getIdsList(boardSaveManageForm.getIds()));
return new ActionForward(BBSCSUtil.getActionMappingURL("/boardSaveManage"), true);
}
catch (Exception ex) {
messages.add("error.boardsave.del", new ActionMessage("error.boardsave.del"));
this.saveErrors(request, messages);
return mapping.findForward(this.FORWARD_ERROR);
}
}
return mapping.findForward(this.FORWARD_ERROR);
}
private List getBoardIds(List bslist) {
List blist = new ArrayList();
for (int i = 0; i < bslist.size(); i++) {
BoardSave bs = (BoardSave) bslist.get(i);
blist.add(new Long(bs.getBoardID()));
}
return blist;
}
private List getIdsList(String[] ids) {
List values = new ArrayList();
for (int i = 0; i < ids.length; i++) {
values.add(new Long(NumberUtils.toLong(ids[i], 0)));
}
return values;
}
public BoardSaveService getBoardSaveService() {
return boardSaveService;
}
public BoardService getBoardService() {
return boardService;
}
public void setBoardSaveService(BoardSaveService boardSaveService) {
this.boardSaveService = boardSaveService;
}
public void setBoardService(BoardService boardService) {
this.boardService = boardService;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -