0

hi everyone,

Am doing project for profit and loss account,I need to display daily expediences in graph format for that am using jquery bar graph its working separately when i integrate its not working properly.

i used the following code for forward ..

request.setAttribute("listvalue", list);
RequestDispatcher dispatcher = request.getRequestDispatcher("/ViewProfitLoss.jsp");
dispatcher.forward( request, response);

but when i call the jsp file through the follwing code the graph is working

response.sendRedirect("/ViewProfitLoss.jsp");

pls help me
Thanks in advance

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by anand01
0

thanks for Ur replay javaAddict,

ya I can print all the data.That is not an issue

my jsp code

<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.ArrayList"%>
<%@page import="BalanceSheet.UserBean"%>

<html >
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Profit and Loss A/C</title>
  <!--[if lt IE 9]><script language="javascript" type="text/javascript" src="../excanvas.js"></script><![endif]-->
  
  <link rel="stylesheet" type="text/css" href="jquery.jqplot.css" />

  
  <!-- BEGIN: load jquery -->
  <script language="javascript" type="text/javascript" src="jquery.js"></script>
  <!-- END: load jquery -->
  <!-- BEGIN: load jqplot -->
  <script language="javascript" type="text/javascript" src="jquery.jqplot.js"></script>
  <script language="javascript" type="text/javascript" src="plugins/jqplot.barRenderer.js"></script>
  <script language="javascript" type="text/javascript" src="plugins/jqplot.pieRenderer.js"></script>
  <script language="javascript" type="text/javascript" src="plugins/jqplot.categoryAxisRenderer.js"></script>
  <script language="javascript" type="text/javascript" src="plugins/jqplot.highlighter.js"></script>
  <script language="javascript" type="text/javascript" src="plugins/jqplot.pointLabels.js"></script>
  <!-- END: load jqplot -->

  <style type="text/css">
    .jqplot-target {
        margin-bottom: 2em;
    }
    
    pre {
        background: #D8F4DC;
        border: 1px solid rgb(200, 200, 200);
        padding-top: 1em;
        padding-left: 3em;
        padding-bottom: 1em;
        margin-top: 1em;
        margin-bottom: 4em;
        
    }
    
    p {
        margin: 2em 0;
    }
    
    .note {
        font-size: 0.8em;
    }
  </style>
  
  
    
  <script class="code" type="text/javascript">$(document).ready(function(){
        
	  <%
		  out.println("var s1 = [2, 6, 7, 10,15,20,75,100];");
		  out.println("var s2 = [7, 5, 3, 0,10,30,20,100];");
		  out.println("var ticks = ['a', 'b', 'c', 'd','e','f','g','i','j','k','l'];");
		  %>
	  	plot2 = $.jqplot('chart2', [s1, s2], {
	  	 seriesDefaults: {
	  	 renderer:$.jqplot.BarRenderer,  pointLabels: { show: true } },  axes: {
                xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: ticks
                }
            }
        });
    
        $('#chart2').bind('jqplotDataHighlight', 
            function (ev, seriesIndex, pointIndex, data) {
                $('#info2').html('series: '+seriesIndex+', point: '+pointIndex+', data: '+data);
            }
        );
            
        $('#chart2').bind('jqplotDataUnhighlight', 
            function (ev) {
                $('#info2').html('Nothing');
            }
        );
    });</script>
    
  </head>
  <body>
  
     <p>
 
<div id=chart2 style=margin-top:20px;margin-left:20px;width:600px;height:400px;>
</div>
<%

UserBean user = new UserBean();
ArrayList<UserBean> list;
list =(ArrayList<UserBean>) request.getAttribute("listvalue");
out.println("<table border=1 cellspacing=0 cellpadding=5>");
out.println("<tr class=colour > <th colspan=3 scope=col>EXPENSES</th><th colspan=3 scope=col><p>INCOME </p></th></tr>");
out.println("<tr class=colour align=center ><td >Date</td><td >Description</td><td >Amount </td><td >Date </td><td  >Description</td><td >Amount </td></tr>");
float flIncome=0,flExpenses=0;
for(int i=0; i < list.size(); i++)
{
	
	user = (UserBean) list.get(i);
	if(user.getInvoiceType().equals("income"))
	{
		out.println("<tr>");
		out.println("<td ></td><td ></td><td ></td>");
		out.println("<td>");
		out.println(user.getDate());
		out.println("</td>");
		out.println("<td>");
		out.println("From  "+user.getInvoiceFromTo()+"("+user.getRep()+")");
		out.println("</td>");
		out.println("<td align=right>");
		out.println(user.getAmount());
		flIncome+=user.getAmount();
		out.println("</td>");
		out.println("</tr>");	
		
	}
	else{
		
		
		out.println("<tr >");
		out.println("<td>");
		out.println(user.getDate());
		out.println("</td>");
		out.println("<td>");
		out.println("To  "+user.getInvoiceFromTo()+"("+user.getRep()+")");
		out.println("</td>");
		out.println("<td align=right>");
		out.println(user.getAmount());
		flExpenses+=user.getAmount();
		out.println("</td>");
		out.println("<td ></td><td ></td><td ></td>");
		out.println("</tr>");
		
		
	}
}
out.println("<tr align=right><td colspan=2>Tolal Expenses</td>");
out.println("<td>"+flExpenses+"</td>");
out.println("<td colspan=2> Total Income</td>");
out.println("<td >"+flIncome+"</td>");
out.println("</tr>");
out.println("<tr align=center><td colspan=6>Profit and Loss : "+(flIncome-flExpenses)+"</td>");
out.println("</table>");
%>
	 
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.