I got your code to run (paseted below). Just so I am sure I am doing what you are trying to do:
1. I made no changes to Setter or SetterList so that I don't break your design. Only to the action and the jsp 2. I assume what you want is to be able to display and edit and create the settings (I did not do delete)? 3. I assume you are using Struts 2.1.6 (I should have asked -- sorry) Some observations: 1. You don't need a converter at all. Why? Because you are sending the title and value as separate Strings and want to create a Settings object with those items as its state. Instantiating an object and injecting it with a couple of Strings does not require a converter. If you have a String representation of the Setting as a whole (e.g. "theTitle&theValue) then you would need a converter to parse the String and create a Setting object. 2. You don't need entries in *-converters.xml Why? Becaus of 1. 3. You don't need to expose?a property of type StringList. Why? Your JSP only uses the fact that it is a List<Setting>. StringList is an implementation. So you only need a getter/setter that returns/takes a ?List<Setting>? Note: I am posting from Japan and I noticed I sometimes get characters that are non-printing here appearing in the paste -- I think it is the encoding so please clean it up if that happens Action: public class SettingAction extends ActionSupport { ?private static final long serialVersionUID = -7082992787920559583L; ?private Setting newSetting; ?private SettingList settings = new SettingList(); ?public String execute() { ??if (newSetting != null) { ???//give it an id ???newSetting.setId("" + settings.size()); ???settings.add(newSetting); ??} ??return SUCCESS; ?} ?public void setSettings(List<Setting> settings) { ??this.settings = new SettingList(); ??for (Setting setting : settings) { ???this.settings.add(setting); ??} ?} ?public List<Setting> getSettings() { ??return settings; ?} ?public Setting getNewSetting() { ??return newSetting; ?} ?public void setNewSetting(Setting newSetting) { ??this.newSetting = newSetting; ?}; } JSP: <s:form action="setting"> ?<s:iterator value="%{settings}" status="rowstatus"> ??<tr> ???<th> ????<input? ????name='settings[<s:property value="#rowstatus.index" />].title' ????value='<s:property value="title" />' type="hidden" /> ???? ????<label?for='setting_<s:property value="id" />'> ????<s:property value="title" />: </label> ???</th> ???<td> ????<input id='setting_<s:property value="id" />' ????name='settings[<s:property value="#rowstatus.index" />].value' ????value='<s:property value="value" />' /></td> ??</tr> ?</s:iterator> ?<s:label value="New Setting" /> ?<s:textfield name="newSetting.title" label="Title"></s:textfield> ?<s:textfield name="newSetting.value" label="Value"></s:textfield> ?<s:submit /> </s:form> Cheers Chris M -----Original Message----- From: ryangr <grigg...@gmail.com> To: user@struts.apache.org Sent: Wed, 18 Mar 2009 10:55 pm Subject: Re: Type conversion exceptions Here is the converter code: http://pastie.org/419709 Obviously it isn't doing anything other than outputting the values being passed in, but none of the values contain anything yet as the parameters are getting lost somewhere so there's no point in processing them yet. musomesa wrote: > > I have downloaded your code and will study it so that I don't > misunderstand. Can you also post the converter? > If I see it I might?suggestions that fit what you are doing better. > Chris > -- View this message in context: http://www.nabble.com/Type-conversion-exceptions-tp22497261p22579161.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org