What is the difference between View and Redirection in Thymeleaf?
<p>I understand that this question might sound stupid to a few but I am new to Spring Boot and Thymeleaf. </p>

<p>Suppose I am on <code>page1.html</code> currently. The user clicks on some button which generates a POST/GET request to my controller <code>MyController.java</code> that maps this request to some function using <code>@RequestMapping</code>.</p>

<p>After I am done processing the request I return a view name like <code>return "page2"</code> from my controller.</p>

<p>Contents of the <code>page1.html</code> <strong>change</strong> but the <strong>url still remains the same</strong> like <code>http://localhost:8080/page1</code> instead of changing to <code>http://localhost:8080/page2</code></p>

<p>I know that in order to go to a different page I have to use <code>redirection</code> but why is this not possible with <strong>view</strong>?</p>

<p>Could someone explain me why does this happen and when should I use redirection or when should I use view?</p>

<p><strong>EDIT 1:</strong></p>

<p>Here is my controller</p>

<pre><code>@RequestMapping (value = "edit", method = RequestMethod.POST, params="action=ADD")
{
    public String saveUser(@ModelAttribute UserDto userDto) {
        try {
            User user = new User();
            if(userDto.getId() != null) {   
                throw new UserExists();
            }
            user.setName(userDto.getName());
            user.setEmail(userDto.getEmail());
            System.err.println("Request Recieved");
            userDao.save(user);
            return "success";
        } catch (Exception e) {
            System.err.println("Error Saving User");
            e.printStackTrace();
            return "failure";
        }
    }
</code></pre>

<p>Here is my view</p>

<pre><code>&lt;form id="manipulate-data-form"  th:object="${userobj}" method="post" th:action="@{/edit}"&gt;
        &lt;table id="manipulate" class="table table-bordered"&gt;
            &lt;tr&gt;
                &lt;td&gt;ID&lt;/td&gt;
                &lt;td&gt;&lt;input type="text" class="form-control" th:if="${userobj != null}" th:field="*{id}" &gt;&lt;/input&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;NAME&lt;/td&gt;
                &lt;td&gt;&lt;input type="text" class="form-control" th:if="${userobj != null}" th:field="*{name}" &gt;&lt;/input&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;EMAIL&lt;/td&gt;
                &lt;td&gt;&lt;input type="text" class="form-control" th:if="${userobj != null}" th:field="*{email}" &gt;&lt;/input&gt;&lt;/td&gt;
            &lt;/tr&gt;
            &lt;tr&gt;
                &lt;td&gt;&lt;input name="action" value="ADD" type="submit" class="btn btn-success" &gt;&lt;/input&gt;&lt;/td&gt;
                &lt;td&gt;
                    &lt;input name="action" value="DELETE" type="submit" class="btn btn-danger" &gt;&lt;/input&gt; 
                    &lt;input style="margin-left: 30px" name="action" value="UPDATE" type="submit" class="btn btn-primary" &gt;&lt;/input&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        &lt;/table&gt;
    &lt;/form&gt;
</code></pre>

<p>So basically clicking the button it invokes the saveUser() Controller and then when I return the <strong>failure</strong> or <strong>success</strong> view the URL remains the same but the contents of the the page change corresponding to success or failure.</p>