Richard,

Many thanks for your feedback. This means I have to store the data twice. I tried that but now I get another error:

2006-09-04 09:45:17,339 ERROR [http-8080-1] [/mtweb].[jsp] (ApplicationDispatcher.java:704) - Servlet.service() for servlet jsp threw exception javax.servlet.jsp.JspException: Cannot create iterator for DynaActionForm[dynaClass=editExpenseForm,.....

There seems still be something wrong...

Tom



Richard Yee wrote:
Tom,
Try this for your <options> tag instead:

 <html:options collection="expenseTypes"
     property="typeCode" labelProperty="typeDescription"/>

This will work if your have an attribute called "expenseTypes" in some scope (ie. session, request). The options tag collection attribute expects the name of the collection, not the collection itself.

-Richard

Tom Bednarz wrote:
I try to fill a DropDownListbox on a DynaValidatorActionForm and get the following exception:

2006-09-03 18:20:45,007 ERROR [http-8080-1] [/mtweb].[jsp] (ApplicationDispatcher.java:704) - Servlet.service() for servlet jsp threw exception javax.servlet.jsp.JspException: Cannot find bean under name [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] at org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:366) at org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:186) at org.apache.jsp.form.editExpense_jsp._jspx_meth_html_options_0(org.apache.jsp.form.editExpense_jsp:553)
....

I have the follwoing definition in struts-config.xml:

<form-bean name="editExpenseForm" type="org.apache.struts.action.DynaActionForm">
  <form-property name="expenseType" type="java.lang.String" />
  <form-property name="expenseName" type="java.lang.String" />
  <form-property name="expenseId" type="java.lang.String" />
  <form-property name="expenseDescription" type="java.lang.String" />
  <form-property name="expenseLocation" type="java.lang.String"/>
  <form-property name="expenseAmount" type="java.lang.String"/>
  <form-property name="expenseIsoCurrency" type="java.lang.String"/>
  <form-property name="expenseReceiptNo" type="java.lang.String"/>
  <form-property name="expenseTime" type="java.lang.String"/>
  <form-property name="expensePaymentMethodID" type="java.lang.String"/>
  <form-property name="expenseCrossrate" type="java.lang.String"/>
  <form-property name="expenseProjectId" type="java.lang.String"/>
</form-bean>

expenseType should be the SELECTED item of a drop-down-listbox. I do have a business object containing a java.util.Vector of expenseTypes.
In my JSP file I have:

....
<html:select property="expenseType">
  <html:options collection="${sessionScope.expense.expenseTypes}"
      property="typeCode" labelProperty="typeDescription"/>
</html:select> I also tried:

<html:select property="expenseType">
  <c:forEach items="${sessionScope.expense.expenseTypes}" var="record">
    <html:optionsCollection label="${record.typeDescription}"
        value="${record.typeCode}" />
  </c:forEach>
</html:select> but also without any success!

The business object is defined as follows with the containing class ExpenseType:

public class TxpExpense extends trixpertObject
{
  .....

  private Vector expenseTypes = new Vector();
  ......
  public synchronized Vector getExpenseTypes()
  {
    return expenseTypes;
  }
  public synchronized void setExpenseTypes(Vector expenseTypes)
  {
    this.expenseTypes = expenseTypes;
  }
  ......
  // somewhere is code which retrieves data
  // from a database to fill instances of
  // class ExpenseType into the Vector
  // expenseTypes

  //
  // an inner class as bean for ExpenseTypes
  //
  public class ExpenseType
  {
    long typeCode;
    String typeDescription;

    public ExpenseType()
    {
    }
           public ExpenseType(long typeCode, String typeDescription)
    {
      this.typeCode = typeCode;
      this.typeDescription = typeDescription;
    }

    ... correct getters and setters
  }
}



What am I doing wrong? Why can the type ExpenseType not be found? Is it a problem to define it as inner class?

Many thanks for your help!

Tom

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




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



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

Reply via email to