struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xianwinwin <xianwin...@gmail.com>
Subject RE: struts2 and JSON integration problem (plugin)
Date Tue, 17 Jun 2008 18:22:21 GMT

you are right (I guess I was trying to be succinct),

Ok...so here's the deal, I wish to use JSON, for this, I downloaded the JAR
(jsonplugin-0.30) and had a reference to it (on my eclipse)

So, this is the previous code I was using that worked well:


XML:
<struts>
    <package name="json-support" namespace="/" extends="struts-default">			
		
  		<default-interceptor-ref name="completeStack" />
		<action name="testComplete"
class="com.struts.groups.TestCompletionAction">			
			<result type="json"/>
        </action>                   
               
               
     </package>

</struts>

JSP:
<%@ include file="/pages/layouts/taglibs.jsp" %>
	
<s:head theme="ajax" />

<s:form action="groupManagement_prepareCreate" cssStyle="font-size :	8pt;
font-family: verdana" method="post"  validate="true">
 	
	<s:url id="json" value="/testComplete.do" />
	<s:autocompleter  href="%{json}" loadOnTextChange="true" 
loadMinimumCount="1"   showDownArrow="true" name="userKeys" theme="ajax"
autoComplete="true"/>
	
	
	<s:submit action="groupManagement_Create"  label="insert" />
	
</s:form>


ACTION:
package com.struts.groups;

import com.struts.security.login.BaseSupport;

public class TestCompletionAction extends BaseSupport
{
	private String userKeys;
	
	public String execute()
	{
		System.out.println("activated TestCompletionAction (exec) method");
		System.out.println("====>"+ userKeys);
		
		return SUCCESS;
	}

	public String getUserKeys()
	{
		return userKeys;
	}

	public void setUserKeys(String userKeys)
	{
		this.userKeys = userKeys;
	}
}


when the user clicked something in the autocompleter - it invokes the method
above (so far so good)

Later, I realized that if I wish to populate a list, I need to use JSON
notation. ok...download the file, read some docs and I realized that the XML
file should do: extends="json-default"

but when I changed this line (from struts-default) nothing happens when I
type something in the autocompleter.

Thanks for any pointers.

-- 
View this message in context: http://www.nabble.com/struts2-and-JSON-integration-problem-%28plugin%29-tp17917051p17931551.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