Marcio
Marcio

Reputation: 1733

How to filter the contents of a list?

I use two List data, one must call the other for parameter, but I can not implement a filter to the data you desire.

This contest is for this Listing:

   @RequestMapping(method=RequestMethod.GET, value="/listarReceita/{controle}/versoes")
public String listVersions(@PathVariable("controle") int controle, Map<String, Object> map) {

    map.put("versoesList", receitaService.getAllReceita());    

    return "listVersions";
}

But in this case, the result is the entire contents of the table. This is not what I want. What I want to see only the data with the content parameter passed in the case "control."

How could I solve this?

Thanks for the help.

Upvotes: 0

Views: 84

Answers (1)

Akash Yadav
Akash Yadav

Reputation: 2421

In order to recieve only the related values, you have to create a method in recietaService list getRecietaByControle(int controle) { } and implement the logic to create query to pull up the recieta.

Now the above mentioned method calls this new method to get only those elements which match the criteria, instead of getting all from db

Upvotes: 1

Related Questions