struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject Re: Please Need help how to select the chosen elements
Date Wed, 06 Aug 2014 10:52:49 GMT
> 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