title: Passing A Path Variable To A Controller With Spring
body: <p>I am using spring to create an App that links with facebook. When The app is launched it redirects you to a sign in page.  After you click the log in button it redirects you to the homepage. What i want to do is that when the log in button is clicked it redirects you to the homepage and adds a unique number at the end. Whenever i launch my app i am getting an HTTP Status 404  error. I can not figure out what the problem is. EDIT I am using Spring Social Quickstart, the only modifications i made the program were the ones below</p>
  
  <p><strong>Sign In Page</strong></p>
  
  <pre><code>    &lt;%@ page session="false" %&gt;
      &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
      &lt;html&gt;
          &lt;head&gt;
              &lt;title&gt;Sign In&lt;/title&gt;
          &lt;/head&gt;
          &lt;body&gt;
  &lt;c:set var="rand"&gt;&lt;%= java.lang.Math.round(java.lang.Math.random() * 2) %&gt;&lt;/c:set&gt;
              &lt;form action="&lt;c:url value="/signin/facebook/${rand}" /&gt;" method="POST"&gt;
                  &lt;button type="submit"&gt;Sign in with Facebook&lt;/button&gt;
                  &lt;input type="hidden" name="scope" value="email,publish_stream,offline_access" /&gt;
              &lt;/form&gt;
          &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p><strong>Home Page</strong></p>
  
  <pre><code>&lt;%@ page session="false" %&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Home&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;ul&gt;
          &lt;li&gt;&lt;a href="&lt;c:url value="/signout" /&gt;"&gt;Sign Out&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
          &lt;p&gt;${number}&lt;/p&gt;
      &lt;h3&gt;Your Facebook Friends&lt;/h3&gt;
      &lt;ul&gt;
      &lt;c:forEach items="${friends}" var="friend"&gt;
          &lt;li&gt;&lt;img src="http://graph.facebook.com/&lt;c:out value="${friend.id}"/&gt;/picture" align="middle"/&gt;&lt;c:out value="${friend.name}"/&gt;&lt;/li&gt;
      &lt;/c:forEach&gt;
      &lt;/ul&gt;   
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Home Controller</p>
  
  <pre><code>@RequestMapping(value = "/{rand}", method = RequestMethod.GET)
  public String home(@PathVariable("rand") String rand, Model model) throws IOException {
  
             List&lt;Reference&gt; friends = facebook.friendOperations().getFriends();
             FacebookProfile profile = facebook.userOperations().getUserProfile();
             String userID = facebook.userOperations().getUserProfile().getId();
             model.addAttribute("friends", friends);
             String accessToken = connectionRepository.getPrimaryConnection(Facebook.class).createData().getAccessToken();
              System.out.println(accessToken);
          return "home";
      }
  </code></pre>