Hi.
Thank you Christoph for your reply.
I tried to use this solution and it works.
Only the selected items appear.
But if I want to modify this list, I have only these elements not all !
I hope that you have understand me.
Thank you a lot in avance.

Best regards.

Amine.



Le Jeudi 7 août 2014 9h21, Christoph Nenning <christoph.nenn...@lex-com.net> a 
écrit :
 


> Thank you Christoph for your reply.
> I tried to use it but I have more than one selected element. The 
> solution above is for only one selected element, I think, no ?
> 
> I've many selected elements from the drop-down list.
> Thank you a lot for your help.
> Best regards.
> Amine
> 






> I tried to use it but I have more than one selected element.
How do you do that, with <select multiple="true" > ?


In that case you can use struts tags like this:

<s:select
     multiple="true"
     name="allColors"
     list="selectedColors"
/>



https://struts.apache.org/release/2.0.x/docs/select.html



regards,

Christoph















> 
> 
> Le Mercredi 6 août 2014 12h53, Christoph Nenning 
> <christoph.nenn...@lex-com.net> a écrit :
> 
> 
> 
> > Thank you Christoph for reply
> > In fact, when I choose these elements from the drop-down list, I 
> > save them in the database.
> > After I go to an other page And I do something next I return to the 
> > first one but the éléments are not selected in the drop-down list 
> > but they are realy savez in the database And I want that they apear 
> > as selected items.
> > Thank you
> > 
> > Regards
> > 
> > Amine
> > 
> 
> 
> Okay, now I understand your question (hopefully)
> 
> 
> In plain HTML the selected <option> tag needs the attribute selected:
> <option selected="selected">...</option> 
> 
> 
> With struts2 tags you can do this:
> 
> <s:combobox
>     name="color"
>     list="colors"
> />
> 
> Your action must provide getters for color and colors. While color is 
the 
> selected value from DB and colors is the whole list of items.
> 
> 
> see:
> https://struts.apache.org/release/2.0.x/docs/combobox.html
> 
> 
> 
> regards,
> Christoph
> 
> 
> 
> This Email was scanned by Sophos Anti Virus

This Email was scanned by Sophos Anti Virus

Reply via email to