Is it possible to set an object in an action form to an object from a list using an <html:select>?

My code is:

struts-config:
<form-bean
  name="activityForm"
  type="org.apache.struts.validator.DynaValidatorForm">
  <form-property name="activityType" type="ActivityType"/>
  <form-property name="activityTypes" type="java.util.ArrayList"/>
</form-bean>

ActivityType bean:
public class ActivityType {
 private long id;
 private String name;

 public String getName(){ return name; }
 public void setName(String name){ this.name = name; }

 public long getId(){ return id; }
 public void setId(long id){ this.id = id; }
}

jsp snippet:
<html:select name="activityForm" property="activityType">
 <html:optionsCollection
   name="activityForm"
   property="activityTypes"
   value="id"
   label="name"/>
</html:select>


This obviously doesn't work, because I am trying to assign a long to an object.


Is there another way to do this? Has it been discussed before?

TIA

Russell

-------------------------------
This email message and any attachment(s) is intended only for the person(s) or entity(entities) to whom it is addressed. The information it contains may be classified as IN CONFIDENCE and may be
legally privileged. If you are not the intended recipient any use,
disclosure or copying of the message or attachment(s) is strictly prohibited. If you have received this message in error please notify us immediately and destroy it and any attachment(s).
Thank you. The Ministry of Social Development accepts no
responsibility for changes made to this message or to any
attachment(s) after transmission from the Ministry.
-------------------------------



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



Reply via email to