2 Replies Latest reply on Jul 29, 2008 12:50 PM by moumen rajae

    Dynamic listbox in jsp

    moumen rajae Newbie

      Hi i'm a beginner,and i'm trying to add a dynamic listbox to a jsp,i am asked to developp a listbox which will be a list of beans results of an sql request.i have already developped the bean here it is.

      public class ListderoulanteBean implements Serializable{    
               long    id_doc;
               String  intitul_doc;
               long    id_categorie;
               @Id @GeneratedValue
               public long getIdDoc() {
                   return id_doc;
               public void setIdDoc(long id_doc) {
                  this.id_doc = id_doc;
               public String getintitulDoc() {
                   return intitul_doc;
               public void setintitulDoc(String intitul_doc) {
                   this.intitul_doc = intitul_doc;
               public long getIdcategorie() {
                   return id_categorie;
               public void setIdcategorie(long id_doc) {
                   this.id_doc = id_doc;

      What is the next step ?do i need a servlet which will include an sql request? and how could i show the results in my listbox.
      Thanks for you help

        • 1. Re: Dynamic listbox in jsp
          Aart Scheepers Newbie

          You can create a list object (in actions)

          public class ListderoulanteBean List extends EntityQuery
              public String getEjbql() 
                  return "select listderoulanteBean from ListderoulanteBean listderoulanteBean ";

          and then use this in your xhtml-page.

          <h:selectOneMenu id="seamentity" value="#{seamhometoedit.instance.field}" required="true">
            <s:selectItems value="#{deroulanteList.resultList}"
             var="ou" label="#{ou.name}" />
            <s:convertEntity />

          • 2. Re: Dynamic listbox in jsp
            moumen rajae Newbie

            Thanks very much that works with some changes :)