tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bergsten <>
Subject Re: How to maintain collections with JSTL?
Date Fri, 15 Nov 2002 16:34:11 GMT
Zaretzke, Peter wrote:
> [...]
> But how to add a new items to the collections? I tried this
> 	<c:set target="${testbean}" property="list" value="${myvalue}"/>
> But this bean method 
> 	public void setList( String value ) {
> 		list.add ( value );
> 	}
> does not work because it does not meet the parameter expectations ( List vs.
> String ) for beans.
> I know that I can write more setZZZ() methods to add something to the List
> but it breaks somehow the naming conventions for beans (getXxx, setXxx). And
> how to add a new entry to the map? 

It should work as long as the value can be converted to a String (which
is almost always the case, see the EL type coersion rules). What kind of
error do you see? If you want to avoid convertion to String, change the
setList() method to take an Object instead of a String.

Hans Bergsten                                <>
Gefion Software                       <>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message