Hi all,
Can anyone help us with suggestion to the following problem: We have used JSP to read the session id into an instance.
<session-instance> <form-id><%=session.getId()%></form-id> </session-instance>
The session instance is read in from a JSP file:
<xforms:instance id="session-instance" src="../xforms-jsp/personal-loan-app/sessionInstance.jsp"/>
We then submit the data to an exist database using the session id as part of the file name to get a unique database.
<xforms:submission id="save-data" ref="instance('details-instance')" resource="/exist/rest/db/orbeon/personal_loan{instance('session-instance')/form-id}.xml" method="put" replace="none" relevant="false"> </xforms:submission>
<!-- load the data from an exist database so when go back and forth the data can be viewed --> <xforms:submission id="load-data" serialization="none" method="get" resource="/exist/rest/db/orbeon/personal_loan{instance('session-instance')/form-id}.xml" replace="instance" instance="details-instance" validate="false"/>
<!-- load the data on load --> <xforms:send ev:event="xforms-ready" submission="load-data"/>
We have a multipage form and are currently saving data every time a user navigate to next/previous page.
The problem is: it is saving the data fine but it does not load the data on the next page. The same code works when saving and loading to a static database name (same database for all users, using no session id). Any ideas?
Is there a better way to get the session id? Maybe there is a better way to save data into a user-unique database?
Much appreciated, Trond & Serena -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
Trond,
You can't get the Java session ID in XForms, but what you can do is to generate an ID and store it it in the session. You can do this with some code like this: <xforms:action ev:event="xforms-model-construct-done"> <xxforms:variable name="my-session-id" select="xxforms:get-session-attribute('my-session-id')"/> <xforms:action if="exists($my-session-id)"> <xforms:setvalue ref="/instance/id" value="$my-session-id"/> </xforms:action> <xforms:action if="empty($my-session-id)"> <xforms:setvalue ref="/instance/id" value="digest(string(random(true)), 'MD5', 'hex') "/> <xforms:insert context="." origin="xxforms:set-session-attribute('my-session-id', /instance/id)"/> </xforms:action> </xforms:action> Alex |
Free forum by Nabble | Edit this page |