Here is my JpaRepository
public interface ProcessorRepository extends JpaRepository<Processor, Integer> {
}
Controller
...
@Autowired
ProcessorRepository processorRepository;
@RequestMapping("/getAll")
public String showAllProcessors(Map map){
List<Processor> processorList = processorRepository.findAll();
map.put("processors", processorList);
return "main";
}
main.jsp
....
<select>
<option selected="selected">Choose Processor</option>
<c:forEach var="proc" items="${processors}">
<option>
${proc.processorName}
</option>
</c:forEach>
This is how Processor mysql table looks like:
Why it returns duplicates of first row, instead of all different rows?
Aucun commentaire:
Enregistrer un commentaire