You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ezequiel Puig <e....@opodo.fr> on 2008/03/26 14:57:45 UTC

RE : RE : How to eliminate an entry from an array with s2 tags

Hi,

1) I am not using the collection of checkboxes because the user can check products in different pages.
2) I was thinking in removing the element from the array with s2 tags because like that i can construct an url to emininate the product: 
<s:url action='CompareProducts.do' includeParams='none'><s:param name='productCode' value='#arrayWithoutMyID' />. 
And why i want ot do that ? Because like that the page can be easily read by search engines :( .

Well, it's not really a problem, so we can let it here.

Thanks for your help.

Ezequiel.

-----Message d'origine-----
De : Dave Newton [mailto:newton.dave@yahoo.com] 
Envoyé : mercredi 26 mars 2008 13:28
À : Struts Users Mailing List
Objet : Re: RE : How to eliminate an entry from an array with s2 tags


Why wouldn't you just use the collection of checkboxes that have been checked?

Maybe I'm not understanding correctly, but I don't see any reason to remove anything from an array; whether you're using JavaScript to build the URL or not. Why do you need to remove the ID from the array?

Dave

--- Ezequiel Puig <e....@opodo.fr> wrote:

> Hi Dave,
> 
> Thanks for your reponse. Anyway, I will try to convince you ;)
> 
> Some background: i have a page where a list of products are shown. In 
> that page there is a button to compare products. What the button does 
> is collect all the selected product's id and call an action: 
> CompareProducts.do?productID=111&productID=222 etc. As the product 
> selection is done by the user, the complete url is created with 
> javascript :(. Consequently, the action CompareProducts has an array 
> like that: String[] productID. So, when the action returns the page, i 
> can access the array productID. What i want to do is to put an button 
> in the comparation page that allows the user to deselect a product. 
> So, i need to call the action CompareProducts with all the ids 
> (productID) removing the product's id that has been deselected.
> And i want to do that with s2 tags and not with javascript.
> 
> Well, i hope it's a little bit more clear.
> 
> Thanks,
> 
> Ezequiel.
> 
> 
> -----Message d'origine-----
> De : Dave Newton [mailto:newton.dave@yahoo.com]
> Envoyé : mardi 25 mars 2008 13:08
> À : Struts Users Mailing List
> Objet : Re: How to eliminate an entry from an array with s2 tags
> 
> 
> --- Ezequiel Puig <e....@opodo.fr> wrote:
> > in my jsp, i have an array of ids and i will like to remove one of
> > that ids using s2 tags:
> >  
> > I have tried the following, but it doesn't work :(
> > <s:set name="allIDs" value="#parameters.productCode"/> <s:set 
> > name="newID" value=""/> <s:iterator value="#allIDs" status="stat">
> >     <s:set name="myID" value="top"/>
> >     <s:if test='%{ idToRemove != #myID }'>
> >         <s:set name="newID[#stat]" value="#myID"/>
> >     </s:if>
> > </s:iterator>
> > 
> > Does anyone know how to do it ?
> 
> Depending on the underlying collection type you might get an 
> exception. You're not removing anything in the above code anyway, 
> you're replacing a value. You're also using the "status" value like 
> it's an index, but it's not [1].
> 
> But why? You'd have to work hard to convince me that the JSP is the 
> place to do something like that.
> 
> Dave
> 
> [1]
>
http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts2/views/jsp/IteratorStatus.html
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


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


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