:( Perhaps my idea does not work... I just tested it and it never
gets to call any of the set methods...is what i was talking about
unrealistic? isn't something like this desirable? is there a better
way? it just throws the following exceptions
Internal Servlet Error:
javax.servlet.ServletException: BeanUtils.populate
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.(Compiled Code)
at java.lang.Exception.(Compiled Code)
at javax.servlet.ServletException.(ServletException.java:132)
at org.apache.struts.util.BeanUtils.populate(Compiled Code)
at
org.apache.struts.action.ActionServlet.processActionForm(ActionServlet.java:754)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:697)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:332)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(Compiled Code)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Compiled
Code)
at org.apache.tomcat.service.TcpConnectionThread.run(Compiled
Code)
at java.lang.Thread.run(Compiled Code)
Root cause:
java.lang.IllegalArgumentException: Argument Type Mismatch
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at org.apache.struts.util.BeanUtils.populate(Compiled Code)
at org.apache.struts.util.BeanUtils.populate(Compiled Code)
at
org.apache.struts.action.ActionServlet.processActionForm(ActionServlet.java:754)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:697)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:332)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.handleRequest(Compiled Code)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Compiled
Code)
at org.apache.tomcat.service.TcpConnectionThread.run(Compiled
Code)
at java.lang.Thread.run(Compiled Code)
On Mon, Nov 06, 2000 at 08:52:27PM -0600, Eric wrote:
> Ya, I kind of phrased it poorly. I had been doing this with a bunch
> of servlets that called request.getParameter in a loop. In that
> situation, I had a bunch of form parameters like this:
>
> Zoo1Animal1
> Zoo1Animal2
> Zoo1Animal3
> Zoo2Animal1
> Zoo2Animal2
>
> But I want to switch over to JSP (and struts) to clean things up a bit.
>
> I was looking for the best way to get these into a bean (since a
> simple setProperty * doesn't do this kind of stuff) and I didn't want
> to define fields in the bean like "Zoo1Animal1" because that seems
> really dirty to me. I don't think the whole "iterate" thing is
> relevant...isn't that just for output?
>
> The way that I believe I have found to be best (I haven't tested it
> yet and it's fairly undocumented) is to create a bean with an array
> of different beans property such as "AnimalForm[] Zoos" and then in the
> other bean (AnimalForm) have an array of strings property such as
> "String[] Animals". Then, I set up my jsp page to have form inputs
> such as:
>
>
>
> Does this sound reasonable? Will it work?
>
> thanks,
> eric.
>
> On Mon, Nov 06, 2000 at 07:33:33PM -0500, Gigen Thomas wrote:
> > Hi There,
> >
> > I am not really sure that I understood ur question. Anyway
> > Well if its a bunch of values that you want to store and want to iterate
> > through these values , you can have a Collection within ur Bean and then
> > have get and set methods to access this Collection.
> >
> > Regards,
> > Gigen
> >
> >
> > - Original Message -
> > From: Eric <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, November 06, 2000 3:06 AM
> > Subject: iterative (list-type) form parameters
> >
> >
> > > I haven't been able to find a good solution for this
> > > anywhere...someone must do something decently elegant...
> > >
> > > Many of the forms that I have have parameters that repeat iteratively
> > > (lists of things) like "Param1, Param2, ..."
> > >
> > > What is the best way to get these into a bean? I hate to define a
> > > bunch of properties in the bean for a fixed number of them... I know
> > > I could use the array type of property in the bean, but is there a way
> > > to get the parameters in there easily? What about parameters that are
> > > multiply iterative like "Param1Sub1, Param1Sub2, Param2Sub1,
> > > Param2Sub2, ..."?
> > >
> > >