<%@ page language="java" contentType="image/gif" import="java.awt.*,java.awt.image.*,java.io.*,java.util.*" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>

</HEAD>

    <jsp:useBean id="epm" scope="session" class="EnergyProfileManager"/>

<body>

<%

            int fuel = epm.getFuelWC();
            String itemTitle = epm.getItemTitleWC();
            boolean success = epm.processForBarChart(fuel,itemTitle);
            if(success) {
                BufferedImage bi = epm.getBufferedImage();
                if(bi != null) {
                    request.setAttribute("image",bi);
                 
				    //RequestDispatcher rd = request.getRequestDispatcher("/dyn_img");		
					RequestDispatcher rd = application.getRequestDispatcher("/dyn_img");			   				 						 
                    System.out.println(" update 9:13" );
					if( rd != null)
                       rd.forward(request,response);
					   //Remember that the forward method should be used to give another resource 
					   //the responsibility of replying to the user.
					   // If you have already accessed a ServletOutputStream or PrintWriter object, 
					   // you cannot use this method; it throws an IllegalStateException. Use include instead

					   //rd.include(request,response);
		            else
					    System.out.println(" rd is NULL"); 			
					System.out.println(" item title : " + itemTitle );
                } //

                else {

                    %>
                        <p>Image is null</p>
                    <%

                    System.out.println("EPM.jsp, bi is null");

                } //



            } //if(success)




%>


</body>
</HTML>


