Quantcast

UrlMapping Question ...

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

UrlMapping Question ...

Saleh Mamdouh
Hi,

I tried to look int the UrlMapping documentation and Grails documentation and did not find a complete answer. Maybe I missed something while looking in the documentation, this asking here ...

Question : Can I map a URL to just a controller ?
For example :
"/test" (Controller:"hello").

By that mapping, I would assume that "/test/action1" would be automatically mapped to HelloController::action1 and "/test/action2" would automatically map to HelloController::action2.

Another sub-question:
Can I use parts of the URL to determine the action name.
Ex: "/test/$var1" (Controller:"$var1_old") ?

Thanks

Regards,

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CANzPHmeuuJdFNpf0Q237Bd2dmVCGy8BV3oUqQCQ%3DL_06JYErnw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: UrlMapping Question ...

Jeff Brown
On June 21, 2016 at 2:16:53 AM, Saleh Mamdouh
([hidden email]) wrote:
>
>
> Question : Can I map a URL to just a controller ?
> For example :
> "/test" (Controller:"hello”).

Yes, but you would use “controller” instead of “Controller”.

>
> By that mapping, I would assume that "/test/action1" would be automatically
> mapped to HelloController::action1 and "/test/action2" would automatically
> map to HelloController::action2.

No, the above mapping would map to the default action in
HelloController.  If you want “/test/action1” to map to action1 and
“/test/action2” to map to action2 then you could do something like
this:

“/test/$action”(controller: ‘hello’)


>
> Another sub-question:
> Can I use parts of the URL to determine the action name.
> Ex: "/test/$var1" (Controller:"$var1_old") ?
>

I can’t tell what “$var1_old” is supposed to be there.  The question
as written “Can i use parts of the URL to determine the action name”
is answered in my answer to the previous question.




JSB

--
Jeff Scott Brown
OCI Grails Practice Lead
Principal Software Engineer

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAEfmkriLHK%2Bvb5srXd40%2BTJaoXu26ZBv45Hj53T_fWbpk5TQpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...