struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: struts2 jquery autocompleter is not working
Date Fri, 09 Sep 2011 19:02:40 GMT
I didn't even know it sent *any* other form information, is it actually in
the HTTP request? If it is, then perhaps it builds up its request on page
load, and not dynamically.

Dave

On Thu, Sep 8, 2011 at 8:27 PM, clanmilano <clanmilano@gmail.com> wrote:

> Hello there! I have a web project in which I'm using struts2 + jquery
> plugin.
> I really like the autocompleter component since as you may know, it starts
> filtering its content while we type on it.
> The thing is that it does not submit the latest selected values in the
> others elements at the jsp like s:select, while typing in it. So when
> url_products is called, an old value for the provider.id is sent to the
> action.
>
> JSP:
>
> <s:form id='myForm'>
>
> <s:url id="url_products" action="purchaseNavegation"
> method="showProducts"/>
>
> <s:select list="providers" value="purchase.provider.id" listKey="id"
> name="purchase.provider.id"/>
>
> <sj:autocompleter
> id="productId"
> name="productDescription"
> value="%{productDescription}"
> listenTopics="providerChanged"
> href="%{url_products}"
> formIds="myForm"
> />
>
>
> Code in the struts action:
>
> public void setPurchase(Purchase purchase) {
> this.purchase = purchase;
> }
>
> public Purchase getPurchase() {
> return this.purchase;
> }
>
> public List<Provider> getProviders() {
> return this.providerService.getAllProviders();
> }
>
> public String[] getAllProducts() {
> List<String> productsDescriptions = new ArrayList<String>();
> if (term != null && term.length() > 0)
> {
> List<Product> products = new ArrayList<Product>();
> products = this.productService.getAllProducts();
> for (Product product : products) {
> String descriptionProduct = product.getDescription();
> if (StringUtils.contains(descriptionProduct.toLowerCase(),
> term.toLowerCase()))
> {
> productsDescriptions.add(descriptionProduct);
> }
> }
> }
> return productsDescriptions.toArray(new
> String[productsDescriptions.size()]);
> }
>
> public String getProductDescription(String productDescription) {
> return this.productDescription;
> }
>
> public void setProductDescription(String productDescription) {
> this.productDescription = productDescription;
> }
>
> public String showProducts() {
> return "showProducts";
> }
>
>
> struts.xml:
>
> <action name="purchaseNavigation" class="purchaseNavigationAction">
> <result name="showProducts" type="json">
> allProducts
> </result>
> </action>
>
>
>
> Why are the latest selected values of the s:select are not sent to the
> action when the url is called? Any ideas?
>
> --
> View this message in context:
> http://struts.1045723.n5.nabble.com/struts2-jquery-autocompleter-is-not-working-tp4784544p4784544.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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message