Date and Time Data Type Elements

Asked

Viewed 79 times

0

Personal I would like to ask a question, we should treat differently fields that have as kind of data time and date I say in relation to the view, Why I have a problem I need to plot some date and time in a table in my view but the fields that are not date or time appear in a good already the fields that have as type time and date appear as Object

public static List<FolhaBean> bindingProperties(List<Folha> folhas) {

        List<FolhaBean> folhasBean = new ArrayList<>();

        folhas.forEach(folha -> {

            FolhaBean folhaBean = new FolhaBean(folha.getIdFolha(), folha.getData(), folha.getEntrada(), 
                    folha.getSaidaAlmoco(), folha.getVoltaAlmoco(),folha.getSaida(), folha.getBancoHoraNegativo()
                    , folha.getBancoHoraPositivo(), folha.getVersion(), folha.getNomeUsuario());

            folhasBean.add(folhaBean);
        });

        return folhasBean;
    }

this is the bean I’m using to bring the information

@RequestMapping(value = REDIRECT_PAGE_CARREGAR, method = RequestMethod.GET)
   public ModelAndView showCarregar(Model model, HttpServletRequest request){

        usuarioBean= folhaService.findFetchAll();


        model.addAttribute("usuarioBean", usuarioBean);


        return new ModelAndView(REQUEST_MAPPING_PAGE_CARREGAR);
    }

    @RequestMapping(value = "/carregarDados", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity<List<FolhaBean>> carregar() {

        List<Folha> folhas = folhaService.findFetchAll();

        List<FolhaBean> folhasBean = FolhaBean.bindingProperties(folhas);
        return new ResponseEntity<List<FolhaBean>>(folhasBean, HttpStatus.OK);
    }

and that’s the controller.

Fica assim

the code that generates the table is this

id="" data-url="${loadFola}" data-content-type="application/json" data-page-size="5" data-locale="en-BR" data-minimum-Count-Columns="2" data-show-toggle="true" data-toggle="table" data-click-to-select="true" data-Striped="true" data-show-Columns="" data-true-id-field="id"id"id"id" data-show-refresh="true" data-Toolbar="#Toolbar" data-query-params="paginar" data-select-item-name="" data-pagination="true" data-pagination-pre-text="Previous" date-pagination-next-text="Next" data-checkbox-header="false" data-search="true" data-Response-Handler="responseHandler"> id Check-in date Check-out Lunch Check-out Lunch Check-out Positive Bank Negative Bank User License

  • Can add problematic code snippet?

  • Objects of the type Date/Time usually require the call of a method format for display. It would not be the case?

  • so that’s my doubt I don’t know if you need a different treatment

  • How is it displayed in your view? Something like this: Tue Apr 11 13:41:42 GMT 2017?

  • then is currently presented as Object only

  • no date or time is shown

  • I don’t understand. Post a picture of the problem, preferably.

  • see that the id appears normal plus the fields that are date and time stands as Object

  • This seems to be an error in Javascript, not Java. What code generates this table?

  • i created an idea of dynamic table and not Statica table

  • Boy I managed to solve was just a problem of conversion I appreciate the attention

Show 6 more comments

1 answer

0


The problem has already been solved in the way I was accessing the object.

I was accessing the object directly, but after I took a look at the json I saw that I needed to access the object and then the attributes of that same object, ex usuario..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.