2012-07-02 1 views
0

를 통해 서블릿 변수를 검색 :내가이 사용하는 전달을 전달하는 메신저 내 서블릿에서 문자열의 ArrayList를이 JSTL

//in servlet 

ArrayList<String> output = new ArrayList<String>(); 
//populate arraylist with values here 

//forward the string 
request.setAttribute("myData ", output); 
request.getRequestDispatcher("Home.jsp").forward(request, response); 

내가 scriplet 표기법이 액세스 할 수 있다는 사실을 알고 :

ArrayList<String> myData = (ArrayList<String>)request.getAttribute("myData"); 

방법을 이 jstl에 액세스합니까?

답변

1

<c:forEach />을 사용하여 목록을 반복 할 수 있습니다 (JSTL 참조 문서).

<c:forEach var="name" items="${myData}"> 
    <br/>${name} 
</c:forEach>