getcustomeraction.java
来自「struts的一些用的书籍」· Java 代码 · 共 36 行
JAVA
36 行
package app10a.action;
import app10a.to.AddressTO;
import app10a.to.CustomerTO;
import java.util.ArrayList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class GetCustomerAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception {
AddressTO address1 = new AddressTO();
address1.setStreetAddress("315 Avoca Street");
address1.setCity("Albany");
address1.setState("NY");
address1.setZipCode("12110");
ArrayList phones = new ArrayList(2);
phones.add("432 89894949");
phones.add("432 84839283");
address1.setPhones(phones);
CustomerTO customer = new CustomerTO();
customer.setContactPerson("Phillip Fry");
customer.setAddress(address1);
request.setAttribute("customer", customer);
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?