How to produce a graph in the jsp page dynamically

I want to generate a graph dynamically in my jsp page, depending on the data in my database. Please help how can i do this and the possible ways to do this.

What you need to do is to represent the graph as an image on some part of the page, using an IMG tag.
That means you need a second transaction to fetch the image data, and you need to tie the two together.
The standard approach is to use a servlet to deliver the image, and the src URL generated on your HTML output has some kind of token to identify which graph is to be delivered. So the intial transaction creates a indetifier of some kind, which is likely used to identify image data accessed from session context. Then, when the browser interprets the HTML, it sends a request to the server for the image, which the servlet then generates based on the identifier.
If you use JFreeChart much of this stuff is available from the library.

Similar Messages

  • How does session bean contain in the JSP page

    May i know how session bean contains in the JSP page
    If the situation is like the following ...
    if i dont want to put the session bean in the session
    like this :
    session.setAttribute("UserBean",userBean);
    the way i get the session bean is only
    session.getAttribute("UserBean");
    Does have the other way to get the Session bean during the JSP
    if i dont want to use this kind of way,
    what else i can do for?
    may i know the solution with detailed
    and please attach the solution of code to me if you know...
    thanks...

    Hi,
    I am not clear with ur query..
    What I understood from ur query is that, u are trying to put the session ejb in the HttpSession Object for some use ahead in future?
    If this is the case, then I think are approach is not correct.
    StatefulSession beans are meant for this purpose, i.e they will be maintaining the client session. So use the same using the JndiLookup of the HomeInterface and the getting the Home reference and calling the businessmethods
    sameer

  • How to display japanese charecters in the JSP page

    Hi,
    Below is my jsp page where i am trying to read the japan character from the properties file
    through the Resource bundle.
    ===============================================
    <%@page contentType="text/html" %>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import ="java.util.*" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
         <title>JSP Page</title>
    </head>
    <body>
    <h1>JSP Page</h1>
    <%Locale locale = new Locale(request.getParameter("country"));
    ResourceBundle bundle = ResourceBundle.getBundle("com.sunit.regtool.resources.RegTool",locale);
    String namelabel =bundle.getString("userName");
    String passwordlabel= bundle.getString("password");
    %>
    <%=namelabel %>
    </body>
    </html>
    =========================================================
    In the above code i am getting the value of the country from request object i.e its value
    will be en for English ,ja for japanese etc.
    I am able to get the value from Resource bundle but when my country is japan
    i am not able to see the same japan characters in the browser when i get the JSP on the browser at runtime .
    It shows me " �����&#133;� &#136;�&#131;&#149;�&#130;��&#131;��&#131;��&#131;&#137;" where the charecters are different.
    But when i see in the properties file it is fine.
    Please help me what need to be done furher for this.
    Thanks,
    Kiran

    I think you need to install japanese language fonts in your browser.

  • How do i use Connection pool in JSP pages

    Hey everyone,
    I am using a connection pool in my web application. I am using DbConnectionBroker from Javaexchange.com. It has a class that creates a connection pool available for the servlets. I am trying to figure out that how to use connection pool within the JSP pages if I want to connect to the database. In the servlets i am using DBConnectionBroker pool = (DbConnectionBroker) getServletContext().getAttribute("dbPool") to get database connection. How Can i use this in JSP page to get a db connection.
    Thanks

    If the reference to the connection pool is already stored as an ServletContex attribute, try:
    <jsp:useBean id="dbPool" scope="application" class="com.javaexchange.dbConnectionBroker" />
    <%
    Connection con = dbPool.getConnection();
    %>

  • Post messages on the jsp page

    This is my jsf(jsp) page:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
    <%@ taglib prefix="f"  uri="http://java.sun.com/jsf/core"%>
    <%@ taglib prefix="h"  uri="http://java.sun.com/jsf/html"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <f:view>
    <h1 align="center">File Selection Page</h1>
    <h:panelGroup>
    <form id="uploadForm" method="post" action="Multipart.do" enctype="multipart/form-data">
        Specify your name:<br />
        <input type="text" name="name"><br /><br />
        Specify your files: <br />
        <input type="file" name="file1"><br /><br />
         <input type="file" name="file2"><br /><br />
         <input type="file" name="file3"><br /><br />
        <input type="file" name="file4"><br /><br />
    <br><br>
    <center>
    <input type="submit" name="Submit" value="Submit Your Files">
    </center>
    </form>
    </f:view>
    </body>
    </html>I am using apache commons multipart file upload. How do I post success or failure messages to this page?
    As you see I am using a servlet(not shown - which uses Faces Context to populate the messages). Not sure how to get these out in the jsp page.
    Thanks,
    Sonia
    Edited by: sun_sonia on Nov 23, 2009 2:42 PM

    You're using plain HTML <input type="file"> elements. Use Tomahawk's <t:inputFileUpload> components instead of you want to make use of JSF's validation and messaging capabilities.
    If you insist in using a servlet instead of a bean for this, then just do all the usual JSP/Servlet way. My suggestion would be to hold a Map<String, String> which contains the fieldname-message pairs which you store in the request scope and then use the usual JSP/EL way to display them.

  • How to use custome tag lib in the JSP page?

    How to use custome tag lib in the JSP page?...with JDeveloper

    http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/navId.4/navSetId._/vtTopicFile.working_with_jsp_pages%7Cjsp_ptagsregistering~html/

  • How to get the jsp page name in jsp?

    how to get the jsp page name in jsp? how the jsp get the jsp page name dynamic.
    thanks in advance.

    Try request.getServletPath()

  • How to load only the jsp page even after applying template

    Hi,
    I have a webpage template with header,footer, Dynamic Menu etc. Now I assigned this .jtpl template to all my existing fases jsp files.
    The problem is when I submit a form in jsp, the entire page including template gets loaded again by which we can notice significant time for loading menus and other things.
    Is there any way to avoid this entire template loading and make only the jsp page to load? Please help
    May be this can be achieved by frames. But I dont have idea on how I can merge template with frames. If someone can provide that even would help me better.
    Thanks in advance.

    Hi
    I found the solution .
    <html>
    <head>
    <script language="JavaScript">
    function checkRefresh()
    if( document.refreshForm.visited.value == "" )
    alert('first ime');
      // This is a fresh page load
      document.refreshForm.visited.value = "1";
      // You may want to add code here special for
      // fresh page loads
    else
    </script>
    </head>
    <body onLoad="JavaScript:checkRefresh();">
    <form name="refreshForm">
    <input type="hidden" name="visited" value="" />
    </form>
    </body>
    </html>

  • How to test the JSP pages and sevlets using JUnit. ?

    How to test the JSP pages using JUnit. How to configure what are all the steps to execute the JUnit test cases.

    Hi xiepei,
    since you are using modbus, a simple error checking is implicit in the protocol and is the comparison between returned checksum and the calculated one on the received message: checksum errors, if any, are an effect of communications errors (you should have at least 2 bits changed and on particular patterns to have the checksum be calculated correctly!). You won't be able to calculate BER on them, but you can calculate PER (Packet Error Rate).
    Another flag for communication errors, on the other direction, is to intercept error messages from the device: if it fully implements modbus protocol, it should return some warning in case of error (I seem to remember that in some cases it returns the reveived message with some error bits added: please check in modbus documentation).
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How do i retrieve information from the JSP into my SELECT statements?

    I need to retrieve the information that is being entered into JSP page.. So that i can use them to do an SQL statement.. but im not very sure if my codes are correct.. Following are my codes.. Pls help.. thx
    MyJSPPage.jsp
    <jsp:useBean id="user" class="user.User" scope="session"/>
    <form name="loanItem" method ="POST" action="user">
    <input type="hidden" name="userID" value="<jsp:getProperty name="user" property="userID"/>">
         <tr><td align=left height="34"> <b> <font size="4">Member ID:</font>
    </b> </td>
              <td height="34">
              <jsp:getProperty name="user" property="userID"/></td>
         </tr>     
    ==================================================================================
    MyManager.java --> this file is where all my SQL statements are ..
    [l]String itemType = session.getParameter("itemType");[l] (--->> is how i retrieve info from the JSP page?)
              if (itemType.equals("Book"))
                   String sqlQuery1 = "select loanDuration from ItemPolicy where itemType ='" + itemType+ "'";
                   System.out.println(sqlQuery1);
                   ItemPolicy itempolicy = null;
                   try {
                        db = new Database();
                        rs = db.readRequest(sqlQuery1);
                        if (rs != null && rs.next()) {
                             itempolicy = new ItemPolicy();
                             itempolicy.setLoanDuration(Integer.parseInt(rs.getString("loanDuration")));
                        db.close();
                   } catch (SQLException se) {
                                  se.printStackTrace();
                                  throw (new UserException("Unable to retrieve from Database!"));
                             } catch (Exception e) {
                                  e.printStackTrace();
                                  throw (new UserException("Unknow error encountered!"));
                   String dueDate = util.getDueDate(itempolicy.getLoanDuration());
              else if (itemType.equals("Magazine"))
    ==================================================================================
    Thanks in advance...

    you should change to request.getParameter("itemType").
    or just System.out.print the itemType to see it got the value.
    Hope it helps.

  • How to increase the size of textbox in the .jsp page of Human Workflow

    Hi All,
    I need to increase the size of the textbox in the .jsp page of Human Task.
    I am showint some text in the textbox which are currently not editable, and as the length of textbox is small, the complete text is not visible.
    If anyone know how to customize the jsp page of Human Task, please share.
    Regards,
    Vivek

    Thanks Eric,
    but i think this one is different.
    I am trying to edit the source of .jsp page in JDev. which has the code for textbox as below:
    <%=getField(payload, form, context, thisDisabled, locale, task, "CustID", "/ns0:task/ns0:payload/ns1:Customer_Verification_Data/ns1:Company_Information/ns1:CustID", "string")%>
    now how can i add some class format in .css file and how will i access that particular class in this textbox.
    Thanks,
    Vivek

  • How to call an exe program from the JSP page?

    How to call and display the interface from a exe (residing on C: drive) on my JSP page. Our customers supplied us with an exe file and they want this to be incorporated on the JSP page that has other components also, like forms, etc. The interface of the program has to be displayed in specific co-ordinates on the JSP page. Any help is highly appreciated. Thanks in advance.

    Can't be done with JSP.
    JSP runs java on the SERVER only.
    All that gets to client is an HTML page. So all that
    you can do at the client is what an HTML page can do.
    Obviously that doesn't include running a file on the
    client machine.
    Take a look into Applets, or maybe ActiveX controls.Thanks for the reply.
    Any idea on how to use the ActiveX controls in this regard?

  • How to query from view with parameter, only  when the JSP-page loading

    I use JSF/ADF BC, create two viewes:view1 and view2, in the JSP page the user press a button to query from the view1, but I hope the view2 can be queried only when the page loading, it have no relation with user-operator, and pass the column value of view2 into some variables, the view2 return one record.

    Hi -
    You may want to have a look at this other thread:
    Re: Execute ViewObject with Parameters at JSF Page Load?  JSF/ADF/BC 10.1.3
    John

  • Help needed urgently to get the values from the jsp page.

    hi,
    I am badly stuck into this problem.Please help me and find a solution.
    I am using ms-access and jsp.
    my database structure is as given below:
    m_emp_no | from_date | to_date | approver| status |
    1002 | 22/9/2008 | 23/9/2008|1003 |pending
    1004 | 29/9/2008 | 30/9/2008|1003 |pending
    2044 | 15/9/2008 | 16/9/2008|3076 |pending
    now this is exactly a leave apply scenario where a page is displayed and the user has to fill in the details to apply leave.then the approver has to approve that leaves so even, he should get the details in his account.
    for example here 1003 has to approve leaves for 1002 & 1004.i am able to fetch data from database for the particular approver here is the coding:
    <html>
    <body>
    <h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
    Approval Requests</font></span></b></u></h2>
    <form method="POST" name="f1" action="update.jsp">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
    PreparedStatement p=null;
    p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
    ResultSet r=p.executeQuery();
    while(r.next())
    %>  <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
        <tr>
          <td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
        </tr>
      </table>
      <table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
        <tr>
          <td width="100%" height="165" valign="top">
            <p align="left"><b>User ID</b>        :
    <input type="text" name="id" value="<%=r.getString(1)%>"  size="4   
         <b>status</b>:<%=r.getString(5)%</p>
    <p><b>Leave From</b> : <%=r.getString(2)%></p>
    <p><b>Leave From</b> : <%=r.getString(3)%></p>
    <p><b>Approve</b> : <select  size="1" name="approved">
            <option value="Approved">Approved</option>
            <option value="Cancelled">Cancelled</option>        </select></p>
    <%
    con.close();
    %>
      <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
              <tr>
                <td width="100%" bgcolor="#999966">
                  <p align="center"><input type="reset" value="Clear" name="B1"> 
                  <input type="submit" value="Submit" name="B2"></td>
              </tr>
            </table>
            </td>
        </tr>
      </table>
    </form>
    </body>
    </html>{code}
    this will display both the rows but when i try to retrieve the values into update.jsp using the code given below it gives me only one value which is the first 1002.
    {code}approved=(String)request.getParameter("approved");
    id=(String)request.getParameter("id");{code}
    but i need both the values to be inserted into the update.jsp only then the approver will be able to approve the leaves individually with respect to the m_emp_no.
    please help me out.
    thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    My comments below are all between (((((( and ))))))
    <html>
    <body>
    <h2 align="center"><u><b><span style="background-color: #FFFFFF"><font color="#C0C0C0" face="Comic Sans MS">Leave
    Approval Requests</font></span></b></u></h2>
    <form method="POST" name="f1" action="update.jsp">
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:employee_details");
    PreparedStatement p=null;
    p=con.prepareStatement("select * from emp_leave_application where approver='"+username+"'");
    ResultSet r=p.executeQuery();
    while(r.next())
    %> <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" bgcolor="#999966"><b><u><%=r.getString(2)%></u></b></td>
    </tr>
    </table>
    <table border="1" width="100%" height="171" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" height="165" valign="top">
    <p align="left"><b>User ID</b> :
    <input type="text" name="id" value="<%=r.getString(1)%>" size="4   
    ((((((( in the statement above, name="id" should be changed to something like name="id"<%=ii%>
    Where ii is a counter that tells you how many times you have gone through the loop so far.
    The reason for this is that each textfield you generate must have a unique name rather than all have the same name
    such as 'id'. This change will give them names such as id0, id1, id2. Then when you submit the page, you can uniquely
    identify each input textfield.))))))
    <b>status</b>:<%=r.getString(5)%</p>
    <p><b>Leave From</b> : <%=r.getString(2)%></p>
    <p><b>Leave From</b> : <%=r.getString(3)%></p>
    <p><b>Approve</b> : <select size="1" name="approved">
    (((( the above select also has to have a unique name for each time through the loop. Change it to name="approved"<%=ii%>
    <option value="Approved">Approved</option>
    <option value="Cancelled">Cancelled</option> </select></p>
    <%
    con.close();
    %>
    <table border="1" width="100%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF">
    <tr>
    <td width="100%" bgcolor="#999966">
    <p align="center"><input type="reset" value="Clear" name="B1">
    <input type="submit" value="Submit" name="B2"></td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    (((((((note you would be better off long term to put your business logic in a servlet and dispatch to the JSP page which will only have the responsiblity to display the data.
    Also, connection pooling is better than the above.

  • Find in the filename of the jsp page that is included

    i have a main.jsp that includes a menu.jsp page dynamically :
    if (request.getParameter("view")!=null){
                   include_h_menu_page = request.getParameter("view);
    <jsp:include page="<%= include_h_menu_page%>"/>
    now i am in the menu.jsp and here i want to find out the given name of the page. In my case i want to recive back "menu.jsp". How can i do it?

    Remember, that your JSP get's compiled into a servlet!
    You are able to get the name of this servlet-class, which may look like:
    org.apache.jsp.path.to.your.main_jspbut I think the name can change depending on your appserver.
    For this you should be able to usethis.getClass().getName()

Maybe you are looking for

  • Ftp over ssl

    Hi All, I would like to check if it is possible to have a ftp server (ftp over ssl) hosted externally to be accessible via the cisco switches, routers etc? Can this result be achieved? Thanks Alex

  • CME SIP issue - Cisco 7821 phone not registering

    Hi I am having issues with getting a Cisco 7821 phone to register. Current deployment is with Cisco 6921 phones SCCP registration SIP integration with CUE SIP integration with Mitel system c2951-universalk9-mz.SPA.154-3.M1.bin (CME 10.5) In flash: ro

  • Is there any way we can stop dehydration store

    Hi All, Is there anyway we can stop dehydration store in the BPEL,i have two BPEL process deployed in the SOA Suite.i want to make sure that one BPEL should not get impacted by dehydrations Store. Please share your views. Thanks, Murali.

  • Creating mp4 movie from m4v elementary streams

    Hello, I have some mpeg 4 video elementary streams. Those streams were extracted from MXF proxy files originally recorded with Sony's XDCam. Using ffmpeg I'm able to convert those streams into valid (muxed) mpeg 4 movies that Quicktime is able to pla

  • Macbook Pro suddenly slow

    Hey everyone,      Lately I've noticed that my Early 2011 Mabook Pro has been running slower and slower. I find myself seeing more of the running beach ball lately and not sure what has happened. I haven't installed anything new other than updates, a