You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Raviteja Lokineni <ra...@gmail.com> on 2016/06/29 14:01:44 UTC

How to use spring binding in groovy templates in a spring boot web project

Hi all,

I need help in understanding how to use spring binding in Groovy templates.
I wasn't able to find much help in documentation. For example I have a form
which has some attributes which needs to be bound on submission.

For example: https://spring.io/guides/gs/handling-form-submission/
This example only speaks of Thymeleaf.

======================
FYI, if it helps anyone I got the generated URL for a controller in a
groovy template by using the following code:

a (href: MvcUriComponentsBuilder.fromMappingName("SC#index").build()) {
    yield "Sentiment Analysis"
}

The Spring MVC mapping is generated using the capital letters (If the
generated capital letters are not unique it uses the full class name) in
the controller class name, hash and the method name.
======================

Thanks,
-- 
*Raviteja Lokineni* | Business Intelligence Developer
TD Ameritrade

E: raviteja.lokineni@gmail.com

[image: View Raviteja Lokineni's profile on LinkedIn]
<http://in.linkedin.com/in/ravitejalokineni>

Re: How to use spring binding in groovy templates in a spring boot web project

Posted by Raviteja Lokineni <ra...@gmail.com>.
Hi all,

Finally found a obvious way (had to do a trial-error to see if it worked).
Placed the command object as a model attribute and named the form inputs
like <model-key>.<variable-name> and just having <variable-name> also did
the magic.

Thanks,
Raviteja

On Wed, Jun 29, 2016 at 10:01 AM, Raviteja Lokineni <
raviteja.lokineni@gmail.com> wrote:

> Hi all,
>
> I need help in understanding how to use spring binding in Groovy
> templates. I wasn't able to find much help in documentation. For example I
> have a form which has some attributes which needs to be bound on submission.
>
> For example: https://spring.io/guides/gs/handling-form-submission/
> This example only speaks of Thymeleaf.
>
> ======================
> FYI, if it helps anyone I got the generated URL for a controller in a
> groovy template by using the following code:
>
> a (href: MvcUriComponentsBuilder.fromMappingName("SC#index").build()) {
>     yield "Sentiment Analysis"
> }
>
> The Spring MVC mapping is generated using the capital letters (If the
> generated capital letters are not unique it uses the full class name) in
> the controller class name, hash and the method name.
> ======================
>
> Thanks,
> --
> *Raviteja Lokineni* | Business Intelligence Developer
> TD Ameritrade
>
> E: raviteja.lokineni@gmail.com
>
> [image: View Raviteja Lokineni's profile on LinkedIn]
> <http://in.linkedin.com/in/ravitejalokineni>
>
>


-- 
*Raviteja Lokineni* | Business Intelligence Developer
TD Ameritrade

E: raviteja.lokineni@gmail.com

[image: View Raviteja Lokineni's profile on LinkedIn]
<http://in.linkedin.com/in/ravitejalokineni>