ch10_04.java

来自「learn to use eclipse by example」· Java 代码 · 共 42 行

JAVA
42
字号
package org.eclipsebook.ch10;

import org.eclipsebook.ch10.Ch10_06;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;

public class Ch10_04 extends Action 
{
    public ActionForward execute(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)
	throws Exception {

        ActionErrors actionerrors = new ActionErrors();
                
        Ch10_06 orderForm = (Ch10_06)form;
        
        String email = orderForm.getEmail();        
        if(email.trim().equals("")) {
            actionerrors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.noemail"));
        }
        
        String type = orderForm.getType();        
        if(type.trim().equals("")) {
            actionerrors.add("ActionErrors.GLOBAL_ERROR", new ActionError("error.notype"));
        }
        
        String[] items = orderForm.getItems();        
        if(items == null) {
            actionerrors.add("ActionErrors.GLOBAL_ERROR", new ActionError("error.noitems"));
        }
            
        if(actionerrors.size() != 0) {            
            saveErrors(request, actionerrors);
            return new ActionForward(mapping.getInput());            
        }

        return mapping.findForward("OK");
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?