[xwiki-devs] Adding Space information to the context - follow up
Hi, So, I tried the querystring option. Didn't quite work. We have a form that we ask the user to fill on page 1 and this form represents only a PART of an object that gets created for this particular form. So, say for eg., we have a name field in the form and this gets copied on to the underlying obect when we click a button. Now, currently when we cllick the button on this page, we have a script that is run and what that does is - Creates a new object, creates a new document with the name entered by the user in the form, adds the new object to this document and copies all form fields to the Object properties. Finally the script redirects the user to the newly created page which displays the object with the help of the class sheet. (the following is the last line of the script which does the redirect) $response.sendRedirect($newdoc.getURL("save", "template=${etemplate}&parent=${eparent}&title=$etitle")) Now, our use case has changed a little bit, in the sense that, the user will need to enter form field values (object values in xwiki) on a sequence of pages, i.e, everything does not get added to the object the first time a button is clilcked. In this case, to be able to copy the values from the Page 2 to the same object as was created in Page 1, we need some way to access the same object. This could be done using the object name and as seen in the response.sendRedirect line above, we pass the title (which is the name entered by the user) to the next page (newdoc page in this case). But, when I try to access this on that newdoc, I do not get a value I am expecting. So, what am I doing wrong when I try this scritp on the newdoc: #set($title = $request.getParameter("title")) The title : $title This returns: The title : XWiki - $doc.web - $doc.name #set($template = $request.getParameter("template")) The template : $template This returns: The title : $template Please point out whats wrong in this usage and if it is valid in the first place! Also, what alternative could we use. I mean how to access the application context in the velocity scripts? Thanks much for all help.
participants (1)
-
Kamna Jain