MVC构架
源代码在线查看: insertform.java
package addressbook.forms; import org.apache.struts.action.*; import javax.servlet.http.*; import addressbook.model.*; public class InsertForm extends ActionForm { private AddressBook addressBook=new AddressBook(); public void AddressBook(AddressBook addressBook) { this.addressBook=addressBook; } public AddressBook getAddressBook() { return this.addressBook; } public void setName(String name) { this.addressBook.setName(name); } public String getName() { return this.addressBook.getName(); } public void setPhone(String phone) { this.addressBook.setPhone(phone); } public String getPhone() { return this.addressBook.getPhone(); } public void setAddress(String address) { this.addressBook.setAddress(address); } public String getAddress() { return this.addressBook.getAddress(); } public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) { /**@todo: finish this method, this is just the skeleton.*/ return null; } public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) { this.addressBook=new AddressBook(); } }