?? boardssave.java
字號(hào):
package com.laoer.bbscs.web.action;
import com.laoer.bbscs.web.form.*;
import com.laoer.bbscs.web.servlet.*;
import com.laoer.bbscs.bean.*;
import com.laoer.bbscs.sys.*;
import org.apache.struts.action.*;
import javax.servlet.http.*;
/**
* <p>Title: TianYi BBS</p>
* <p>Description: TianYi BBS System</p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: LAOER.COM/TIANYISOFT.NET</p>
* @author laoer
* @version 6.0
*/
public class BoardsSave
extends BaseAction {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) {
ActionErrors errors = new ActionErrors();
BoardsSaveForm form = (BoardsSaveForm) actionForm;
UserCheck uc = this.getUserCheck(httpServletRequest, httpServletResponse,
Constant.MESSAGE.getMessage(
httpServletRequest.getLocale(),
"left.treasureup"));
if (uc.isGuest()) {
errors.add("error.pleaselogin", new ActionError("error.pleaselogin"));
saveErrors(httpServletRequest, errors);
LoginForm loginForm = new LoginForm();
loginForm.setTourl(SysUtil.getToURL(httpServletRequest,
"boardsSave" + Constant.FILEPREFIX));
/*
loginForm.setTourl(SysUtil.encodeURL("boardsSave" + Constant.FILEPREFIX,
Constant.CHARSET));*/
httpServletRequest.setAttribute("loginForm", loginForm);
//return actionMapping.findForward("login");
return SysUtil.getPassLogin(actionMapping);
}
UserInfo ui = this.getUserCache().getUserInfoFromCache(uc.getId());
if (ui == null) {
errors.add("error.getusererror", new ActionError("error.getusererror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
httpServletRequest.setAttribute("uc", uc);
httpServletRequest.setAttribute("ui", ui);
if (form.getAction().equals("show")) {
form.setAction("save");
httpServletRequest.setAttribute("boardsSaveForm", form);
return actionMapping.findForward("boardssave");
}
if (form.getAction().equals("save")) {
if (form.getZc() != null && form.getZc().length > 0) {
StringBuffer sb = new StringBuffer();
int len = form.getZc().length;
for (int i = 0; i < len; i++) {
sb.append(form.getZc()[i] + ",");
}
ui.setBoardSave(sb.toString());
ui = this.getUserInfoService().saveUserInfo(ui);
if (ui == null) {
errors.add("grzcerror", new ActionError("error.grzcerror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
this.getUserCache().putUserInfoInCache(ui);
ActionForward f = new ActionForward("/boardsSave" + Constant.FILEPREFIX, true);
return f;
}
else {
ui.setBoardSave("");
ui = this.getUserInfoService().saveUserInfo(ui);
if (ui == null) {
errors.add("grzcerror", new ActionError("error.grzcerror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
this.getUserCache().putUserInfoInCache(ui);
ActionForward f = new ActionForward("/boardsSave" + Constant.FILEPREFIX, true);
return f;
}
}
if (form.getAction().equals("saveb")) {
String myzc = ui.getBoardSave();
if (myzc == null) {
myzc = "";
}
if ( ("," + myzc).indexOf("," + form.getBid() + ",") != -1) {
errors.add("alreadyadd", new ActionError("error.grzc.alreadyadd"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
ui.setBoardSave(myzc + form.getBid() + ",");
ui = this.getUserInfoService().saveUserInfo(ui);
if (ui == null) {
errors.add("error.grzcerror", new ActionError("error.grzcerror"));
saveErrors(httpServletRequest, errors);
return actionMapping.findForward("error");
}
this.getUserCache().putUserInfoInCache(ui);
ActionForward f = new ActionForward(SysUtil.getResultUrl("succeed.jrzc",
"forum" + Constant.FILEPREFIX + "?bid=" + form.getBid()), true);
return f;
}
return actionMapping.findForward("error");
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -