You can use a hidden input field and store the key there
<input type="hidden" name="key" value="<%=key%>"/>

You can create web-safe string from keys
String keyString = Keyfactory.keyToString(key);
see
http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyFactory.html#keyToString%28com.google.appengine.api.datastore.Key%29

then in your servlet use request.getParameter('key') and pass that to your
query.

String query1 = "select item from " + PurchaseInfo.class.getName() + " where
key = :key";
List<PurchaseInfo> purchase1 = (List<PurchaseInfo>)
pm1.newQuery(query1).execute(key);

or simply use pm.getObjectById(PurchaseInfo.class,key);

See
http://db.apache.org/jdo/api20/apidocs/javax/jdo/PersistenceManager.html#getObjectById%28java.lang.Class,%20java.lang.Object%29




On Thu, Aug 12, 2010 at 9:20 AM, prakhil samar <[email protected]>wrote:

> Hi Pieter,
>
> Thanks for the reply
>
> and to take that particular entity i need a key a primary key which i
> have made but how to use and get that key
> and i m using servlet for handling my submissions
>
> Here is the code for that
> ...
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to