Keep struts-config.xml constant, convert dynamic form org.apache.struts.action.DynaActionform to an example of ActionForm

xiaoxiao2021-03-06  42

Very simple, you need to pay attention to: Integer State = new integer (2) in Formbean; this initialization and in the configuration file: is a conflict, the priority of the configuration file is higher, in fact, it is not worthy of the same assumption Struts-config.xml is original: only change the reference type: org.apache.struts.Action.DynaActionform, change to com.Message.MessageActionform This form is: import Org.apache.struts.Action.Actionform; import org.apache.struts.upload.formfile;

import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; import java.io *;. import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class MessageActionForm extends ActionForm {Integer state = new Integer (2); // here can be so written Integer state; you can Integer staffId; Integer deptId; String title; String messageContent; Boolean needReply = new Boolean (false); // Boolean needReply; can also write String messageId; Integer receiverId; Boolean reply; FormFile file1; FormFile file2; FormFile file3; log log = LogFactory.getLog (MessageActionForm.class); public MessageActionForm () {}

public void reset (ActionMapping mapping, HttpServletRequest request) {try {request.setCharacterEncoding ( "GBK");} catch (UnsupportedEncodingException ex) {log.info (, ex "encoding error!");}}

Public formfile getfile1 () {return file1;}

Public void setfile1 (Formfile file1) {this.file1 = file1;}

Public formfile getfile2 () {return file2;}

Public void setfile2 (formfile file2) {this.file2 = file2;}

Public Formfile getFile3 () {return file3;}

Public void setfile3 (formfile file3) {this.file3 = file3;}

Public string getMessageContent () {returnomecontent;}

Public void setMessageContent (String MessageContent) {this.MessageContent = messagecontent;

Public string getMessageId () {returnomeid;}

Public void setMessageId (string messageid) {this.MessageId = messageId;}

Public boolean getneedreply () {return needreply;}

Public void setneedreply (boolean needreply) {this.needreply = nesepid;

Public Integer GetRecEternalId () {Return ReceiverId;} {this.receiverid = received;

Public Boolean getReply () {return reply;}

Public void setReply (Boolean reply) {this.reply = reply;

Public integer getstaffid () {return staffId;}

Public void setstaffid (integer staffid) {this.staffid = staffId;}

Public integer getState () {returnide;}

Public void setState (Integer State) {this.State = state;}

Public string gettitle () {returnit;

Public void settitle (string title) {this.title = title;}}

转载请注明原文地址:https://www.9cbs.com/read-55115.html

New Post(0)