Try name=apple&price=1.00
On Feb 14, 2013 8:14 AM, "Sakthi Dasan" <shakthyd...@gmail.com> wrote:

> I have a rest web service like
>
> @Path("/postItem")@Produces({ MediaType.APPLICATION_XML, 
> MediaType.APPLICATION_JSON })public Item postItem(@QueryParam("name") String 
> name, @QueryParam("price") String price){
>   System.out.println(name);
>   System.out.println(price);
>   return new Item(name , price);}
>
> And I use prototypejs javascript lib to invoke above rest web service from
> the client side with below code snippet.
>
> <script>
>   new Ajax.Request('/some_url', {
>     method:'post',
>     parameters: {name: 'apple', price: 12}
>     onSuccess: function(transport) {
>     var response = transport.responseText || "no response text";
>     alert("Success! \n\n" + response);
>     },
>     onFailure: function() { alert('Something went wrong...'); }
>  });</script>
>
> Problem : I am not able to correctly pass the parameter to name and price
> of the service method.
>
> I am passing two parameters in client but in service side only the
> parameter 'name' is getting mapped(that too with wrong value). when i print
> the name and price i get the following
>
>  System.out.println(name);  ==> null
>
>  System.out.println(price); ==> null
>
> How can i pass parameter to service from prototypejs client so that 'name'
> gets the value apple and 'price' gets the value 12.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prototype & script.aculo.us" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to prototype-scriptaculous+unsubscr...@googlegroups.com.
> To post to this group, send email to
> prototype-scriptaculous@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/prototype-scriptaculous?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prototype-scriptaculous+unsubscr...@googlegroups.com.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
Visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to