Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSP execution order

843836Mar 22 2005 — edited Mar 24 2005
Hi 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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 21 2005
Added on Mar 22 2005
3 comments
456 views