You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Jon.Ridgway" <Jo...@upco.co.uk> on 2002/07/03 12:09:31 UTC

Editing a List of Strings

Hi All,
 
I believe this should be possible, but can't find a way to make it work...
 
I have a List of Strings within a logic:iterate block and want to edit them
using html:text. This tag however requires a property attribute so the
RequestUtils.populate method knows which setter to call when the form is
submitted. As a String doesn't have a getter or setter I can't see a way to
make this work. Is there a way?
 
I have tried changing the struts-html.tld so that property is not required
and I'm currently looking at the RequestUtils source to see if I can make it
work; I thought I'd better check with you lot however before I waste anymore
time, there must be a way to edit a List of Strings???
 
Jon
 

The contents of this email are intended only for the named addressees and
may contain confidential and/or privileged material. If received in error
please contact UPCO on +44 (0) 113 201 0600 and then delete the entire
e-mail from your system. Unauthorised review, distribution, disclosure or
other use of this information could constitute a breach of confidence. Your
co-operation in this matter is greatly appreciated. 

Editing a List of Strings

Posted by ri...@dcs.bbk.ac.uk.
Jon.Ridgway writes:
 > I have a List of Strings within a logic:iterate block and want to edit them
 > using html:text. This tag however requires a property attribute so the
 > RequestUtils.populate method knows which setter to call when the form is
 > submitted. As a String doesn't have a getter or setter I can't see a way to
 > make this work. Is there a way?

It's a bit of a hack, but you could try this (I haven't tested it, so excuse
any typos, but should you get the idea :

public class StringBean {
	String string;
	public StringBean(String string) { this.string = string; }
	public String getString() { return string; }
	public void setString(String string) { this.string = string; }
	public String toString() { return string; }
}

Then make your collection a set of stringbeans instead of strings ?

Richard

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>