I h开发者_如何学Pythonave a method in a java class that returns an ArrayList of a particular class type. How can it be passed as a request parameter?
in your servlet
request.setParameter("dataList",methodThatReturnsList());//and forward this request to jsp
on jsp
<c:forEach var="data" item="dataList">
${data}
</c:forEach>
Correcting Jigar Joshi:
request.setAttribute("dataList",methodThatReturnsList());//and forward this request to jsp
But this is not a parameter. The request parameters can only be strings (or string arrays), and are generated when you submit a form or you attach the parameters in the query string of an url.
精彩评论