I've found some issues. Writing about this will solve the whole thing  :-)

1)
the argument sent to the action is named 'query' (hard coded) while I
assumed it would be taken from the 'name' ( -> product in my case. (<yui:autocompleter ..name="product"..) )

That would be nice to be mentioned in the documentation
( at http://cwiki.apache.org/confluence/display/S2PLUGINS/YUI+Plugin )

So now I added set/getQuery to my action which took
me one step further.

But still the parameters are not set automatically. so I
2)
put the params into the autocompleter's href

But here is one problem : the URL is not built correctly

<s:url id="productListUrl"
   namespace="/ajax"
   action="ProductList"
   includeParams='none'>
       <s:param name="categoryNo" value="%{categoryNo}" />
<%--ProductList?category=9?query=1 (? instead of : between category and query) --%>
</s:url>

Category is e.g. '9' and I get the URL: '.../ProductList?category=9?query=1'
So I get 'category== '9?query=1' and query is not set anymore. So when the
URL is built it's assumed that there are no other parameters.

As for now in the getter for my category I will parse and split it myself
because I have to go on with my project - and wait for this to be fixed
or for someone who explains what's wrong here ..

comments are still welcome...

Jan
..
<%@ taglib prefix="yui" uri="/struts-yui-tags" %>
<yui:head autocompleter="true" />
..
<s:form
       id="productChoiceForm"
action="ProductList" > <div class="yui-skin-sam" > <s:hidden id="categoryNo" name="categoryNo" /> <s:url id="productListUrl" namespace="/ajax" action="ProductList" includeParams='none' /> <yui:autocompleter id="product" name="product" href="%{#productListUrl}" containerCssStyle="width:100px" /> </div> <s:submit type="input" cssClass="mySubmitButton"/>
</s:form> ...

( I changed the 'includeParams' parameter without any effect )

struts.xml has this action:

<package name="ajax" namespace="/ajax" extends="json-default"> <action name="ProductList" class="my.classpath.ajax.ProductList">
           <result type="json">
               <param name="root">options</param>
           </result>
       </action>                  </package>

and the action has parameters+getter/setter for product,productKey,categoryNo but none of these parameters is initialized before the 'execute' method is called (
with the 'getOptions' method it's the same thing ).

Any suggestion ( or may be a working example ) is appreciated ...

Jan


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

Reply via email to