JSP execution order
843836Mar 22 2005 — edited Mar 24 2005Hi guys,
Here is the snippet of jsp code which is giving me problem
----------------------------------------------------------------------------------------------------
<img src="ReportController?<%=queryString%>&ChartType=Clustered" useMap="#chartMap" border="0">
<%
Vector v = ( Vector )request.getSession().getAttribute( ReportController.ATTRIB_REPORT_VEC );
ChartMap cm = ( ( JCChart )v.elementAt( 1 ) ).getChartMap();
%>
----------------------------------------------------------------------------------------------------
Now in theory, forst of all img tag should call to ReportController servlet which is returning an image and setting a session vector. And then the code within <%%> should be executed. However it looks like jsp is executing code within <%%> first and then the html code (img tag). And as a result, I am getting a NULL pointer error on ChartMap cm .... line. Is there a way I can explicitly call ReportController to make sure vector v is being set before code in <%%> is executed? I've tried using jsp:include but doesn't work,
Appreciate your help,
Regards,
Hassan Sheikh.