Using Jparepository's FindAll method with ModelAndView
<p>My UserController class:</p>

<pre><code>package org.peronalitymeet.controller;

import org.peronalitymeet.entity.User;
import org.peronalitymeet.entity.request.AddUserRequest;
import org.peronalitymeet.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    private UserRepository userRepository;

    @Autowired
    public UserController(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    @RequestMapping(value="/users", method = RequestMethod.GET)
    public List&lt;User&gt; findAllUsers(){
        return userRepository.findAll();
    }

    @RequestMapping(value="/signup", method = RequestMethod.POST)
    public void addUser(@RequestBody AddUserRequest addUserRequest){
        User user = new User();
        user.setFirstname(addUserRequest.getFirstname());
        user.setSurname(addUserRequest.getSurname());
        userRepository.save(user);
    }

}
</code></pre>

<p>My problem is that now if i open the localhost:8080/users URL,
i will get all my users within JSON format. Previously i followed a Spring mvc tutorial, and there they used ModelAndView method to automatically open a jsp page if an URL was called.</p>

<p>Is there any way to use FindAll Users() and at the same time open a jsp or html page and list the result of the method within that?</p>