Hi,

Ok, I found my problem, I was using restTemplate to do the post, and it set the 
content type to application/json;charset=UTF-8, so now my question is how to 
configure rest-plugin to accept application/json;charset=UTF-8 and handle by 
json lib?

Regards
LV





________________________________
From: Frans Thamura <fr...@meruvian.org>
To: Struts Users Mailing List <user@struts.apache.org>
Sent: Mon, July 12, 2010 3:51:49 PM
Subject: Re: [S2] post JSON to REST

We use http post

But dunno how to send via json rpc
(m)

-----Original Message-----
From: mailtolouis2020-str...@yahoo.com
Date: Mon, 12 Jul 2010 07:29:53 
To: Struts Users Mailing List<user@struts.apache.org>
Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
Subject: [S2] post JSON to REST



Hi,



Sorry if this is double posted, because I didn't receive the mail which I post.

I'm new to the struts2 rest plugin, I hope someone can help me.

I'm trying to post a json data to a UserController, I can see create method is 
invoked, but the json data is not set to the UserController.

Here is the json data:
{"user":{"userName":"TestUser","userEmail":"testu...@yahoo.com"}}

In my UserController, I've defined these getter/setter

public void setModel(UserBean bean)
public UserBean getModel()
public void setUser(UserBean bean)
public UserBean getUser()
public void  setUserName(String name)
public String getUserName()
public void setUserEmail(String email)
public String getUserEmail()

>From the log, I can c getModel(), validate(), create() are called, but no one 
setting anything to the controller.

Do I need to do extra thing to receive the json data?

The GET is working fine when I want to get some data from the UserController.

I've been searching the net pass 2 days, unfortunately most info are about GET, 
not POST or PUT.

I hope your guys can help me.

THanks
LV

Reply via email to