Well, the number of arguments is part of the method signature. In your case a dynamic object would be ideal, and if you don't want to use an array you could ever use a Collection, which offers the add(Object element), remove(Object element) methods, thus allowing for dynamicity. The Collection package (java.util) offers also great flexibility as it manage collection through the core interfaces and each implementation class has methods to convert one collection type to another.
If I understood your design, the user chooses incrementally the fields to add to the query, thus the Collection.add(Object element) and Collection.remove(Object element) methods could be suitable in your case. The Collection package offers also methods to convert Collections to array with the Collection.toArray() (or Collection.toArray(object[] array) methods). This way your method has to define only one argument (a Collection) and you can play with it from within your method. Hope it will help, Marco ORIGINAL MESSAGE: Message-ID: <[EMAIL PROTECTED]> From: "David Erickson" <[EMAIL PROTECTED]> To: "Struts Mailing List" <[EMAIL PROTECTED]> Subject: Quick Java question.. Date: Thu, 21 Aug 2003 16:00:12 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hey as I've been building my actions I was thinking it could be useful for me to have a method that does some database querying, but I would like to give the user the ability to narrow down that query with as many input fields as he needs. Is there a way to write a method that takes a non-set amount of arguments? (Other than just passing the method a growable array.. which is a viable alternative) Ie public String myfunction(String a, String b, String c.... on down the line indefinitly) ? I thought I had seen this done somewhere somehow but I may be wrong. Thanks!