A servlet runs a connection class to get a set of drawing numbers from an AS400 file. I want to display the result set in a pick list on a JSP so the user can get the detail info from a selected item in the list.
So far I have a java servlet that calls a class which makes a connection to the AS400 file and runs SQL statement bases on user input. I store the result set to an array using the rs.getArray(colName). Then the servlet opens the JSP which so far is blank. But I want to have a list on it of the array values which a user can select desired item and the details of that item will be displayed on another JSP.
Mirko has hit it on the head. We see nothing in your servlet that makes the value available to the JSP. The JSP cannot "see" local variables in your servlet.
Before you forward from the servlet to the JSP, create a scoped variable on the request with the data you want to send to the JSP (using request.setAttribute()).
Then use JSTL/EL on the page to access it. If you do not have the JSTL set up, now is the time. See the JSP FAQ for instructions.
Since I am setting the writerList as a session attribute why won't the following work in my JSP? If this will not work the rest of my code to fill in my drop down box will not work.
Since I am setting the writerList as a session attribute why won't the following work in my JSP?
Because you arte mixing JavaScript and Java. No can do. Perhaps this article might be helpful.
I suppose I did not post enough of my servlet code:
When are you planning to show us the whole servlet? Keeping us guessing as to how you are transitioning from the servlet to the JSP is not helping. A forward? A redirect?
In any case I don't know what a WriterList is. Does it implement List?