But it do not work for the object binding.
Controller
[code]
public static void save(Dummy dummy)
[/code]
View Template
[code]
#{jsAction @Dummies.save(':dummy.name', ':dummy.pwd')/}
[/code]
Then I have to create another method
Controller
[code]
public static void save(String name, String pwd)
Dummy dummy = new Dummy(name, pwd);
[/code]
It's somewhat boring, if the object have a lot of attributes. Any best
practice to handle this case?
I also found that, the id of the '<input type='text' ...' is not
allowed in HTML.
May be that's the reason for jsAction tag limitation.
> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>
>
Yes, I use the post method. Nearly same like the play framework
example.
Only the load method change to ajax.post
[code]
var listAction = #{jsAction @list(':search', ':size', ':page') /}
$('#result').load(listAction({search: 'x', size: '10', page: '1'}),
function()
[/code]
Sorry, I can not understand 'add them to the request body' meaning.
May you give me some hints?
Thanks again.
On 3月31日, 下午2时43分, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> I guess that your save() action is called with a POST Ajax request? If
> so you don't have to pass all values into the URL path. You can add
> them to the request body.
>
Typically with jQuery you will make the POST call this way:
var postURL = #{jsAction @Dummies.save() /}
$.post(postURL(), { name: "John", time: "2pm" } );
2010/3/31 Ma Fai (gmail.com) <maf...@gmail.com>:
But it raise another issue.
Because, the name of the input has be 'person.name'. I try to use
'person\\.name' or 'person\.name'. Both of them do not work in JQuery.
The normal 'person.name' also caused the javascript error.
$.post(postURL(), { person.name: "John", person.time: "2pm" } );
On 3月31日, 下午4时23分, Guillaume Bort <guillaume.b...@gmail.com> wrote:
> The #jsAction will generate the URL to post the request to (path +
> queryString). But a POST request also has a body.
>
> Typically with jQuery you will make the POST call this way:
>
> var postURL = #{jsAction @Dummies.save() /}
> $.post(postURL(), { name: "John", time: "2pm" } );
>
> 2010/3/31 Ma Fai (gmail.com) <mafa...@gmail.com>: