struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Bednarz <l...@bednarz.ch>
Subject Problems to fill a DropDownListbox on a DynaValidatorActionForm
Date Sun, 03 Sep 2006 16:45:35 GMT
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 
[ch.smartsol.bl.TxpExpense$ExpenseType@1860045, 
ch.smartsol.bl.TxpExpense$ExpenseType@7bb2cb, 
ch.smartsol.bl.TxpExpense$ExpenseType@1172fb9, 
ch.smartsol.bl.TxpExpense$ExpenseType@13e4653, 
ch.smartsol.bl.TxpExpense$ExpenseType@17b2712, 
ch.smartsol.bl.TxpExpense$ExpenseType@423da9]
	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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message