• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

html:select html:options

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Help!

I am using the html:select html ptions to populate a list box with month values

Here is my code in the jsp:

<bean efine name="wizardCustomMultiReportForm" type="com.sbc.webservices.ebat.reports.forms.WizardCustomMultiReportForm" property="reportMultiMonthList" id="monthList" scope="session" />
<html:form name="wizardCustomMultiReportForm" type="com.sbc.webservices.ebat.reports.forms.WizardCustomMultiReportForm" action="/wizardMultiMonthSelection">

<html:select property="wizardCustomMultiReportForm" name="reportMultiMonthList" size="13" multiple="true">
<html ptions property="value" labelProperty="label" collection="monthList" />
</html:select>

List monthList = WizardBOFactory.getWizardBO().getBillMonths(user, wForm.getReportId());
if (monthList == null || monthList.size() == 0)
{
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.reports.reportselection.nodatafound"));
logger.error("No data found.");
}
if (!errors.isEmpty())
{
// 35158
request.setAttribute(HelpConstants.ACTION_PATH, EbatRequestUtils.composePreviousLink(request, mapping));
saveErrors(request, errors);
return mapping.findForward("noDataFound");
}

List beanMonthList = new ArrayList();
// a list of label value bean
// use DateUtil to format the value to the label
for (int i = 0; i < monthList.size(); i++)
{
String month = (String) monthList.get(i);
beanMonthList.add(new LabelValueBean(DateUtil.convertStringDate(DateUtil.monthYearFormat, DateUtil.monthYearHeaderFormat, month), month));
}
wForm.setReportMultiMonthList(beanMonthList);

my form has the appropriate getters and setters for LIST reportMultiMonthList

I am getting the following error:

[ServletException in:/reports/wizard/tiles/wizardMultiMonthSelection.jsp] java/util/ArrayList incompatible with com/sbc/webservices/ebat/reports/forms/WizardCustomMultiReportForm'

without the type in the bean define I get the error that it can't find the bean

What am I doing wrong? I have tried everything I can think of.

Thanks![ServletException

:roll:
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<html:select property="wizardCustomMultiReportForm" name="reportMultiMonthList" size="13" multiple="true">

I think you have the name and property attributes mixed up here?
Oh, and you can omit the name attribute if you want to.
It refers to the enclosing form bean by default.
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You set the multiple attribute that means your getter/setter method should handle a String[].
 
Abigail Moore
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the info - I have my property and name the same way the rest of our application has them.

Also I removed the multiple attribute so I could see if it worked without it and I get the same arraylist error - Any other ideas??
 
Stefan Evans
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, completely missed this before
This line is approximately equivalent in java to:
WizardCustomMultiReportForm monthList = session.getAttribute("wizardCustomMultiReportForm").getReportMultiMonthList();

The "type" attribute refers to the type of the variable you want to declare. It is related to the "id" attribute, not the "name".
I think the type should be java.util.List.


ie (approximately)

List monthList = session.getAttribute("wizardCustomMultiReportForm").getReportMultiMonthList();

Cheers,
evnafets
[ July 27, 2005: Message edited by: Stefan Evans ]
 
Anything worth doing well is worth doing poorly first. Just look at this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic