initializing java.util.ArrayList using spring bean -


i'm developing web application using spring 3. i'm using tomcat 6 web container.

in web.xml file bound file named applicationcontext.xml spring definition file.

<context-param>     <param-name>contextconfiglocation</param-name>     <param-value>/web-inf/applicationcontext.xml</param-value> </context-param> 

from inside applicationcontext.xml file i'm trying initialize array list variable using spring bean definition. i'm following below configurations.. (im using jidea)

<bean id="registationcontroller" class="com.test.registrationcontroller">     <property name="registrationservice" ref="registrationservice"/>     <property name="validurlslist" ref="mylist"/> </bean>  <util:list id="mylist" value-type="java.lang.string">     <value>10.1.200.104</value>     <value>10.1.200.205</value> </util:list> 

i have loaded

xmlns:util="http://www.springframework.org/schema/util" 

namespace, , in registrationcontroller.java class have generated getter , setter validurlslist variable, jidea shows definitions correct , have properyly bound vaiable bean definition. when try out code doesn't initialize validurllist variable? it's giving null value? thing i'm doing wrong here? suggestions sort out?

java code follows.,,

private arraylist validurlslist;     public void setvalidurlslist(arraylist validurlslist) {     this.validurlslist = validurlslist; }  public arraylist getvalidurlslist() {     return validurlslist; } 

then call method getremoteip passing variable follows.

if (getremoteip(req, validurlslist)) { 

-- regards,rangana

util:list creating java.util.list instance, not said create java.util.arraylist.

you should change declaration from

private arraylist validurlslist;    

to

private list validurlslist;    

(and setter , getter well).


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -