struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Zhang <zhj...@hotmail.com>
Subject [S2]question about S2+YUI+JSON.
Date Wed, 23 Jan 2008 00:55:28 GMT

I want to write a demo using S2+YUI+JSON. And I got an issue about async call
struts2 action.

In my jsp file, there is call struts action. I want to submit same data to
sever and the server return the json result. But I fount the json plugin
can't populate the parameter form request to action. 

Javascript sumbit some data,

var sUrl = "dragDropPost.action";
YAHOO.util.Connect.asyncRequest('POST', sUrl, callback,
"list1="+parseList(ul1, "List 1")+"&list2="+parseList(ul2, "List 2"));


Struts.xml

       <action name="dragDropReturn" class="test.DragDropAction"
method="execute">
	       	<interceptor-ref name="json"/>
             <result />
        </action>


Action,

public class DragDropAction  extends ActionSupport {   

	private String list1;
	private String list2;
             private Map map = new HashMap();

	public String execute()
            {
                map.put("Content", "Hello Paciolan");
                return  Action.SUCCESS;
             }

	public String getList1() {
		return list1;
	}

	public void setList1(String list1) {
		this.list1 = list1;
	}

	public String getList2() {
		return list2;
	}

	public void setList2(String list2) {
		this.list2 = list2;
	}
    public Map getMap()
    {
        return map;
    }

    public void setMap(Map value)
    {
        map = value;
    }
}

I found the list1 and list2 were not populated when I submit the data.

What should I do?
-- 
View this message in context: http://www.nabble.com/-S2-question-about-S2%2BYUI%2BJSON.-tp15032587p15032587.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message