title: Regarding Integration of Braintree payment Gateway and Java
body: <p>I am new to payment gateway integration.I need to integrate <code>Braintree Payment Gateway</code> with JSF Application. Can someone show my a basic example of the java class and sample payment Page. I saw some client Token how to generate it. I wrote a sample class and page like below,But i coudnt make as i dont get the idea.</p>
  
  <p><strong>page</strong></p>
  
  <pre><code>&lt;form id="checkout" method="post" action="/checkout"&gt;
      &lt;div id="payment-form"&gt;&lt;/div&gt;
      &lt;input type="submit" value="Pay $15"&gt;
  &lt;/form&gt;
  
  &lt;script src="https://js.braintreegateway.com/v2/braintree.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      // We generated a client token for you so you can test out this code
      // immediately. In a production-ready integration, you will need to
      // generate a client token on your server (see section below).
      var clientToken = "sZWQiOmZhbHNlLCJtZXJjaGFudElkIjoiMzQ4cGs5Y2dmM2JneXcyYiIsInZlbm1vIjoib2ZmIn0=";
  
      braintree.setup(clientToken, "dropin", {
          container : "payment-form"
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Class</strong> </p>
  
  <pre><code>import spark.Request;
  import spark.Response;
  import spark.Route;
  
  import com.braintreegateway.BraintreeGateway;
  import com.braintreegateway.Environment;
  
  public class BrainTreeController {
      private static BraintreeGateway gateway = new BraintreeGateway(
                Environment.SANDBOX,
                "your_merchant_id",
                "your_public_key",
                "your_private_key"
              );
          post(new Route("/client_token") {
            @Override
            public Object handle(Request request, Response response) {
              return gateway.clientToken().generate();
            }
          });
  }
  </code></pre>
  
  <p>I get a error in post </p>
  
  <pre><code>Syntax error on token "post", @ expected before this token
  </code></pre>