package com.michaelmcgrady.util.list;
import java.util.Collection; import java.util.List;
import com.michaelmcgrady.exception.ChainedException;
public interface ListIterator { public void setList(List list) throws ChainedException; public Collection getList(); public int getSize() throws ChainedException; public void setIndex(int index) throws ChainedException; public int getCurrentIndex() throws ChainedException; public Object getCurrentElement() throws ChainedException; public List getPreviousElements(int count) throws ChainedException; public List getPreviousElements() throws ChainedException; public List getNextElements(int count) throws ChainedException; public List getNextElements() throws ChainedException; public void resetIndex() throws ChainedException; } /// ;-)
This is what I use and it is lightening fast and works the way the design was promised to work. You can work out what you do with the newer "c" el stuff, but I have done it the following way in code I have not changed:
<nested:define id='list_handler' type='com.michaelmcgrady.user.ListHandler' scope='session'/>
<nested:root name='list_handler'>
<logic:iterate id='users' name='list_handler' property='list'>
<hr color='<bean:write name="gui_data" property="view.lgnDrkClr" />'>
id: <bean:write name='users' property='id'/> <br>
username <bean:write name='users' property='username'/> <br>
password <bean:write name='users' property='password'/> <br>
name <bean:write name='users' property='name'/> <br>
email <bean:write name='users' property='email'/> <br>
type <bean:write name='users' property='type'/> <br>
status <bean:write name='users' property='status'/> <br>
time <bean:write name='users' property='time'/> <br>
</logic:iterate>
</nested:root>
Hope this helps. Don't know anything about dynamically uploading applets, do you? I cannot seem to get that right.
Regards,
Michael McGrady At 01:46 PM 1/9/2004, you wrote:
I have a String[] property in a DynaValidatorForm. It works fine with multiple checkboxes and accepts multiple selections.
Now I need to do an "advanced" user interface, where the user can enter the information in text boxes and click 'Add'. Behind the scenes I need to populate that String[] property (which is named 'accounts').
I don't want to deal with checking the size of the array and the inevitable out of bounds exceptions, so I thought ArrayList would be a better choice. However, when I change to ArrayList, including struts-config.xml:
<form-property name="accounts" type="java.util.ArrayList"/>
BeanUtils complains when I submit the form that has the multiple checkboxes:
org.apache.commons.beanutils.ConversionException: Cannot assign value of type 'java.lang.String' to property 'accounts' of type 'java.util.ArrayList'
The docs indicate that ArrayList is allowed in DynaActionForms (mine is a DynaValidatorForm): http://jakarta.apache.org/struts/userGuide/building_controller.html#dyna _action_form_classes
The multibox tag is: <c:forEach items="${accountMap[accountForm.map.calendarYear]}" var="account" > <html-el:multibox property="accounts"> <c:out value="${account.key}"/> </html-el:multibox> <c:out value="${account.key}"/> <c:out value="${account.costCenterDesc}"/> <br/> </c:forEach>
Which correctly renders checkboxes such as <input type="checkbox" name="accounts" value="55_U_ABCD1234">55_U_ABCD1234 Some Account<br/> <input type="checkbox" name="accounts" value="66_S_EFGH5678">66_S_EFGH5678 Some Other Account<br/>
Any idea what I'm doing wrong, or is there a better way to do this?
-- Wendy Smoak Application Systems Analyst, Sr. ASU IA Information Resources Management
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]