<%-- 
    Document   : EntryAdmin
    Created on : 2013-5-2, 11:32:59
    Author     : root
    param:create update list get getsession delete
  

urlPath: /gcms/admin/entry/action/EntryAdminAction.jsp?act=update&id=null


--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page import="gcms.dao.Entry,gcms.dao.EntryFacade,gcms.dao. service.EntryEntryService"%>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Entry Admin Action</title>
    </head>
    <body>
        <h1>Entry Admin Action</h1>
        
        <%
        String action_path="/gcms/admin/entry/action/EntryAdminAction.jsp";
        String update_path="/gcms/admin/entry/EntryUpdate.jsp";
        String add_path="/gcms/admin/entry/EntryAddForm.jsp";
        String admin_path="/gcms/admin/entry/index.jsp";
        String view_path="/gcms/admin/entry/EntryView.jsp";
        String list_path="/gcms/admin/entry/list.jsp";
        
            String act=request.getParameter("act");
            
            if(act!=null&& act.contains("create")){
                EntryFacade facede=new EntryFacade();
                gcms.dao.Entry entry=facede.formToEntry_add(request);
                EntryEntryService dao=new EntryEntryService();
                dao.add(entry);
            }
            
              if(act!=null&& act.contains("update")){
                EntryFacade facede=new EntryFacade();
                gcms.dao.Entry entry=facede.formToEntry_add(request);
                EntryEntryService dao=new EntryEntryService();
                dao.add(entry);
                String toAdmin=action_path+"?act=admin";
                request.getRequestDispatcher(action_path).forward(request, response);
            }
           
            if(act!=null&& act.contains("delete")){
                EntryFacade facede=new EntryFacade();
                gcms.dao.Entry entry=facede.formToEntry_add(request);
                EntryEntryService dao=new EntryEntryService();
                dao.add(entry);
            }
            
            if(act!=null&& act.contains("get")){
                EntryFacade facede=new EntryFacade();
                gcms.dao.Entry entry=facede.formToEntry_add(request);
                EntryEntryService dao=new EntryEntryService();
                dao.add(entry);
            }
                        
            if(act!=null&& act.contains("getsession")){
                EntryFacade facede=new EntryFacade();
                gcms.dao.Entry entry=facede.formToEntry_add(request);
                EntryEntryService dao=new EntryEntryService();
                dao.add(entry);
            }
            
             if(act!=null&& act.contains("admin")){
                 EntryEntryService dbUtil=new EntryEntryService();
                 
                EntryFacade facede=new EntryFacade();
                
                String sql=" ";
                
               List<Entry> entryList=
                      dbUtil.getListAll();
                EntryEntryService dao=new EntryEntryService();
                
                request.setAttribute("entryList", entryList);
                
                 request.getRequestDispatcher(admin_path).forward(request, response);
        
                
            }
            
            
        %>
    </body>
</html>
