If I need to keep track of a key or token that identifies a resource being displayed and modified in the browser, what are the some of the programming patterns used?
For example, if I display a list of movies and hookup ajax calls for users to checkout or review those movies, I’m assuming I would embed the identifier in the html which would then be passed back to the server.
Is it bad practice to use database keys? Is it bad practice to expose the identifiers in hrefs?
I don’t consider a bad practice to expose a resource identifier to the clients. Doing so could overcomplex your system without any reason. If the database key is in fact your entity key, you can use it transparently.
The only pattern I can remember for displaying and editing data on the client side is DTO.
About the HREFs and your identifiers, a REST architecture would even recommend you to do so. It is a common practice ; )
Hope it helps you.