Quantcast

Capturing the request path.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Capturing the request path.

jasenj1
I have a GSP form that I include on several pages. It is like a comment form. The user clicks a button, is taken to a page to fill out some info, then submits or cancels. I would like for the submit and cancel processing actions to send the user back to the original page, but I can't figure out how to capture that info.

Workflow looks a bit like:

page1\
page2 ---> enter info page --> go back to original page.
page3/

The "original" pages could be controller index pages, show with an id pages, could be many things.

I tried in the GSP to set a session variable using the request object like:
 <g:set var="from" scope="session" value="${request.pathInfo}"/>
but pathInfo is null.
request.requestURL gets me ..."/grails/myController/show.dispatch" which isn't very useful for capturing the item ID.

I suppose in the action that renders the button that leads to the form I could add something to the model, but I was hoping to avoid putting that in EVERY place I use this button and just be able to get at something from the request or session or some such.

- Jasen.
mcf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Capturing the request path.

mcf
How many parameters do the action that renders the page* needs to do so?
If they are not too much you could send all of them in the submit in order to make it possible to use the redirect command in the action that process the "info page". This woul work similar to a return url but split in controller, action and parameters pieces.

---
Marcelo Carvalho Fernandes

On Tuesday, April 24, 2012, jasenj1 <[hidden email]> wrote:
> I have a GSP form that I include on several pages. It is like a comment form.
> The user clicks a button, is taken to a page to fill out some info, then
> submits or cancels. I would like for the submit and cancel processing
> actions to send the user back to the original page, but I can't figure out
> how to capture that info.
>
> Workflow looks a bit like:
>
> page1\
> page2 ---> enter info page --> go back to original page.
> page3/
>
> The "original" pages could be controller index pages, show with an id pages,
> could be many things.
>
> I tried in the GSP to set a session variable using the request object like:
>  <g:set var="from" scope="session" value="${request.pathInfo}"/>
> but pathInfo is null.
> request.requestURL gets me ..."/grails/myController/show.dispatch" which
> isn't very useful for capturing the item ID.
>
> I suppose in the action that renders the button that leads to the form I
> could add something to the model, but I was hoping to avoid putting that in
> EVERY place I use this button and just be able to get at something from the
> request or session or some such.
>
> - Jasen.
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Capturing-the-request-path-tp4583799p4583799.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

--
----
Marcelo Carvalho Fernandes
+55 21 8272-7970
+55 21 2205-2786
Loading...