I've got the YUI datepicker up easy enough, but I'm having trouble
with the autocompleter. I tried to adopt the starter code from the
wiki, but when I open the JSP, I only get a text input field and a
submit button. No select. In the MyEclipse Web 2.0 browser, I can see
the "query" request run, but the list is not displayed. Here's what I
have. (I'll post a WAR if it helps.)
<%@ taglib prefix="yui" uri="/struts-yui-tags" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<yui:head autocompleter="true" datepicker="true" />
</head>
<body>
<s:url id="statesUrl" action="autocompleter" includeParams='none'/>
<s:form action="autocompleter">
<yui:autocompleter id="state" name="state"
href="%{#statesUrl}" containerCssStyle="width:100px" />
<s:submit />
</s:form>
</body>
</html>
<package name="yui" extends="json-default">
<action name="autocompleter" class="actions.Autocompleter">
<result type="json">
<param name="root">options</param>
</result>
</action>
</package>
package actions;
import com.googlecode.struts2yuiplugin.json.AutocompleterResult;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Date;
public class Autocompleter extends ActionSupport {
public String loadOptions() {
return SUCCESS;
}
public AutocompleterResult getOptions() {
AutocompleterResult result = new AutocompleterResult();
if (query.equals("A")) {
result.add("AL", "Alabama");
result.add("AK", "Alaska");
}
return result;
}
private String state;
public void setState(String value) {
state = value;
}
private String stateKey;
public void setStateKey(String value) {
stateKey = value;
}
private String query;
public void setQuery(String value) {
query = value;
}
}
Any insight would be appreciated!
TIA, Ted.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]