src/java/br/org/catolicasc/fcgf/projprog4/web/cmds/CategoryCRUDCmd.java
//Para criar e voltar a view de List

Para criar e voltar a view de List
Para criar e voltar a view de List
public String makeAndList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        setCmdName(request);
        EntityManagerFactory factory = EntityManagerFactoryManager.getEntityManagerFactory();
        CategoryDAO categoryDao = new CategoryDAO(factory);
        String name = request.getParameter(NOME);
        Category category = new Category(name);
        categoryDao.create(category);
        request.setAttribute(MESSAGE, "Category created successfully.");
        return list(request, response);
    }
public String makeAndList ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { setCmdName ( request ) ; EntityManagerFactory factory = EntityManagerFactoryManager . getEntityManagerFactory ( ) ; CategoryDAO categoryDao = new CategoryDAO ( factory ) ; String name = request . getParameter ( NOME ) ; Category category = new Category ( name ) ; categoryDao . create ( category ) ; request . setAttribute ( MESSAGE , "Category created successfully." ) ; return list ( request , response ) ; }
Para criar e voltar a view de List
Para criar e voltar a view de List