title: Google App Engine: Get source link to entity property
body: <p>I'm new to Google App Engine so I was hoping that you could help me here.</p>
  
  <p>I'm trying to get the source link to a property of an entity (want to download a json), but can't figure out how.</p>
  
  <p>This is the code:</p>
  
  <pre><code>&lt;%-- //[START all]--%&gt;
  &lt;%@ page contentType="text/html;charset=UTF-8" language="java" %&gt;
  &lt;%@ page import="com.google.appengine.api.users.User" %&gt;
  &lt;%@ page import="com.google.appengine.api.users.UserService" %&gt;
  &lt;%@ page import="com.google.appengine.api.users.UserServiceFactory" %&gt;
  &lt;%-- //[START imports]--%&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.DatastoreService" %&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.DatastoreServiceFactory" %&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.Entity" %&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.FetchOptions" %&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.Key" %&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.KeyFactory" %&gt;
  &lt;%@ page import="com.google.appengine.api.datastore.Query" %&gt;
  &lt;%-- //[END imports]--%&gt;
  &lt;%@ page import="java.util.List" %&gt;
  &lt;%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;link type="text/css" rel="stylesheet" href="/stylesheets/main.css"/&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
      &lt;title&gt;Mandatory Assigment 2&lt;/title&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;h1&gt;Mandatory Assignment 2&lt;/h1&gt;
  
      &lt;p&gt;This page shows the CSV files uploaded&lt;/p&gt;
  
      &lt;h2&gt;Uploaded CSV files&lt;/h2&gt;
      &lt;%-- //[START datastore]--%&gt;
      &lt;%
      DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
      Key guestbookKey = KeyFactory.createKey("Guestbook", "guestbookName");
      // Run an ancestor query to ensure we see the most up-to-date
      // view of the Greetings belonging to the selected Guestbook.
      Query query = new Query("Greeting", guestbookKey).addSort("date", Query.SortDirection.DESCENDING);
      List&lt;Entity&gt; greetings = datastore.prepare(query).asList(FetchOptions.Builder.withLimit(5));
      if (greetings.isEmpty()) {
  
      %&gt;
      &lt;p&gt;There are no CSV files. Please refresh to reload&lt;/p&gt;
      &lt;%
  
      } else {
      %&gt;
      &lt;p&gt;CSV files: &lt;/p&gt;
      &lt;%
      for (Entity greeting : greetings) {
          pageContext.setAttribute("greeting_content",
                  greeting.getProperty("content"));
          if (greeting.getProperty("user") == null) {
      %&gt;
      &lt;p&gt;An anonymous person wrote:&lt;/p&gt;
      &lt;%
      } else {
      pageContext.setAttribute("greeting_user",
              greeting.getProperty("user")); 
  %&gt;
      &lt;p&gt;json string: ${fn:escapeXml(greeting_content)}&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
  &lt;%
      }
  %&gt;
  &lt;blockquote&gt;&lt;/blockquote&gt;
  &lt;%
          }
      }
  %&gt;  
  
  &lt;/body&gt;
  &lt;/html&gt;
  &lt;%-- //[END all]--%&gt;
  </code></pre>
  
  <p>The "${fn:escapeXml(greeting_content)}" code outputs the json as a String, but I would like to be able to download the json instead like this:</p>
  
  <pre><code>&lt;p&gt;&lt;a href="${fn:escapeXml(greeting_content)}"&gt;download JSON&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  
  <p>Can someone help me? I'd appreciate it!</p>