src/java/br/org/catolicasc/fcgf/projprog4/web/cmds/ProductCRUDCmd.java
//Para criar a view de Create

Para criar a view de Create
Para criar a view de Create
public String create(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        setCmdName(request);
        EntityManagerFactory factory = EntityManagerFactoryManager.getEntityManagerFactory();
        CategoryDAO dao = new CategoryDAO(factory);
        List<FieldData<Category>> fields = new ArrayList<>(6);
        fields.add(new FieldData<>(NOME, null, false, null, Type.TEXT));
        fields.add(new FieldData<>(DESCRIPTION, null, false, null, Type.TEXT));
        fields.add(new FieldData<>(PRICE, null, false, null, Type.NUMBER));
        fields.add(new FieldData<>(CATEGORY, null, true, dao.findAll(), Type.TEXT));
        request.setAttribute(FIELDS, fields);
        setName(request);
        return CREATE_PATH;
    }
public String create ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { setCmdName ( request ) ; EntityManagerFactory factory = EntityManagerFactoryManager . getEntityManagerFactory ( ) ; CategoryDAO dao = new CategoryDAO ( factory ) ; List < FieldData < Category > > fields = new ArrayList < > ( 6 ) ; fields . add ( new FieldData < > ( NOME , null , false , null , Type . TEXT ) ) ; fields . add ( new FieldData < > ( DESCRIPTION , null , false , null , Type . TEXT ) ) ; fields . add ( new FieldData < > ( PRICE , null , false , null , Type . NUMBER ) ) ; fields . add ( new FieldData < > ( CATEGORY , null , true , dao . findAll ( ) , Type . TEXT ) ) ; request . setAttribute ( FIELDS , fields ) ; setName ( request ) ; return CREATE_PATH ; }
Para criar a view de Create
Para criar a view de Create