I am new to JSP. I am writing a JSP page named as success.jsp
.
In my success.jsp
, I am creating a String[]
array.
<% String[] s={"A","B","C"};
request.setAttribute("a",s);
%>
<br>
<c:forEach var="x" items="${a}">
<c:out value="${pageScope.x}"/><br>
</c:forEach>
In above JSP page, my doubts are
By default, Why is that
String[]
array in the "scriptlet" is not created in any of the JSP scopes (i.e., page, request, application)? Hence, I explicitly set that array in request scope.By default, Why the variable
x
, is created in the "page scope?"What makes situation 1 different from situation 2 ?