if i do this, it says "cannot find symbol:x". Is there anyway i can access x outside that scriptlet tag?
<%
String x="abc";
%>
<%
System.out.println(x);
%>
You can access x by expression tag(<%= %>). You can try the following code :
<%
String x="abc";
%>
<%=x %>