People,
I have been going through Deshmukh's studykit and came across the following lines:
Using request Time attributes:
JSP expressions can be used to pass values to action attributes.
<% String pageURL = "copyRight.html" ; %>
< jsp:include file = "<%=pageURL %>" />
The expression here is not printed to the output stream but is evaluated at the request time and is passed to the page attribute of the include action.
An important point to note here is that such a mechanism of passing request time attributes is not valid in case of directives.
Thus,
<%! String bSize = "32kb";
String pageURL = "copyRight.html"
%>
<%@ page buffer = "<%=bSize %>" />
<%@ inlcude file = "<=pageURL %>" %> are not valid.
Now,
1. I understand that I can't use an expression as a value to an attribute of a directive. But why is the second line ( passing the same expression value to an action) not valid?
2. I tried both of the variations in my code and in both cases I am getting errors in compilation. The error I am getting is
file pageURL not found.. What am I doing wrong?
Any inputs appreciated in advance.
Thanks,
vasu
[ November 14, 2002: Message edited by: vasu maj ]