?? customerfindallaction.java
字號:
package com.relationinfo.customertrace.struts.actions;
import org.apache.struts.*;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.*;
import java.math.*;
import com.relationinfo.customertrace.dao.*;
import com.relationinfo.customertrace.dto.*;
import com.relationinfo.customertrace.factory.*;
import com.relationinfo.customertrace.struts.forms.*;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionErrors;
public class CustomerFindAllAction extends Action
{
/**
* Method 'execute'
*
* @param mapping
* @param form
* @param request
* @param response
* @throws Exception
* @return ActionForward
*/
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
{
try {
// 解析參數(shù)
//創(chuàng)建Dao類
CustomerDao dao = CustomerDaoFactory.create();
// 執(zhí)行查詢
Customer dto[] = dao.findAll();
// 存儲結果
request.setAttribute( "result", dto );
return mapping.findForward( "success" );
}
catch (Exception e) {
ActionErrors _errors = new ActionErrors();
_errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage("internal.error", e.getClass().getName() + ": " + e.getMessage() ) );
saveErrors( request, _errors );
return mapping.findForward( "failure" );
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -