Reputation: 5012
I have a code like
<% int myvar =20; %>
I wish to access it via JSP tags, is something like this possible?
${pageScope.myvar}
Upvotes: 1
Views: 76
Reputation: 94645
Scriptlet variables are created in service method and hence they have local scope so the
EL cannot evaluate them. The EL
operates upon scoped variables - page scope, request,
session and application scope.
Upvotes: 1
Reputation: 921
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
--<c:set var="myvar" scope="page" value = " value="${20}" />
<c:out value = "${pageScope.str}" /> ---
Try above code
Upvotes: 1