I got it as well. Changing the "name" parameter to "keyName" works.
Thanks, Rodrigo Pereira On Dec 15, 2007 3:03 PM, Rodrigo Pereira <[EMAIL PROTECTED]> wrote: > I got it. :) > All magic is behind freemaker. > > dropdown.jsp: > > <%@ page contentType="text/html;charset=UTF-8" language="java" %> > <%@ taglib prefix="s" uri="/struts-tags" %> > <html> > <head> > <title>Dropdown - Example</title> > <s:head theme="ajax"/> > </head> > <body> > > <form id="selectForm"> > <s:autocompleter theme="simple" name="upperValue" list="upper" > listValue="name" listKey="valueId" notifyTopics="/refresh" /> > </form> > > <s:url id="lower" action="lower" namespace="/dropdown"/> > <s:autocompleter theme="ajax" name="lowerValue" href="%{#lower}" > formId="selectForm" listenTopics="/refresh" /> > > </body> > </html> > > > > struts.xml > > <package name="dropdown" namespace="/dropdown" extends="struts-default"> > > <action name="upper" class="dropdown.DropdownAction" > method="upper"> > <result>/dropdown.jsp</result> > </action> > > <action name="lower" class="dropdown.DropdownAction" > method="lower"> > <result type="freemarker">/options.ftl</result> > </action> > > </package> > > > options.ftl > > [ > <#list lower as option> > ["${option.name}", "${option.valueId}"], > </#list> > ] > > DropdownAction: > > public class DropdownAction extends ActionSupport{ > > List<Value> upper = new ArrayList<Value>(); > List<Value> lower = new ArrayList<Value>(); > > private String upperValue; > private String lowerValue; > > > public String doUpper(){ > > upper.add( new Value(1,"A") ); > upper.add( new Value(2,"B") ); > > return SUCCESS; > } > > public String doLower(){ > > lower = new ArrayList<Value>(); > > if( upperValue.equalsIgnoreCase("A") ){ > lower.add( new Value(1,"a1") ); > lower.add( new Value(2,"a2") ); > }else{ > lower.add( new Value(1,"b1") ); > lower.add( new Value(2,"b2") ); > } > > return SUCCESS; > } > > // geters and seters > } > > Now I'd like to pass forward to my action list key value instead of list > value. > > Thanks, > Rodrigo Pereira > > > On Dec 15, 2007 2:32 PM, Martin Gainty <[EMAIL PROTECTED]> wrote: > > Rodrigo- > > > > There is a bug I logged on autocompleter..hopefully we'll have a patch soon > > https://issues.apache.org/struts/browse/WW-2373 > > Since you and I are the only folks following this do you want to take a > > quick glance at this? > > > > Saludos desde EEUU > > Martin- > > > > ----- Original Message ----- > > From: "Rodrigo Pereira" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <user@struts.apache.org> > > Sent: Saturday, December 15, 2007 10:34 AM > > Subject: Re: 2.0.11: s:autocompleter > > > > > > > Hi, > > > does anybody have an example of s:autocompleter getting list value > > > from an action? > > > I have been trying to update a list based on the selection of another > > > one, but no success. I'd like the dropdown lists not hardcoded as > > > showcase example does. > > > > > > Thanks, > > > Rodrigo Pereira > > > > > > > > > On Dec 11, 2007 4:50 PM, Rodrigo Pereira <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I tried that but it only loads 1st dropdown, the 2nd is never updated. > > > > > > > > <form id="selectForm"> > > > > > > > > <s:autocompleter theme="simple" name="upperValue" list="upper" > > > > listValue="name" listKey="valueId" notifyTopics="/changeLower"/> > > > > > > > > </form> > > > > > > > > <s:autocompleter theme="ajax" name="lowerValue" list="lower" > > > > listValue="name" listKey="valueId" listenTopics="/changeLower" > > > > formId="selectForm"/> > > > > > > > > > > > > Thanks, > > > > Rodrigo Pereira > > > > > > > > > > > > On Dec 11, 2007 4:42 PM, Dave Newton <[EMAIL PROTECTED]> wrote: > > > > > --- Rodrigo Pereira <[EMAIL PROTECTED]> wrote: > > > > > > this way you're hard coding the 1st dropdown list. > > > > > > I'd like to get it from an action. > > > > > > > > > > So use a value from the action instead of an immediate OGNL value. > > > > > > > > > > > By the way, how does the 2nd dropdown get updated? > > > > > > > > > > Via the notify/listen topics. > > > > > > > > > > d. > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]