?? postform.java
字號:
package mybbs;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import org.apache.struts.upload.FormFile;
public class PostForm
extends ActionForm {
private String theText, username, userid, c_title, c_content, action,
forumsid, topicid, postid, model, items;
private org.apache.struts.upload.FormFile theFile; //文件框?qū)?yīng)的是formFile類型
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getItems() {
return items;
}
public void setItems(String items) {
this.items = items;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getPostid() {
return postid;
}
public void setPostid(String postid) {
this.postid = postid;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getC_title() {
return c_title;
}
public void setC_title(String c_title) {
this.c_title = c_title;
}
public String getC_content() {
return c_content;
}
public void setC_content(String c_content) {
this.c_content = c_content;
}
public void setTopicid(String topicid) {
this.topicid = topicid;
}
public String getTopicid() {
return topicid;
}
public String getTheText() {
return theText;
}
public void setTheText(String theText) {
this.theText = theText;
}
public String getForumsid() {
return forumsid;
}
public void setForumsid(String forumsid) {
this.forumsid = forumsid;
}
public org.apache.struts.upload.FormFile getTheFile() {
return theFile;
}
public void setTheFile(org.apache.struts.upload.FormFile theFile) {
this.theFile = theFile;
}
public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
/**@todo: finish this method, this is just the skeleton.*/
/*if(!this.getTheFile().getContentType().equals("image/pjpeg")){
System.out.println("不是jpg");
}*/
//可以判斷類型
if (this.getTheFile().getFileSize() > 1000000) {
System.out.println("長度大于1000");
} //可以判斷大小
return null;
}
public void reset(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
username = null;
userid = null;
c_title = null;
c_content = null;
action = null;
forumsid = null;
topicid = null;
theText = null;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -