I've created the following Action that will populate my forms :
public final class PrepareFormAction extends Action {
public ActionForward perform(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
Locale locale = getLocale(request);
MessageResources messages = getResources();
String action = request.getParameter("action");
if ("addproject".equals(action)) {
try {
CompanyJob companyJob = new CompanyJob();
ArrayList listcomp = new ArrayList();
ResultSet rs = companyJob.getAllCompany();
while (rs.next()) {
String name = rs.getString("comp_name");
String id = rs.getString("comp_id");
listcomp.add(new LabelValueBean(name,id));
}
request.setAttribute("listcomp", listcomp);
} catch (SQLException sqle) {
System.err.println("ProjectAction Error >> " + sqle);
}
return (mapping.findForward("addproject"));
}
return (mapping.findForward("error"));
}
}
Dams
----- Original Message -----
From: "Gary Bartlett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 6:27 PM
Subject: populating list for html:options tag within FormBean
> Question -
>
> I saw in an earlier post that someone was populating
> the list for an html:options tag within a FormBean.
> My question is how does the FormBean place the list
> into the context so it is available to the tag ?
>
> I realize this is a pretty basic question, but my only
> frame of reference here is the example where the jsp
> scriptlet creates the list and places it into the
> context with pageContext.setAttribute();
>
> Thanks,
>
> Gary Bartlett
>
> __________________________________________________
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
>
> --
> 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]>