You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rajil <ra...@appliedcommerce.com> on 2008/11/26 13:46:29 UTC

Struts - indexed property problem with jdk1.5 - overloaded get/set method with same name - for Struts Team

Hello everyone;

 

I am using jdk1.4, struts1.0 and tomcat4.1 for my application.  And I wanted
to upgrade my application to jdk1.5.

 

Struts1.0 had some problem with jdk1.5.  I was not able to interpret two
property with the same name, one is indexed and other is not.

 

E.g.   I have one ActionForm namely BrokerList.java.

 

.

String brokerName;

ArrayList brokers;          // list of Broker Beans

.

 

And following get/set methods.

 

Public String getBrokerName()

.

 

Public void setBrokerName(String brokerName)

.

 

Public String getBrokerName(int index)

{

            Return ( (broker)Brokers.get(i) ).getBrokerName();

}

 

Public String setBrokerName(int index, String brokerName)

{

             ( (Broker)brokers.get(i) ).setBrokerName(brokerName);

}

 

You can imagine the code for JSP also.  User is able to enter multiple
brokers from single JSP.

 

Now, this code was running fine under jdk1.4.  But this code doesn't run
under jdk1.5.

 

This gets confused when it find 2 get/set methods with the same name.  But
they are actually different considering parameter "index".  It's overloaded
method.

 

I solved this issue by writing my own
org.apache.struts.util.PropertyUtils.java  class to handle this situation.
(from struts.jar)

 

Can anybody tell me.. from what version of struts this issue is resolved???

 

Actually, I am on the way to upgrade my application to better version of
struts where I don't have to change in-built classes.

 

This issue can be better understood by Struts Team.  If you don't understand
my question let me know to explain more.  Your help is appreciated.

 

 

regards,

Rajil Davda