Graphs in JSP/Servlets.

Hi,
i have to plot different kind of graphs/charts in my web application. can somebody suggest how best i can do this.

You can use http://www.jfree.org/jfreechart/.
If you want to use taglibs: http://cewolf.sourceforge.net
HTH
Andi

Similar Messages

  • How do i Create charts using JSP/Servlet & Database

    I have to create charts which shows the graph of stock exchange.
    i have a database that keeps the data for creating charts.
    But i did not know how to create charts using jsp-servlet.
    Any Example might help me to go forward.
    Any help will be really appreciated.
    Please Advice me.

    JFreeChart - You can generate the charts then convert them to image formats (PNG and JPEG) all using the JFreeChart API
    http://www.jfree.org/jfreechart/

  • How can i display data on tha same page in jsp/servlet

    Hello friend,
    I am storing 50 items in a dataBase. i ve two buttons/links name previous and next. i ve to display 10 items each time in the same page when i click next button and the revrese for previous. through JSP/Servlet.
    Any suggestions will be appreciated.
    chintan anand

    I'm not sure this is the best practice... try to add the item in the arraylist, then when u click next button, add 10 to the counter. subtract if it is a previous button. thats it!
    ex..
    for(int x=counter;x<=arraylist.lenght();x++)
    ....print item here......
    }

  • How to install eclipse and MyEclipse and use it for jsp-servlet-web service

    hi ,
    please help me to install eclipse 3.1 and How to integrate MyEclipse to do jsp-servlet programming and web services.
    please also help me to include application server like tomcat and axis and use that environment in MyEclipse ide.
    please help me.....

    At the time of installation , you can't change SID XE.
    After installation, you can add another service name
    Check following thread for more details
    Re: How to create service on Oracle 10g XE
    - Virag Sharma
    http://virag.sharma.googlepages.com
    http://viragsharma.blogspot.com

  • Using JSP/Servlet to write Word Document to BLOB

    Hi
    I need some help pls
    When I use a normal class with a main method, it loads the word document into a blob and I can read this 100%.Stunning.
    With a JSP/Servlet I cannot get the document out again. The "format" seems to be lost.
    Any ideas,help greatly appreciated:
    Here is the Main class that works:
    package mypackage1;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class TestLOB
    //static final Logger logger = Logger.getLogger("test");
    public TestLOB()
    public static void main(String args[])
    TestLOB testLOB = new TestLOB();
    testLOB.TestLOBInsert("c:\\my_data\\callcenterpilot.doc");
    public void TestLOBInsert(String fileName)
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    File binaryFile = new File(fileName);
    System.out.println("Document length = " + binaryFile.length());
    FileInputStream instream = new FileInputStream(binaryFile);
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    DriverManager.registerDriver(new OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@oraclu5:1600:dwz110","so_cs","so_cs");
    catch (Exception ex)
    System.out.println("Error getting conn"+ex.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.out.println("Error closing connection in get last imei"+se.toString());
    Works fine:
    Here is the display servlet: Works when main class inserts file
    package mypackage1;
    import java.io.InputStream;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.*;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class DisplayLOB extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    static final Logger logger = Logger.getLogger(DisplayLOB.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    //response.setContentType(CONTENT_TYPE);
    //PrintWriter out = response.getWriter();
    Connection conn = null;
    PreparedStatement pstmt = null;
    try
    conn = getConnection("wizard");
    //out.println("<html>");
    //out.println("<head><title>DisplayLOB</title></head>");
    //out.println("<body>");
    //out.println("<p>The servlet has received a POST. This is the reply.</p>");
    InputStream is=null;
    oracle.sql.BLOB blob=null;
    response.setContentType("application/msword");
    //response.setContentType("audio/mpeg");
    OutputStream os = response.getOutputStream();
    String term = "1";
    String query = "SELECT docdetail FROM testlob WHERE docno = 1";
    pstmt = conn.prepareStatement(query);
    ResultSet rs = pstmt.executeQuery();
    while (rs.next())
    blob=((OracleResultSet)rs).getBLOB(1);
    is=blob.getBinaryStream();
    int pos=0;
    int length=0;
    byte[] b = new byte[blob.getChunkSize()];
    while((length=is.read(b))!= -1)
    pos+=length;
    os.write(b);
    }//try
    catch (Exception se)
    se.printStackTrace();
    finally
    try
    pstmt.close();
    catch (Exception ex)
    System.out.println("Error closing pstmt "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    logger.fatal("Error getting connection: ",se);
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    logger.error("Error closing connection in get last imei",se);
    Here is JSP/Servlet
    <%@ page import="org.apache.log4j.*"%>
    <%@ page contentType="text/html; charset=ISO-8859-1" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>untitled</title>
    <title>Wizard SMS Interface</title>
    <link rel='stylesheet' type='text/css' href='main1.css'>
    <script language='JavaScript' src='copyright.js'></script>
    </head>
    <pre>
    <%
    //HTTP 1.1
    response.setHeader("Cache-Control","no-cache");
    //HTTP 1.0
    response.setHeader("Pragma","no-cache");
    //prevents caching at the proxy server
    response.setDateHeader ("Expires", 0);
    Logger logger = Logger.getLogger("co.za.mtn.wizard.administration.admin01.jsp");
    %>
    </pre>
    <body>
    <FORM ACTION="/WizardAdministration/uploadfile"
    METHOD="POST"
    ENCTYPE="multipart/form-data">
    <INPUT TYPE="FILE" NAME="example">
    <INPUT TYPE="SUBMIT" NAME="button" VALUE="Upload">
    </FORM>
    </body>
    </html>
    <font> <b>Copyright &copy;
    <script>
    var LMDate = new Date( document.lastModified );
    year = LMDate.getYear();
    document.write(display(year));
    </script>
    Mobile Telephone Networks.
    <p align="left"><i><b><font face="Georgia, Times New Roman, Times, serif" size="1"></font></b></i></p>
    package co.za.mtn.wizard.admin;
    import java.io.InputStream;
    import java.util.Enumeration;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.Writer;
    import java.sql.Connection;
    import oracle.jdbc.OracleResultSet;
    import oracle.sql.BLOB;
    import org.apache.log4j.Logger;
    import Util_Connect.DataBase;
    public class UploadFile extends HttpServlet
    private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
    //static final Logger logger = Logger.getLogger(UploadFile.class);
    public void init(ServletConfig config) throws ServletException
    super.init(config);
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    String headerName = null;
    Enumeration en = request.getHeaderNames();
    try
    while ( en.hasMoreElements() )
    Object ob = en.nextElement();
    headerName = ob.toString();
    System.out.println("Value for headerNAme is >"+headerName+"<");
    String aaa = request.getHeader(headerName);
    System.out.println("Value for aa is >"+aaa+"<");
    catch (Exception ex)
    System.out.println("Error in extracting request headers"+ex.toString());
    Connection conn = getConnection("wizard");
    BLOB blob = null;
    try
    conn.setAutoCommit(false);
    String cmd = "SELECT * FROM so_cs.testlob WHERE docno = 1 FOR UPDATE";
    PreparedStatement pstmt = conn.prepareStatement(cmd);
    ResultSet rset = pstmt.executeQuery(cmd);
    rset.next();
    blob = ((OracleResultSet)rset).getBLOB(2);
    //File binaryFile = new File("h:\\callcenterpilot.doc");
    //System.out.println("Document length = " + binaryFile.length());
    //FileInputStream instream = new FileInputStream(binaryFile);
    response.setHeader("Content-Type","application/vnd.ms-word");
    String contentType = request.getContentType();
    System.out.println("Content type received in servlet is >"+contentType+"<");
    ServletInputStream instream = request.getInputStream();
    OutputStream outstream = blob.getBinaryOutputStream();
    int size = blob.getBufferSize();
    byte[] buffer = new byte[size];
    int length = -1;
    while ((length = instream.read(buffer)) != -1)
    outstream.write(buffer, 0, length);
    instream.close();
    outstream.close();
    conn.commit();
    closeConnection(conn);
    response.setContentType(CONTENT_TYPE);
    PrintWriter out = response.getWriter();
    catch (Exception ex)
    System.out.println("Error =- > "+ex.toString());
    //out.println("</body></html>");
    //out.close();
    private Connection getConnection(String dataBase)
    Connection conn = null;
    try
    conn = DataBase.getPoolConnection(dataBase);
    catch (Exception se)
    System.err.println("Error getting connection: "+se.toString());
    return conn;
    private void closeConnection(Connection conn)
    if (conn != null)
    try
    conn.close();
    catch (Exception se)
    System.err.println("Error closing connection in get last imei"+se.toString());
    This is what the display servlet is showing when the JSP/Servlet insert the document
    -----------------------------7d31422224030e
    Content-Disposition: form-data; name="example"; filename="H:\(your name) Skills Matrix.doc"
    Content-Type: application/msword
    �� ࡱ � > ��     � � ���� � � ���������������������
    Tks
    Andre

    hello,
    there are multiple documents out there, describing the oracle reports server setup. try doc.oracle.com for documentation.
    also it is part of the online-documentation.
    you need to install 9iAS enterprise edition. the server is pre-configured and will listen to the url http://yourserver/dev60cgi/rwcgi60.exe
    passing only this url you will get a help-screen, describing the syntax.
    regards,
    the oracle reports team

  • How can I call EJB from JSP/Servlets in iWS?

    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

    Park,
    Why Are you running your JSP/Servlets in iWS instead of iAS? For whatever
    reason,
    look at the Converter sample from iAS. You will be doing RMI/IIOP in this
    case and the sample explains in detail what to do.
    hth,
    -robert
    "SungHyun, Park" <[email protected]> wrote in message
    news:9jpfmt$[email protected]..
    Hi!!
    My JSP/Servlets are on iWS, and I deploy EJB on iAS.
    In this case, I don't know how JSP/Servlet call EJb on iAS.
    I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
    I will thank you if you give me a simple example source using JSP/Servlet
    and EJB.
    Thanks in advance!!!
    - Park-

  • How to use connection pool in jsp/servlet ?

    I found I can "lookup" it in either java beans/servlets/JSP using JNDI. why?
    what is the best practice to use it in a jsp/servlet web app considering JNDI lookuping expensive?
    Thanks!
    Bo
    Edited by: BobXu on Nov 17, 2008 2:27 PM
    Edited by: BobXu on Nov 17, 2008 2:32 PM

    Huh?
    You can lookup a JNDI resource from anywhere in java code you want to. As long as you have a repository set up to search on :-)
    Of course whether that resource is available or not is a different matter. If you let the server set up the JNDI resource for you, then you can't run it standalone outside the server without something else setting the same thing up :-)
    So its not so much a limitation of beans, but just the environment you run the code in.
    Best practice? Don't write sql queries in JSP pages :-)
    For the rest you might consider the DAO pattern. Or ignore SQL altogether and let hibernate do the work there for you.
    Cheers,
    evnafets

  • How to implement this function in JSP/Servlet env?

    Hi all,
    I working on a project, it provides functionality to upload file using JSP/Servlet. In the first JSP page, there is file location and submit button. After user select a file to upload and click submit button, a message, like "sending file to XXXX", will be shown on the screen. Once uploading and validation are done on the server-side, a successful/error msg will be shown to user.
    Here I have a question for the "sending..." msg and the successful/error msg. They should be put in one jsp page or in two separate page? how to implement them?
    Thanks for any help!
    Tranquil

    For the sending message... Well, the thing is, when you click submit, it's sending the file to the server and the server is processing it, and this is all done before the "complete" page is sent to the server. So one would need to use some Javascript on the page before the actual submit happens to show some message. This is done on Ebay when you put something for sale, you can upload an image, and there is a little popup message telling you that it's uploading, and it is removed when the process is done. Now, I'm not sure the exact details of how this works, but my educated guess is this:
    1) The onsubmit function of the form checks that the file upload fields have a value (no need to popup a message if no file upload, since that's what usually takes the time, although it could just be assumed there is a file). If a file is to be uploaded, or just want to show the message anyway, a new popup window is opened with the window.open method and the "sending" message is shown (either written via Javascript or just load a small web page to the window).
    2) The popup window, since you can't transfer the window object from the form page to the next page, has to check window.opener for some value that the success/error page would have to set. The success/error page could use it's body onload function to set a variable in it's own window object to denote that the page is loaded. The popup window can use a looping check using setTimeout or setInterval in Javascript to check for window.opener.isLoadedVariable to be present, and if so, close itself.
    I've never done that, but I see no reason why it wouldn't work.

  • Upload video by using jsp/servlet

    I'm using jsp/servlet to upload video file but I have a problem.
    This error occurs for preparing SQL statement when I cast OraclePreparedStatement.
    It is " Error : weblogic.jdbc.rmi.SerialPreparedStatement
    at jsp_servlet._upload._jspService(_upload.java:185)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:263)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:200)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:2390)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:1959)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)"
    Please help me asap.
    Thanks

    You need to use the Oracle jdbc driver. Apparently, the Weblogic JDBC driver is being selected:
    weblogic.jdbc.rmi.SerialPreparedStatement
    The Oracle JDBC classes can be found in <ORACLE_HOME>/jdbc/lib/See <ORACLE_HOME>/jdbc/readme.txt for how to specify the correct class path in the application.
    I would have thought that the oracle JDBC driver would have been selected (if in the classpath) or an exception would be raised if the Oracle JDBC driver was not found.... because the code should include:
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    This should load the Oracle jdbc driver and classes, not the weblogic ones. IF the Oracle JDBC drivers are not found, an exception should be raised...

  • File upload and download using jsp/servlets

    How to upload any file to the server using jsp/servlets. . Help me out

    You can also try the Jenkov HTTP Multipart File Upload. It's a servlet filter that is easy to add to your web-project. After adding it, you can access both request parameters and the uploaded files easily. It's more transparent than Apache Commons File Upload. There is sufficient documentation to get you started, and there is a forum if you have any questions.
    Jenkov HTTP Multipart File Upload is available under the Apache license, meaning its free to use.

  • Separate jsp/servlets from EJBs for petstore

    By default, petstore deploy all the web apps and EJBs in one ear. I am trying to
    separate the JSP/servlets to deploy to diffent machine. I need to modify the client
    InitialContext to point to the remote server. I took a look at the source and
    there are many places using the default constructor of InitialContext to load
    the default URL. I wrote a jndi.properties file that has the correct url and put
    this to the classpath. I know this file needs to be put to the working directory,
    too. In case of pet store web application, what should be the working directory?
    Thanks, Cathy

    I'm also interested in running the Pet Store application server and the database
    (Oracle prefered) on different systems.
    Is this configurable during runtime or does it require code modification, compilation
    and deployment?
    Thanks,
    TL

  • Is there any JSP/servlet opensource project like phpMyAdmin?

    Is there any JSP/servlet opensource project existed which is designed to manipulate the database MySQL such as phpMyAdmin?
    I would like to gain the source code and reference to its design pattern.

    I don't know about PHPMYAdmin but MySqlAdmin can do any job you need
    http://www.skillipedia.com

  • Jsp / Servlet / bean / upload

    Hello,
    I use a jsp to enter several fields. These fields are sent to a servlet by using a bean (recorded in the current session). Until now there is no problem. The servlet receives all information. Now I must also send 5 files which must be stored on the server. I have thus to add in my jsp 5 file fields.
    My question :
    Is it possible to integrate the FileUpload package for uploader my files without anything to change in my code (by using of a bean to exchange the data between my jsp and my servlet). ??
    In other words, it is possible to use my bean to also transport files. ??
    Tank u for u help

    Yes it is possible..
    download cos.jar from www.oreily.com for file upload..
    it will read dat from the form as two parts ..
    parameter part and file part..
    and you can implement it throgh a servlet easily..
    for more follow oreily JSP/servlets Cookbook

  • Jsp,servlet,bean question,please help

    The Tomcat Web server set up like this.......
    The directory structure is
    e:/sampleapp/WEB-INF/classes
    /lib
    And the web.xml is in the WEB-INF for the use of ay potential servlet.
    The basic understanding is that all the .java files go into the WEB-INF directory and the .class files go into the classes directory.
    All the .jsp files go into the sampleapp directory.Till here is correct I feel.
    Now for my qustion......
    I plan to use jsp,servlet and beans for a potential web application...,where do all these files go?,just the same as above or is there a difference.
    Hope that I have given a reasonable explaination to my question.
    Thanks for any replies
    AS

    All of your compiled servlet and java bean (java
    classes in general) will be placed into the following
    directory (under a directory structure matching the
    java package they are in):
    e:/sampleapp/WEB-INF/classesAll of your .jar files that are used as libraries (not
    your .jar files for applets):
    e:/sampleapp/WEB-INF/libAll of the rest of your JSP files, javascript files,
    HTML files, JAR files, images files, etc. will go into
    the following directory:
    e:/sampleappYou must make sure you put your sampleapp directory
    where tomcat can load it. Or use the admin tool to
    load it. If you make a .WAR file with a corresponding
    web.xml file in it, it will simplify loading it into
    tomcat. It also will help you do your servlet
    mappings, etc. I hope this helps.Thanks for your timely response.To add to it,let me tell you.
    The <b>bean</b> files are put into a package right,so they should be put into the WEB-INF/classes/<package name>
    What about The <b> servlet </b> files...... they are just put into the WEB-INF/classes/ directory????
    Kindly let me know.
    Thanks
    AS

  • JSP- Servlet-- Bean-- JSP how to implement

    I have problem.
    My JSP will take a emplyee id .
    Now I want to show all the values regarding that employee in a JSP(JSP form) from the DB(Oracle).
    So Iam planning like
    JSP-->Servlet-->Bean-->JSP
    So my doubts are.
    1. Is it correct approach
    2.If it is correct then which part of the flow connects to DB and stores the value before putting to JSP.
    Iam using Tomcat 4.31
    Plz help me

    I have problem.
    My JSP will take a emplyee id .
    Now I want to show all the values regarding that
    employee in a JSP(JSP form) from the DB(Oracle).
    So Iam planning like
    JSP-->Servlet-->Bean-->JSP
    So my doubts are.
    1. Is it correct approach
    2.If it is correct then which part of the flow
    connects to DB and stores the value before putting to
    JSP.
    Iam using Tomcat 4.31
    Plz help meHI
    What you are probably proposing is an MVC design pattern. I wonder if u have heard of the struts framework. Sruts uses MVC design pattern wherein the servlet u are talking about acts as a controller(C) and the bean acts as the model(M) .The JSPs present the view(V). Hence the name MVC.
    Your approach is right. First get the employee ID from the jsp and get the corresponding data from database(This logic u implement in the servlet). Then save the fetched data in a bean so that the result jsp can fetch data from it.
    Now this is not a strict MVC approach.
    Learn more about struts. It presents a much more cleaner solution.

Maybe you are looking for

  • Column headers and data are mismatched in Data tab of views after move col.

    Hi, Currently, I am using Windows XP, SQL Developer Version 1.2.1 Build Main 32.13. Java platform 1.5.0_06 Oracle IDE 1.2.1.3213 I'm having trouble with display of data from views in the "Data" tab of SQL Developer. If I move a column left or right o

  • Thunderbolt Not reading Battery Correctly

    Hey there! I have been searching the net for this particular problem I am having and sofar have found nothing, so I was hoping maybe you guys could help me out. My Thunderbolt after fully charging the battery will show at the highest about 60% batter

  • Can we replace components in same location?

    I am trying to add a new functionality to my swing gui panel. the requirement is something like this. i have two JList components on my JPanel. One to the left and one to the right. in between there is a "add" button. when i select items from left JL

  • AEBS 802.11n, TC and APXn with 7.3.1 is very flaky indeed - cant connect -

    HI Guys I think many of you on these forums have posted because you are having joyless experiences with the new APX 802.11n, the AEBSn and the TC not able to be managed via the AIRPORT UTILITY.app v5.3.2 with firmware 7.3.1 in the former devices. Aft

  • Add user in ACS with limited access

    Dear I have low experiance with cisco ACS So kindly i need help to add user to The ACS which has limited access to my network Switches ( As Show only not to change configuration ) Also how to take backup for the ACS Database Thanks,