📄 postactionform.java
字号:
package com.laoer.bbscs.bbs.actionform;
import org.apache.struts.action.*;
import org.apache.struts.upload.*;
import javax.servlet.http.*;
import com.laoer.bbscs.sysinfo.*;
import com.laoer.bbscs.util.*;
public class PostActionForm
extends ActionForm {
private String action;
private String bid;
private String bq;
private String detail;
private String email_inform;
private FormFile form_data;
private String mainid;
private String msg_inform;
private String n;
private String pages;
private String recid;
private String sid;
private String sign;
private String title;
private String totalnum;
private String useedit;
private String inpages;
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getBid() {
return bid;
}
public void setBid(String bid) {
this.bid = bid;
}
public String getBq() {
return bq;
}
public void setBq(String bq) {
this.bq = bq;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public String getEmail_inform() {
return email_inform;
}
public void setEmail_inform(String email_inform) {
this.email_inform = email_inform;
}
public FormFile getForm_data() {
return form_data;
}
public void setForm_data(FormFile form_data) {
this.form_data = form_data;
}
public String getMainid() {
return mainid;
}
public void setMainid(String mainid) {
this.mainid = mainid;
}
public String getMsg_inform() {
return msg_inform;
}
public void setMsg_inform(String msg_inform) {
this.msg_inform = msg_inform;
}
public String getN() {
return n;
}
public void setN(String n) {
this.n = n;
}
public String getPages() {
return pages;
}
public void setPages(String pages) {
this.pages = pages;
}
public String getRecid() {
return recid;
}
public void setRecid(String recid) {
this.recid = recid;
}
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTotalnum() {
return totalnum;
}
public void setTotalnum(String totalnum) {
this.totalnum = totalnum;
}
public String getUseedit() {
return useedit;
}
public void setUseedit(String useedit) {
this.useedit = useedit;
}
public String getInpages() {
return inpages;
}
public void setInpages(String inpages) {
this.inpages = inpages;
}
public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
ActionErrors errors = new ActionErrors();
if (action.equals("add")) {
if (title == null) {
title = "";
}
title = title.trim();
try {
if (title == null || title.length() == 0 ||
title.getBytes(Sys.SYSINFO.CHARSET).length > 60) {
errors.add("titletoolong", new ActionError("error.post.titletoolong"));
}
}
catch (Exception e) {
System.out.println(e.toString());
}
title = Util.addSlashes(title);
title = Util.htmlEncode(title);
int bw = Util.checkWords(title);
if (bw != -1) {
errors.add("badwors",
new ActionError("error.post.badwors1",
(Util.getBadWordStrs())[bw]));
}
if (bq == null) {
bq = "1";
}
if (detail == null) {
detail = "";
}
detail = detail.trim();
if (detail.length() == 0) {
errors.add("nullerror", new ActionError("error.nullerror"));
}
try {
if (detail.getBytes(Sys.SYSINFO.CHARSET).length >
Sys.SYSINFO.POSTMAXSIZE * 1024) {
errors.add("texttoolong",
new ActionError("error.post.texttoolong",
String.valueOf(Sys.SYSINFO.POSTMAXSIZE)));
}
}
catch (Exception e) {
}
detail = Util.ScriptEncode(detail);
//detail = Util.addSlashes(detail);
bw = Util.checkWords(detail);
if (bw != -1) {
errors.add("badwors",
new ActionError("error.post.badwors1",
(Util.getBadWordStrs())[bw]));
}
if (email_inform == null || email_inform.length() == 0) {
email_inform = "0";
}
if (msg_inform == null || msg_inform.length() == 0) {
msg_inform = "0";
}
if (useedit.equals("no")) {
detail = Util.htmlEncode(detail);
detail = Util.addBr(detail);
}
}
if (action.equals("repost")) {
if (title == null) {
title = "";
}
title = title.trim();
try {
if (title == null || title.length() == 0 ||
title.getBytes(Sys.SYSINFO.CHARSET).length > 60) {
errors.add("titletoolong", new ActionError("error.post.titletoolong"));
}
}
catch (Exception e) {
System.out.println(e.toString());
}
title = Util.addSlashes(title);
title = Util.htmlEncode(title);
int bw = Util.checkWords(title);
if (bw != -1) {
errors.add("badwors", new ActionError("error.post.badwors1",
(Util.getBadWordStrs())[bw]));
}
if (bq == null) {
bq = "1";
}
if (detail == null) {
detail = "";
}
detail = detail.trim();
if (detail.length() == 0) {
errors.add("nullerror", new ActionError("error.nullerror"));
}
try {
if (detail.getBytes(Sys.SYSINFO.CHARSET).length >
Sys.SYSINFO.POSTMAXSIZE * 1024) {
errors.add("badwors",
new ActionError("error.post.texttoolong",
String.valueOf(Sys.SYSINFO.POSTMAXSIZE)));
}
}
catch (Exception e) {
}
detail = Util.ScriptEncode(detail);
bw = Util.checkWords(detail);
if (bw != -1) {
errors.add("badwors",
new ActionError("error.post.badwors1",
(Util.getBadWordStrs())[bw]));
}
//detail = Util.addSlashes(detail);
if (email_inform == null || email_inform.length() == 0) {
email_inform = "0";
}
if (msg_inform == null || msg_inform.length() == 0) {
msg_inform = "0";
}
if (useedit.equals("no")) {
detail = Util.htmlEncode(detail);
detail = Util.addBr(detail);
}
}
if (action.equals("change")) {
if (title == null) {
title = "";
}
title = title.trim();
try {
if (title == null || title.length() == 0 ||
title.getBytes(Sys.SYSINFO.CHARSET).length > 60) {
errors.add("titletoolong", new ActionError("error.post.titletoolong"));
}
}
catch (Exception e) {
System.out.println(e.toString());
}
title = Util.addSlashes(title);
title = Util.htmlEncode(title);
int bw = Util.checkWords(title);
if (bw != -1) {
errors.add("badwors", new ActionError("error.post.badwors1",
(Util.getBadWordStrs())[bw]));
}
if (bq == null) {
bq = "1";
}
if (detail == null) {
detail = "";
}
detail = detail.trim();
if (detail.length() == 0) {
errors.add("nullerror", new ActionError("error.nullerror"));
}
try {
if (detail.getBytes(Sys.SYSINFO.CHARSET).length >
Sys.SYSINFO.POSTMAXSIZE * 1024) {
errors.add("badwors",
new ActionError("error.post.texttoolong",
String.valueOf(Sys.SYSINFO.POSTMAXSIZE)));
}
}
catch (Exception e) {
}
detail = Util.ScriptEncode(detail);
bw = Util.checkWords(detail);
if (bw != -1) {
errors.add("badwors", new ActionError("error.post.badwors1",
(Util.getBadWordStrs())[bw]));
}
}
return (errors);
}
public void reset(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -