Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

[S2] post JSON to REST

mailtolouis2020 struts

2010-07-12

Replies: Find Java Web Hosting

Author LoginPost Reply


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":"testuser@(protected)"}}

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
©2008 gg3721.com - Jax Systems, LLC, U.S.A.