How to send value recently selected in the url as a param?
Hello! I'm working on a struts2 (2.2.3) web app, using jquery plugin (3.0.0) for ajax.
I have a jsp in which I have 2 sj:autocompleter (the first one for providers and the second one for products). I need to filter the products by the provider selected. In this particular application is a must to have an autocompleter for the second collection.
What I want is to send in the url the value selected in the first autocompleter as a parameter so that I'm able to use that selection for filtering the second autocompleter.
Part of my jsp code:
Code:
<s:url id="url_products" action="myAction" method="showProducts">
<s:param name="providerSelected" value="%{purchase.provider.id}"></s:param>
</s:url>
<sj:autocompleter
id="purchaseProviderId"
name="purchaseProvider"
value="%{purchaseProvider}"
onCompleteTopics="providerChanged"
cssClass="product"
href="%{url_providers}"
/>
<sj:autocompleter
id="productId"
name="productDescription"
value="%{productDescription}"
listenTopics="providerChanged"
href="%{url_products}"
/>
The problem I'm having is that "%{purchase.provider.id}" is something selected exactly before sending the url_products and when I send the value through the url the value is not updated from the latest selection done.
What I think is that this value is part of the session and since the new selection done for the provider has not been submitted yet to the action, "%{purchase.provider.id}" is just pointing to the value the session is aware of.
Question: How can I send the value recently selected in "purchaseProviderId" autocompleter through the url as a param?
Thanks in advance!