[MarkLogic Dev General] xdmp:set-session-field
Danny Sokolsky
dsokolsky at marklogic.com
Thu Dec 20 17:32:49 PST 2007
Hi Alan,
I think this is somewhat a matter of style and preference. While I
have little experience directly with session fields, I have seen
anecdotal evidence that sessions can sometimes cause strange things to
happen in the app, and therefore I tend to shy away from them. These
strange things are not due to anything in the Mark Logic implementation,
but due to the nature of sessions. For example, there can be problems
if you have multiple browsers on the same computer looking at the same
application (this is pretty common actually--think how often people have
multiple browser tabs open to different google searches, for example).
In those cases, the sessions will often get confused, and one browser's
state will be used in both browsers. Also, there might be some browser
bugs and cross browser issues you need to deal with. From what I can
tell, sessions have come out of favor in the last 5 years.
I would say that URL parameters (ie, the ones you access using
xdmp:get-request-field) are a good, reliable way to keep some level of
state in an application, but like I said, it is a matter of preference.
URL parameters also tend to be good for bookmarking to get you back to
that same state. Storing things in the database also works well,
especially, as you said, if things start getting too complex for URL
parameters.
I expect different people will have different opinions.
-Danny
-----Original Message-----
From: general-bounces at developer.marklogic.com
[mailto:general-bounces at developer.marklogic.com] On Behalf Of Alan
Darnell
Sent: Thursday, December 20, 2007 3:52 PM
To: General Mark Logic Developer Discussion
Subject: [MarkLogic Dev General] xdmp:set-session-field
I'm wondering if there are any best practice recommendations with
using this function to pass content between pages rendered with
XQuery. Is it better to pass data between pages as URL parameters or
in HTML form elements rather than use session variables? If the data
is complex (e.g. a list of uris of documents a user has selected
during a session), is it better to store this in the database and
delete it later (e.g. after a user "logs out") rather than try to
maintain it in a session variable?
Alan
Alan Darnell
University of Toronto
_______________________________________________
General mailing list
General at developer.marklogic.com
http://xqzone.com/mailman/listinfo/general
More information about the General
mailing list