Yep...
I think my problem comes from this point.
I've tried to put this code in my AddProjectAction.java in the perform
methode :
try {
  CompanyJob companyJob = new CompanyJob();
  ArrayList listcomp = companyJob.getAll();
  request.setAttribute("listcomp", listcomp);
  System.out.println("Size of  list " + listcomp.size());

  } catch (SQLException sqle) {
   System.err.println("ProjectAction Error >> " + sqle);
  }

but I think it's the wrong place because I want to populate my dropdown list
before performing the Action...
I do not know where and when populate it ??

Dams


----- Original Message -----
From: "Yaman Kumar" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, May 15, 2001 3:36 PM
Subject: RE: Help : Dropdown List


> Hi,
> There is little advice If I understood ur problem.
>
> Do u have your "list" object in request scope with the key "complist".
> and if u would like to populate the complist in list box then
> change the statment to below one.If u r looking for option values and
option
> names are same.
>
> <html:options name="complist" labelName="complist"/>
>
> I hope this helps you
>
> Bye
> rayaku
>
> -----Original Message-----
> From: Damien VIEL [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 15 May 2002 6:52 PM
> To: Struts Users Mailing List
> Subject: Re: Help : Dropdown List
>
>
> Hi...
>
> I do not manage to do what I want :)
> I explain my problem.
>
> I've got 3 classes and 1 jsp:
> - AddProjectForm.java
> - AddProjectAction.java
> - CompanyJob.java
> - project.jsp
>
> In my CompanyJob.java I've got this following methode  :
>
> public ArrayList getAll() throws SQLException {
>   ArrayList list = null;
>   Connection c = null;
>   c = pool.getConnection();
>   Statement stm = c.createStatement();
>   MyRequest sqlrequest = new MyRequest();
>   ResultSet rs = stm.executeQuery(sqlrequest.sqlGetAllCompany());
>   while (rs.next()) {
>   list.add(new String (rs.getString("comp_name")));
>   }
>   return list;
>  }
>
> I want to populate the dropdown List in my JSP with the ArrayList and in
> don't
> manage to do it.... Following the JSP :
>
> <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
> <jsp:useBean id="complist" class="java.util.ArrayList" scope="request" />
>
> <html:form action="/project" >
>
> <TABLE border="0" width="50%" cellpadding="5" cellspacing="0"
align="CENTER"
> class="table">
>   <TR>
>     <TD colspan="2"><html:errors/></TD>
>
>   </TR><TR>
>     <TD><bean:message key="prompt.addproject.company"/></TD>
>     <TD><html:select property="company" size="1">
>         <html:options name="complist" />
>         </html:select>
>     </TD>
>   </TR><TR>
>     <TD><bean:message key="prompt.addproject.name"/></TD>
>     <TD><html:text property="name" size="30" maxlength="50"/></TD>
>   </TR><TR>
>     <TD colspan="2" align="CENTER"><br><html:submit property="submit"
> value="Submit"/></TD>
>   </TR>
> </TABLE>
>
> </html:form>
>
>
> Help... Where is the problem....
>
> Thanks All
> Dams
>
>
> ----- Original Message -----
> From: "James Mitchell" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Tuesday, May 14, 2002 7:46 PM
> Subject: RE: Help : Dropdown List
>
>
> > sorry I did not clarify.
> >
> > I was not advocating to do this in the jsp.
> > This should be done within the action.
> >
> > I guess I take this for granted.....hmmm.
> >
> > JM
> >
> > > -----Original Message-----
> > > From: Damien VIEL [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, May 14, 2002 1:39 PM
> > > To: Struts Users Mailing List
> > > Subject: Re: Help : Dropdown List
> > >
> > >
> > > Ok,
> > > no problem with this example.
> > > But I've read that it's not a good choice to create the ArrayList
> > > in the JSP
> > > but create it
> > > in another class and put this Arraylist in the request object. So
> > > you set a
> > > bean in the JSP.
> > >
> > > <%jsp:UseBean......./%>
> > >     <td align="left">
> > >       <html:select property="type">
> > >         <html:options collection="serverTypes" property="value"
> > >                    labelProperty="label"/>
> > >       </html:select>
> > >     </td>
> > >
> > > My problem is that I do not know where and when I must add the
> > > ArrayList to
> > > the request object ?
> > >
> > > Dams
> > >
> > >
> > > ----- Original Message -----
> > > From: "James Mitchell" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Tuesday, May 14, 2002 7:20 PM
> > > Subject: RE: Help : Dropdown List
> > >
> > >
> > > > Well, if you look at the subscription.jsp.
> > > >
> > > >
> > > > The example loads these in the jsp, but this could easily have
> > > been a call
> > > > to your data manager/service or could even been pre-cached as an
> > > application
> > > > scope list.
> > > >
> > > >
> > > >
> > > > <%-- In real life, these would be loaded from a database --%>
> > > > <%
> > > >   java.util.ArrayList list = new java.util.ArrayList();
> > > >   list.add(new org.apache.struts.util.LabelValueBean("IMAP
Protocol",
> > > > "imap"));
> > > >   list.add(new org.apache.struts.util.LabelValueBean("POP3
Protocol",
> > > > "pop3"));
> > > >   pageContext.setAttribute("serverTypes", list);
> > > > %>
> > > >
> > > >
> > > >
> > > >     <td align="left">
> > > >       <html:select property="type">
> > > >         <html:options collection="serverTypes" property="value"
> > > >                    labelProperty="label"/>
> > > >       </html:select>
> > > >     </td>
> > > >
> > > >
> > > > JM
> > > >
> > > > > -----Original Message-----
> > > > > From: Damien VIEL [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Tuesday, May 14, 2002 1:11 PM
> > > > > To: Struts Users Mailing List
> > > > > Subject: Re: Help : Dropdown List
> > > > >
> > > > >
> > > > > Sorry no,
> > > > > but I'm going to :)
> > > > > Dams
> > > > > ----- Original Message -----
> > > > > From: "James Mitchell" <[EMAIL PROTECTED]>
> > > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > > > Sent: Tuesday, May 14, 2002 6:59 PM
> > > > > Subject: RE: Help : Dropdown List
> > > > >
> > > > >
> > > > > > Did you get the struts-example running???
> > > > > >
> > > > > >
> > > > > > JM
> > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Damien VIEL [mailto:[EMAIL PROTECTED]]
> > > > > > > Sent: Tuesday, May 14, 2002 12:54 PM
> > > > > > > To: Struts Users Mailing List
> > > > > > > Subject: Help : Dropdown List
> > > > > > >
> > > > > > >
> > > > > > > Hi :)
> > > > > > >
> > > > > > > Could anyone pls tell me how to populate a dropdown list using
> > > struts
> > > > > > >  tag libraries. I've heard that I need to put a Collection
> > > (Arraylist)
> > > > > in
> > > > > > > the request.
> > > > > > > This Collection is build from a Database.
> > > > > > > For Example I have 3 files :
> > > > > > > - UserForm.java
> > > > > > > - UserAction.java
> > > > > > > - SelectUser.jsp
> > > > > > >
> > > > > > > I want to select a user from the dropdown list that appears in
> my
> > > > > > > SelectUser.jsp file, in order to edit the user information
> > > > > for exemple.
> > > > > > >
> > > > > > > Thanks all
> > > > > > > Dams
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > To unsubscribe, e-mail:
> > > > > > > <mailto:[EMAIL PROTECTED]>
> > > > > > > For additional commands, e-mail:
> > > > > > > <mailto:[EMAIL PROTECTED]>
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > --
> > > > > > To unsubscribe, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > > > > For additional commands, e-mail:
> > > > > <mailto:[EMAIL PROTECTED]>
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > >
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to