@RequestMapping(method = RequestMethod.PUT, value = "/workers/{id}") public ModelAndView update(@PathVariable final Long id, @Valid Worker entity, Errors errors, NativeWebRequest request) { ModelAndView model = new ModelAndView(); entity.setId(id); if (errors.hasErrors()) { model.addObject("entity", entity); model.addObject("errors", errors); model.setViewName(names.provideViewName(Pages.EDIT)); } else { System.out.println("upd-done"); service.update(entity); model.setViewName("redirect:/workers/" + entity.getId()); model.addObject(entity); } return model; }
public void onResponse(String response) { Log.d("2pg",response); Toast.makeText(getApplicationContext(),response,Toast.LENGTH_LONG).show(); recyclerView = (RecyclerView) findViewById(R.id.recyclerView); //recyclerView.setAdapter(new CardAdapter(listWorkers, this)); recyclerView.setHasFixedSize(true); layoutManager = new LinearLayoutManager(getApplicationContext()); recyclerView.setLayoutManager(layoutManager); //Finally initializing our adapter adapter = new CardAdapter(listWorkers, getApplicationContext()); recyclerView.setAdapter(adapter); getData(); } public void getData(){ Worker worker=new Worker(); worker.setImageUrl("http://vorkal.com/images/vorkal_cover.PNG"); worker.setName("name"); worker.setLocation("location"); worker.setRating(5); worker.setId(1); worker.setPhone(784512369); worker.setOccupation("occupation"); worker.setPrice(20); worker.setReview("Review"); listWorkers.add(worker); adapter.notifydatasetchanged() }