I have a form class where I have a String array. I am setting the value for the string array. I need to print this array values one by one in a JSP page. The code I have written is:
paxList = getPaxList(id);
List<String> passengerName = new ArrayList<String>();
List<Double> passengerAge = new ArrayList<Double>();
for(int i=0; i < paxList.size(); i++){
passengerName.add(paxList.get(i).getPassengerName());
passengerAge.add(paxList.get(i).getPassengerAge());
}
bookingsForm.setPassengerName(passengerName.toArray(new String[paxList.size()]));
bookingsForm.setPassengerAge(passengerAge.toArray(new Double[paxList.size()]));
Now I need to print the values from the PassengerName.
I tried like this in my JSP page
<logic:iterate id="currentPassName" property="passengerName" >
<bean:write name="currentPassName" />
</logic:iterate>
but this is not working for me. can someone guide me.