how to pass string array from action class to jsp page? pls reply me.
You can use session.setAttribute() and session.getAttribute() methods. In your action class,
String[] arr = {"A","B","C","D"}; for (int x = 0; x < arr .length; x++) { out.println(arr[x]); } session.setAttribute("names", arr);
And through your jsp page, get array values.
<% try { String[] str = (String[]) session.getAttribute("names"); for (int x = 0; x < str.length; x++) { out.println(str[x]); } } catch (Exception e) { out.println(e); } %>
but, we can not use java code in jsp. with out using java code in jsp, is it possible?
Ads