📄 producthandler.java
字号:
package controller;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.*;import model.*;import java.util.*;public class ProductHandler extends ActionForm { private int selId; private String tf, rbg, button3, tf1, button1; private Order order, order1; public String getTf1() { return tf1; } public void setTf1(String tf1) { this.tf1 = tf1; } public List<Order> getSelOrder() throws Exception { return OrdersBean.findUser(tf1); } public String getButton1() { return button1; } public void setButton1(String button1) { this.button1 = button1; } public Order getOrder() { return order; } public void setOrder(Order order) { this.order = order; } public Order getOrder1() { return order1; } public void setOrder1(Order order1) { this.order1 = order1; } public String getTf() { return tf; } public void setTf(String tf) { this.tf = tf; } public String getRbg() { return rbg; } public void setRbg(String rbg) { this.rbg = rbg; } public String getButton3() { return button3; } public void setButton3(String button3) { this.button3 = button3; } public int getSelId() { return selId; } public void setSelId(int selId) { this.selId = selId; System.out.println(selId); } public Product getSelProduct() throws Exception { return ProductsBean.find(selId); } public List<Product> getList() throws Exception { return ProductsBean.getList(); } public List<Product> getProducts() throws Exception { return ProductsBean.findAll(); } /* public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (tf.equals("")) { errors.add("Quantity", new ActionMessage("errors.required", "Quantity")); } if (rbg.equals("")) { errors.add("product", new ActionMessage("errors.required", "product")); } if (tf.startsWith("-")) { errors.add("non-negative", new ActionMessage("errors.invalid", "non-negative")); } if (tf.startsWith("0")) { errors.add("non-zero", new ActionMessage("errors.invalid", "non-zero")); } if (!tf.matches("\\d+")) { errors.add("quantity", new ActionMessage("errors.integer", "quantity")); } if (tf1.equals("")) { errors.add("username", new ActionMessage("errors.required", "username")); } return errors; }*/}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -