Drawing in JSP

Hi,
i would like to know if there is any way to draw pictures on the JSP homepage, for example drawing a map in the homepage line by line?
thx

You can either draw it on applet or create and image using jpeg or gif encoder and then load the image.

Similar Messages

  • Draw in JSP

    I am new to JSP Technology and in Java genarally.Can anyone tell me if i can
    draw the standard shapes in a JSP application? (like Rectangle, line etc).

    You will not be able to draw directly from JSP, but there are a few ways of going about this:
    1) Javascript:
    http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm#browser
    2) Applets
    3) Using the Java Graphics to draw the shaps, create an image from the graphics, then insert the image into the page

  • Graph drawing in JSP

    How can i get my jsp to draw a graph automatically with results from a database. The main problem is tryiing to get the JSP to display a graph. The rest I could probably figure out. Can anyone help me please??????????????????????

    or use JFreeChart. You can generate the chart image in a servlet and use an image HTML tag to show it. Search the forums, I have posted some example of that somewhere.

  • Graph drawing using JSP

    is it possible to to draw a graph in a web page automatically with results from a database.(using JSP)

    Did it took 8 months to solve it?
    Anyway, glad you got it fixed.

  • CRDB_JavaServer.ini file is missing in linux (for Crystal reports designer in Rational Application developer)

    <p>Hi </p><p>I am trying to design crystal reports in rational application developer on linux.  <br /></p><p>But I cannt find CRDB_JavaServer.ini  on linux. This file is present in Windows </p><p>in c:\program files\crystal decisions\2.5\bin path.But I cannt seem to find this file in linux.</p><p>I am running RAD 6011 ifix001,ifix002 and can see the Crystal Reports JSP Tags drawer in JSP design view.</p><p>But I cannot find "Crystal report" as one of the file types , when i right click on WebProject\WebContent folder</p><p>to create a new Crystal Report in my Web project. </p><p> </p><p>Any help would be much apprecated. </p><p>robin. </p>

    <p>I don&#39;t know much about this and I&#39;m assuming you already did a find or locate command.</p><p>Did you find a CRConfig.xml.  This file had replaced the old CRDB_JavaServer.ini in newer versions.  I&#39;m not sure which one IBM was using for this build.  If you have a support contract with IBM I would suggest talking to them as they handle first line support for this.  It could be that they forgot to include the file by mistake. </p><p>Rob Horne<br /><a href="/blog/10">Rob&#39;s blog - http://diamond.businessobjects.com/blog/10</a></p>

  • How do you make JSF draw frame in browser w/o JSP & HTML ?

    Hi all,
    I already have small web application which uses HTML & JSP and I want to convert it to JSF based application.
    I've read O'Reilly JSF books written by Hans Bergsten and in Chapter 15 he states that you can use pure Java classes only (without JSP & HTML) in your web application.
    My web application contains some frames. Since I only want to use pure Java classes using JSF what component should I use to draw frame ?
    I use MyFaces implementation of JSF.
    Any advice would be greatly appreciated.
    Best Regards,
    Setya

    I don't know anything about myFaces, but as far as I know, there is no component to draw frames. The JSF book you read is correct to a degree... It's possible to write completely with JSF tags, but it can be cumbersome sometimes.
    To output frame tags using a JSF tag, you can use one of two methods.
    First, you can use the outputText tag with escape attribute set to false.
    <h:outputText value="<FRAMESET blah blah blah>" escape="false" />The second way is to just wrap HTML in f:verbatim tags.
    <f:verbatim><FRAMESET blah blah blah></f:verbatim>If using the second method, be careful not to have any other JSF tags inside the f:verbatim tags.
    Hope this helps,
    CowKing

  • Can we draw shapes using jsp

    I am sai, i am doing a project on bpm suite. here i have to design a page where a user can draw his process diagrams which uses symbols such as circle ,rectangle,round rect, etc, ...can any one help me in doing these.i have checked java script tags ,its too complex.i have tried canvas tag i cant get it.i have checked sun.com..
    it has the answer but it uses struts frame work. but i want this code to happen at client side only..
    Is There any way to solve my problem if any plz help me

    I am also looking for a solution to this.
    I am trying to pass a parameter from JTT jsp Menu link to OA Framework Page.
    Thanks
    Srini

  • How to draw a line using JSP?

    Does anyone know how to draw a line using a JSP? Any help is much appreciated.
    Regards,
    Navin Pathuru.

    Graphics classes are useless in JSP files; you can only output HTML tags to the client browser.
    You should be able to give just about any presentation look that you need with HTML and CSS. Have you played with styles? Here's a simple example that works in IE 5+ and Netscape 4.7:
    <HTML>
    <HEAD>
    <STYLE>
    .box {
    border-style:solid;
    border-color:black;
    border-right-width: 1px;
    border-top-width: 1px;
    border-left-width: 1px;
    border-bottom-width: 1px;
    .line {
    border-right-width: 1px;
    border-top-width: 0px;
    border-left-width: 0px;
    border-bottom-width: 0px;
    border-style: solid;
    border-color: red;
    width:1pt;
    height:100%;
    </STYLE>
    </HEAD>
    <BODY>
    <TABLE CELLPADDING=1 CELLSPACING=0 WIDTH=100>
    <TR><TD ALIGN=CENTER><SPAN CLASS="box">Field One</SPAN></TD></TR>
    <TR HEIGHT=50><TD ALIGN=CENTER><SPAN CLASS="line">�</SPAN></TD></TR>
    <TR><TD ALIGN=CENTER><SPAN CLASS="box">Field Two</SPAN></TD></TR>
    <TR HEIGHT=50><TD ALIGN=CENTER WIDTH=50%><SPAN CLASS="line">�</SPAN></TD></TR>
    <TR><TD ALIGN=CENTER><SPAN CLASS="box">Field Three</SPAN></TD></TR>
    </TABLE>
    </BODY>
    </HTML>
    Have fun!

  • Problem in drawing image on the fly using jsp

    I have been searching the forum and web for the problem but in vain. I have wrote a jsp which creates an image on the fly from the data selected from the database. But after the image is drawn, it throws an IllegalStateException. The offending code is at the time of releasePageContext() method of the compiled jsp. I am using the following code in jsp to display the image.
    BufferedImage bi = obj.getBufferedImage();
    javax.imageio.ImageIO.write(bi,"png",response.getOutputStream());
    I even tried to do the same with servlet, but the problem is that when I am using forward action in jsp I am getting the image but the control is in the servlet and if I am including the servlet, I am getting junk characters instead of image. I have set the content type in servlet and also in jsp.
    Thank you in advance.

    Hi all,
    I've developed a web application using glassfish server... my database is postgresql.... i try to generate a report using Jasper Reports.... i've succesfully developed the report template..... My problem when ever i try to generate a report it gets the data from the back end.... and throws the following error.....
    StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    java.lang.IllegalStateException: getOutputStream() has already been called for this response
    at org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:652)
    at org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:196)
    at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:149)
    at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:142)
    at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:216)
    at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:134)
    at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:89)
    at org.apache.jsp.GenerateBirthCertificate_jsp._jspService(GenerateBirthCertificate_jsp.java:149)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
    at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
    at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
    at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    i've written my code in jsp.... My code is....
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page language="java" import="java.io.*, net.sf.jasperreports.engine.*, java.sql.*, 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>CDAC Portal</title>
    </head>
    <body>
    <%
    try {
    Connection con=null;
    String query="";
    String regNo="";
    regNo=request.getParameter("regNo");
    regNo = regNo.toUpperCase();
    out.println("Registration No :"+regNo);
    Class.forName("org.postgresql.Driver");
    con = DriverManager.getConnection("jdbc:postgresql://192.168.31.79:5432/Municipality","postgres","");
    System.out.println("connected succefully");
    ServletContext context = this.getServletConfig().getServletContext();
    File reportFile = new File(context.getRealPath("/reports/birth_cert.jasper"));
    query="select * from birth_details where regn_unit='"+regNo+"'";
    Map parameters = new HashMap();
    parameters.put("regNo",""+regNo);
    parameters.put("query",""+query);
    byte[] bytes = null;
    try {               
    bytes = JasperRunManager.runReportToPdf(reportFile.getPath(), parameters, con);
    response.setContentType("application/pdf");
    response.setContentLength(bytes.length);
    ServletOutputStream ouputStream = response.getOutputStream();
    ouputStream.write(bytes, 0, bytes.length);
    ouputStream.flush();
    ouputStream.close();
    } catch (JRException e) {
    System.out.println("Error : "+e);
    con.close();
    } catch(Exception exc) {
    System.out.println("Connection pool error :"+exc.toString());
    %>
    </body>
    </html>
    can anyone help me hw to solve this problem....
    Thanks in advance
    R Vijay,
    Project Engineer,
    CDAC, Chennai.
    India
    [email protected]
    [email protected]

  • How to draw an interactive network graph in JSP

    hi all,
    I want to draw a network graph in web page by reading data from database. In the graph, there are some points with lines between them. And I need some interactive features. If I put the mouse on the point, some information should be displayed. I could click the point to jump to the other pages. And I could change the layout of the network graph by dragging the point.
    JFreeChart can not draw the network graph and has limited interactive feature. Could anybody give me some solution?
    Thanks a lot!
    fancy

    u can find all what u need here:
    http://jakarta.apache.org/commons/fileupload/
    i think it will help u a lot

  • Need to draw process diagrams in JSP's

    Hi,
    I have a requirement where I need to show process diagrams, DFD's to users in JSP pages.
    Another thing is I want to allow user to update the diagram if he feels that the diagram is not proper.
    Is there any tool or API using which this can be accomplished...
    Thanks in Advance
    Gopikrishna

    Hi Corlettk,
    Can we use Microsoft Visio for dynamically generating diagrams. I think it is only for generating static diagrams.
    We want users of the portal to update the diagram if they feel something is missing or is wrong (consider it like a mini paint program) but on JSP.. (Not sure whether it is advisable or there is any simple way out there to solve this requiremnt)
    For representing nodes and links... may be we can use XML at backend....
    But not sure how to approach this problem.....
    Any input will be greatly appreciated....
    Gopikrishna

  • JInternalFrame drawing problem.

    Hi gurus
    Please could you help with a java problem that I cant find an answer to over the net:
    I have a JDesktop which contains multiple JInternalFrames. On one JInternalFrame i have attached a JPanel on which to draw on. I have multiple threads (simple ball shapes) that need to be drawn onto the JPanel and have left it up to the indivual threads to draw themselves (as opposed to using paintComponent in the JPanel class). The drawing on the JInternalFrame works perfectly fine.
    The problem arises when the other JInternalFrames are placed on top of each other - the balls are drawn over the top most JInternalFrame. What am i doing wrong? I have attached snippets of the code:
    public class Desktop extends JFrame implements ActionListener
              public Desktop()
                        setTitle("Agent's world");
                        setSize(w,h);
                        setDefaultCloseOperation(EXIT_ON_CLOSE);
                        JDesktopPane desktop = new JDesktopPane();
                        setContentPane(desktop);
                        /************* Agent *************/
                        JInternalFrame agents = new JInternalFrame("Agents War", true, false, true, false);                    
                        agents.reshape(0,0,(int)((w/3)*2),h);
                        Container contentPane = agents.getContentPane();
                        canvas = new AgentPanel(agents);
                        contentPane.add(canvas);
                        /************* Button *************/
                        JPanel buttonPanel = new JPanel();
                        ButtonGroup buttonGroup = new ButtonGroup();
                        JButton start = new JButton("START");
                        start.addActionListener(this);
                        buttonPanel.add(start);
                        contentPane.add(buttonPanel, "North");
                        agents.setVisible(true);
                        desktop.add(agents);
                        //sets focus to other frames within the desktop
                        try
                                  agents.setSelected(true);
                        catch(PropertyVetoException e)
                                  //attempt to refocus was vetoed by a frame
              /** Method to listen for event actions, i.e. button clicks **/
         public void actionPerformed(ActionEvent event)
                   //passes through 'this' to allow access to the getList method
                   Agents agent = new Agents(canvas, this);
                   agent.start();
    public class Agents extends Thread
              public Agents(AgentPanel panel, Desktop desktop)
                        panel =_panel;
                        desktop = _desktop;
                        setDaemon(true);
    /** Moves the agent from a spefic position to a new position **/
              public void move()
                        Graphics g = panel.getGraphics();
                        Graphics2D g2 = (Graphics2D)g;
                        try
                                  //set XOR mode
                                  g.setXORMode(panel.getBackground());
                                  //draw over old
                                  Ellipse2D.Double ballOld = new Ellipse2D.Double(i , j, length, length);
                                  g2.fill(ballOld);     
                                  i++;
                                  j++;
                                  if(flag == true)
                                            //draw new
                                            Ellipse2D.Double ballNew = new Ellipse2D.Double(i , j, length, length);
                                            g2.fill(ballNew);
                                            g2.setPaintMode();
                        finally
                                  g.dispose();
              /** Activates the Thread **/
              public void run()
                   int i = 0;
                   while(!interrupted() && i<100)
                        try
                                       for(i = 0 ; i <100 ; i++)
                                                 //draw ball in old position                                             move();          
                                                 sleep(100);                              
                             catch(InterruptedException e)
    public class AgentPanel extends JPanel
              /** local copy of internal frame */
              private JInternalFrame frame;
              public AgentPanel(JInternalFrame _frame)
                        frame = _frame;
                        setSize(frame.getWidth(), frame.getHeight());
                        setBackground(Color.white);          
              public void paintComponent(Graphics g)
                        super.paintComponent(g);
    Thank you in advance.
    Ravs

    I have the same problem. Seems to be a bug. See:
    http://forum.java.sun.com/thread.jsp?forum=57&thread=231037
    Bummer.

  • Trying to display results from access database query on a JSP

    Seem to be having real difficulty with this one, i keep getting a null pointer exception :(. Wondered if anyone could point me to any examples of displaying the results on jsp. The database is connected, as i can display the query on netbeans, but just not on a jsp.

    I think it would be good if we had a section in these forums for pre-canned answers to the same questions that come up again and again. It would save time.
    Here is a rough outline for using JSP:
    * Read a JSP book.
    * The JSP page (View in MVC) should get all the data it needs to display from a useBean and/or request.getAttribute().
    * The JSP page should not have any business logic. Its purpose is to display data only (and have some submit buttons such as 'update').
    You can do some basic client side validation using javascript if you want. Because there is no business logic in it, you can easily debug
    your code in the servlet or business logic. You can't set breakpoints in JSP and examine data easily.
    * When you click the submit button, all data from <input type="text" tags, etc is put into request scope via name/value pairs.
    * Submit the JSP page <form tag to a servlet (Control in MVC).
    * The servlet reads the name/value pairs of data from the JSP page via request.getParameter()
    * The servlet should then instansiate a business object (Model in MVC), passing the data it got from the page to the business logic.
    Example: ProcessPage processPage();
    if(request.getParameter("updateButtonClicked"))
    processPage.updateData(data from the jsp page)
    * The business logic should instansiate a separate database object (DAO) to get data to/from the database. Business logic should not have sql in it.
    Business logic should not generate html. Business logic should not have request objects in it.
    * The business logic should return data to the servlet that in turn will put it in request scope via request.setAttribute() so the JSP page can draw itself.
    * The servlet should then call up the approprate JSP page.

  • Showing various images on browser using JSP and Servlet

    Hello Guys!
    I am starting to develop in Java and already I am facing a big problem.
    If somebody will have some tip or suggestion, will be very well comings!
    The application must present in browser images originnally of format TIF. As it is not a native format of the I.E. , I converted the image for JPG (without saving it on disk) and send it to the browser a encoded image (encode) using JAI library in one servlet had access by a JSP. Then, the structure of my application is thus:
    1) an archive JSP draws the initial screen in browser and presents one input text.
    2) later that the user places the parameter, I make an access to the database and read a quantity of images to be presented.
    3) From there in the proper JSP, I use de tag img src to send image to the browser in agreement archive the amount of images.
    It follows the code of the JSP:
    <% 
                    int intI=0;
                    int intCont=0;
                    if(blnImagem == true){
                        out.println("<br>");
                        out.println("<table border=0 STYLE=border-collapse:collapse>");
                        out.println("<tr>");
                        for(intI=0;intI < Processo.intQtdImagens;intI++){
                           Imagem.strImgTif = Imagem.IndicarImagem(Processo.strNmPath,Processo.strSubPath,Processo.intNuImagem,intI);                                                                    
                           out.println("<th>");
                           out.println("<table border=1 STYLE=border-collapse:collapse rules='cols'>");
                           out.println("<tr>");
                           out.println("<th>");
                           %>
                             <img src="ShowImg" WIDTH=100>
                           <%
                           out.println("</th>");
                           out.println("</tr>");
                           out.println("</table>");
    %>and code on the ShowImg servlet:
            response.setContentType("image/jpeg");       
            ServletOutputStream sos = response.getOutputStream();
            RenderedOp src = JAI.create("fileload", Imagem.strImgTif);           
            ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG",sos,null);       
            encoder.encode(src); 
            sos.close();The problem is if I have 10 images to present, it WILL BE it is executed 10 times and it passes 10 names of different archives, but in the page only the last image is presented 10 times. It is as if it processed the TAG to the end of everything in way that the value of the static variable Imagem.strImgTif was chore only with the last value and the same loaded image 10 times. How I make to solve this? Somebody has some idea?
    THANK YOU !
    Emidio

    If I understand correctly what your problem is:
    Do this in the jsp:
    out.println("<img src=\"ShowImg?image=" + intI + "\" WIDTH=100>");
    In the image servlet, get the "image" parameter and parse it as an int. Move the Imagem.IndicarImagem() call to the image servlet.

  • How to use a Graphics Object in a JSP?

    Hello, I do not know if this is a good or a silly question. Can anyone tell me if we can use a Graphics object in a JSP. For example to draw a line or other graphics, i am planning to use the JSP. Any help is much appreciated.
    Regards,
    Navin Pathuru.

    Hi Rob or Jennifer, could you pour some light here.
    I have not done a lot of research for this, but what i want to do is below the polygon i would like to display another image object like a chart... is it possible? If so how to do it? Any help is much appreciated.
    here is the code:
    <%
    // Create image
    int width=200, height=200;
    BufferedImage image = new BufferedImage(width,
    height, BufferedImage.TYPE_INT_RGB);
    // Get drawing context
    Graphics g = image.getGraphics();
    // Fill background
    g.setColor(Color.white);
    g.fillRect(0, 0, width, height);
    // Create random polygon
    Polygon poly = new Polygon();
    Random random = new Random();
    for (int i=0; i < 5; i++) {
    poly.addPoint(random.nextInt(width),
    random.nextInt(height));
    // Fill polygon
    g.setColor(Color.cyan);
    g.fillPolygon(poly);
    // Dispose context
    g.dispose();
    // Send back image
    ServletOutputStream sos = response.getOutputStream();
    JPEGImageEncoder encoder =
    JPEGCodec.createJPEGEncoder(sos);
    encoder.encode(image);
    %>
    Regards,
    Navin Pathuru

Maybe you are looking for

  • Scheduling Back Ground job

    Hi All, I need to schedule a daily background job for MB52 transaction and need to save the output of MB52 in a specified directory . Can any one tell me whether it is possible to save back ground job output in specified directory? Thanks & Regards k

  • The state of ID3v2 support in the Linux console

    Being a Windows user that only recently started to gain a genuine interest in adding Linux to my list of proficiencies, my music collection is 90% composed of MP3 files with ID3v2 tags; a sort of expected setup on Windows machines. I particularly enj

  • Need help using a modem....

    does anyone have a modem program using labview 5.01..my project intails me on using a modem to send a alpha-numeric page once a certian threshold level has surpassed the limit any suggestions or solution is greatly appreciated.... thanks [See first a

  • Max length name of Attribute/Entity

    Hello! I want create name of Attribute more than 50 characters, but MDS 2014 does not do it. Is it possible?

  • Javascript set date function sequence issue

    This is a javascript date error that occurs in FireFox, Chrome and IE. In setting the date using utc functions the order in which the functions are used can cause the wrong date set be set. var d = new Date(); d.setUTCFullYear(2012,1,26); correctly s