This week's book giveaway is in the Testing forum. We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line! See this thread for details.
I'm quite new to Struts and JSP's and I'm trying to iterate over an ArrayList to set some properties but I really can't figure out what is going wrong. I've looked up and tried several ways to do it and here's briefly what I've done in the jsp page :
Which gives me the error message :
strPostNeeds is the ArrayList I want to fill and has the same length as the array postNames. Maybe I should use the set method instead of get but I don't know I could do that. I've tried to make that using regular arrays instead but I need to have a dynamic one because I perform tests on all its values afterwards.
This line of your makes no sense. It is actually evaluated to:
As you can very well see, the servlet then tries to invoke that method on your beanObj and throws an exception. Also, if you're using JSTL, then there's really no need to use "logic" tags. If you can clearly state what it is you need to achieve conceptually, [copy contents of one arraylist into another?], then it'll be much easier to assist you.
Your code indicates a lack of understanding of how indexed properties work. It's not enough just to specify indexed="true". You must create an indexed getter in your form bean and name the properties appropriately.