struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amine BADID <amineba...@yahoo.fr>
Subject Re: Please Need help how to select the chosen elements
Date Wed, 06 Aug 2014 17:07:28 GMT
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



Le Mercredi 6 août 2014 12h53, Christoph Nenning <Christoph.Nenning@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
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message