Hello, I have 2 string arrays (contact and contactid) that I want to use in a jstl c:forEach to produce select options. So far I have the code below - it puts contactid values into options value, but now how do I open a reference to contact array AND insert the data into options text? Thank you in advance.
Assuming that both arrays are the same length, and that the order of their entries correpsond, you could do this by traversing one array and using the index to grab references from the other.
But, I don't do it this way. When passing information to the JSP to contruct an options list, I use a Map implementation where the entry key is used as the option value and the entry value as the display text. That way it's a better abstraction, and you only have to traverse one construct.
If there is a chance that either entry could contain characters needed encoding, you would also use <cut> to encode the values as you did in your original post.