How to display graphics dynamically in JSP

I use JSP to call a servlet to get the output . The output is in svg format. I do not hope to create a svg file to store the output from servlet. I wope to embed the svg dynamically in the jsp page
Anybody knows the solution. Many thanks in advance
Cheers,
.

Because the output from Servlet is in text format not binary.
So the tag <IMAG></IMAG> does not work .
the output is similar as
<svg viewBox="0 0 360 270">
<style type="text/css"><![CDATA[
.aS{ font-family: monospace; text-anchor: middle;
font-size: 35px; stroke: Blue; fill: Red; }
]]></style>
     <g>
<text x="60" y="90">+2%</text>
<polyline points=" 110,80 110,80 210,80 210,80" />
<text x="60" y="180">-2%</text>
<line x1="110" y1="170" x2="210" y2="170" />
<line x1="110" y1="120" x2="210" y2="120" />
<text x="280" y="130">4:0</text>
<text x="160" y="200">1</text>
<text x="110" y="150">-</text>
<text x="185" y="50">Sample - Name</text>
<text x="185" y="240">Minutes/km (2003/1/7)</text>
     </g>
</svg>
If I keep the output as a **.svg file. then embed it in jsp. it is OK.

Similar Messages

  • How to display  servlet dynamically generated image ?

    Hi,
    How to display servlet dynamically generated image ?
    I have a servlet generating a buffered image in the doGet. I want to display the image in a jsp page with other information. I'm not able to get it properly displayed.
    **Try n# 1 **************************************************************
    This displays my image but nothing elle :
    ServletOutputStream sos = pResponse.getOutputStream();
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);
    encoder.encode(img);
    **Try n# 2 ****************************************************************
    I tried also :
    In the servlet :
         request.setAttribute("renderedImage", img);
    and in the jsp page :
         BufferedImage image = (BufferedImage) request.getAttribute("renderedImage");
         <img src="<%=ImageIO.write(image,"jpeg",response.getOutputStream())%>" width="300" height="280"/>
    This last try draws big crap in the jsp page, thank you in advance.
    Nelson

    Call another servlet from the IMG tag. Have the servlet stream out the image using ImageIO (instead of writing HTML).

  • How to change images dynamically in jsp?

    Hi All,
    i Want to know how to change images dynamically in jsp, for example in any site if u look at advertise or any images, it will be changed after every few seconds.
    Please guide me
    Thanks
    Sandesh S

    sandeshas wrote:
    Hi BlusC,
    i was searching your mail Id to ask the question directly to u,i checked in your blog also, but i didnt get,I want to keep my email spam safe. Only trusted people and direct friends have it. Just use the forums for discussion.
    my question is suppose if i want to display and change the advertise(adds from different company ) in my web site,how can i do it by using jsp?
    Do i need to create animated gifs which contains all company adds??one might be from movie add,after few seconds next one migth be some other web site add like that, how can i achieve this in my servet,jsp or using struts.You create animated gifs with an [animated gif editor|http://google.com/search?q=animated+gif+editor]. There is nothing what JSP can do for you here.

  • How to display a dynamic image file from url?

    Hey,I want to display a dynamic image file from url in applet.For example,a jpg file which from one video camera server,store one frame pictur for ever.My java file looks like here:
    //PlayJpg.java:
    import java.awt.*;
    import java.applet.*;
    import java.net.*;
    public class PlayJpg extends Applet implements Runnable {
    public static void main(String args[]) {
    Frame F=new Frame("My Applet/Application Window");
    F.setSize(480, 240);
    PlayJpg A = new PlayJpg();
    F.add(A);
    A.start(); // Web browser calls start() automatically
    // A.init(); - we skip calling it this time
    // because it contains only Applet specific tasks.
    F.setVisible(true);
    Thread count = null;
    String urlStr = null;
    int sleepTime = 0;
    Image image = null;
    // called only for an applet - unless called explicitely by an appliaction
    public void init() {
                   sleepTime = Integer.parseInt(getParameter("refreshTime"));
              urlStr = getParameter("jpgFile");
    // called only for an applet - unless called explicitely by an appliaction
    public void start() {
    count=(new Thread(this));
    count.start();
    // called only for applet when the browser leaves the web page
    public void stop() {
    count=null;
    public void paint(Graphics g) {
    try{
    URL location=new URL(urlStr);
    image = getToolkit().getImage(location);
    }catch (MalformedURLException mue) {
                   showStatus (mue.toString());
              }catch(Exception e){
              System.out.println("Sorry. System Caught Exception in paint().");
              System.out.println("e.getMessage():" + e.getMessage());
              System.out.println("e.toString():" + e.toString());
              System.out.println("e.printStackTrace():" );
              e.printStackTrace();
    if (image!=null) g.drawImage(image,1,1,320,240,this);
    // called each time the display needs to be repainted
    public void run() {
    while (count==Thread.currentThread()) {
    try {
    Thread.currentThread().sleep(sleepTime*1000);
    } catch(Exception e) {}
    repaint(); // forces update of the screen
    // end of PlayJpg.java
    My Html file looks like here:
    <html>
    <applet code="PlayJpg.class" width=320 height=240>
    <param name=jpgFile value="http://Localhost/playjpg/snapshot0.jpg">
    <param name=refreshTime value="1">
    </applet>
    </html>
    I only get the first frame picture for ever by my html.But the jpg file is dynamic.
    Why?
    Can you help me?
    Thanks.
    Joe

    Hi,
    Add this line inside your run() method, right before your call to repaint():
    if (image != null) {image.flush();}Hope this helps,
    Kurt.

  • How to display text file in JSP?

    Hi,
    I am new to servlet/JSP/java programming.
    I have been able to download a file using ftp. I dont know who to display it in JSP.
    Here is my code. Any help will be appreciated...
    <%@ page import="java.util.*" %>
    <%@ page import="java.lang.*" %>
    <%@ page import="java.net.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="com.dmhistory.*" %>
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    <%
    byte[] bytes = new byte[4096];
    URL theUrl = new URL("ftp://user:passwd@host/migr/Movers_for_Ora8/BG/logs/FLD-PAC3-20020311.log");
    BufferedInputStream in = new BufferedInputStream(theUrl.openStream());
    BufferedOutputStream outstream = new BufferedOutputStream(new FileOutputStream( new File( "D:/temp/log.txt" )));
    int pos = in.read( bytes );
    while ( pos != -1) {
    outstream.write( bytes, 0, pos );
    pos = in.read( bytes );
    %>
    <%
    in.close();
    %>
    DONE!!!
    </body>
    </html>
    How can i display this downloaded file in the browser?
    I want to display it in the original format i.e which new line and carriage returns...line by line..
    Thanks,

    Hi,
    I finally go it to display. but now I have new problem. The browser shows the text without the /n/r.
    But when I view the source using 'view->source', if see that the text has got proper format with newline and carriage returns.
    Any ideas how to display it correctly in the browser?
    <%
                   URL theUrl = new URL("ftp://user:pwd@host/migr/Movers_for_Ora8/BG/logs/FLD-PAC3-20020311.log");
                   //URL theUrl = new URL("ftp://dbcmaint:[email protected]/migr/Movers_for_Ora8/SNP/logs/SNP-PAC2-20020314.log");
                   URLConnection uc = theUrl.openConnection();
                   InputStream content = uc.getInputStream();
                   BufferedInputStream in = new BufferedInputStream (content);
                   LineNumberReader lnr = new LineNumberReader (new InputStreamReader (in));
                   String tempStr = "";
                   String str = "";
                   while ((tempStr = lnr.readLine()) != null) {
                   str += (tempStr);
                        %>
                        <%=tempStr%>
                        <%tempStr = "";
                        %>
                   <%
                   in.close();
                   lnr.close();
              %>
    Thanks

  • How to display the dynamic region in full size

    Hi,
    I'm not able to display the dynamic region in full size.
    In my page, i attached a dynamic region which refers a page fragment. This dynamic region contents are showing as small (scroll is there but i want to display fully).
    How to do this?
    Thanks in advance,
    Sundar

    More than likely it has something to do with your parent layout element. I'd suggest putting your region in an af:panelStretchLayout or similar container that stretches its children. Some of the elements can be a little tricky though, such as af:panelTabbed. It has an attribute that must be set to stretch its first child.

  • How to display array values in jsp of screen flows

    Hi,
    can u please help me .
    I am having one array variable i have stored all the values but i have to display that in JSP page .how to display
    Edited by: user12171025 on Nov 4, 2009 11:11 PM

    Hi,
    I think that its necessaries to use AJaX.
    I am implemeting something like that.
    I have a input text that works like a filter and depends on what my user types in input text I populate my table with some information.
    In order to do that, I put in my JSP a div with an Id and I used ajax, like that:
    function ajaxFunction()
              var xmlhttp;
              if (window.XMLHttpRequest)
              xmlhttp=new XMLHttpRequest();
              else if (window.ActiveXObject)
              // code for IE6, IE5
              xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
              else
              alert("Your browser does not support XMLHTTP!");
              xmlhttp.onreadystatechange=function()
                                                      if( xmlhttp.readyState==4 )
                                                           document.getElementById("tabelaResponsaveis").innerHTML = xmlhttp.responseText;
         var resp = "<f:invokeUrl var='solicitacao' methodName='getResponsaveis'/>";
         xmlhttp.open("POST",resp,true);
         xmlhttp.send(null);
    getResponsaveis is a method inside my BPM that returns a HTML code (the table HTML code with all the information that I need to show.
    I Hope to help
    Thanks Marcos

  • How to display JCO.Table in jsp, CRM ISA

    Hi,
    I have got a JCO.Table with results from teh CRM system and now want to display this in ISA.
    Is there any templates, or code, that could guide me as to how to transfer the table to jsp.
    thanks,
    sunil

    Hi Sunil,
    The code from bean class is here,
    public void listDetails(String releaseGroup,String releaseCode)                                 
    throws Exception
                    try
                         if (mRepository == null )
                              System.out.println("NuLL");
                         try
    IFunctionTemplate                                         ft=mRepository.getFunctionTemplate("BAPI_REQUISITION_GETITEMSREL");
    myFunction=ft.getFunction();
                   catch (Exception ex)
                   throw new Exception(ex + "Problem retrieving JCO.Function object.");
          if (myFunction == null)
         System.exit(1);
    mConnection.execute(myFunction);
                   JCO.ParameterList input = myFunction.getImportParameterList();
                           input.setValue(releaseGroup,"REL_GROUP");
                           input.setValue(releaseCode,"REL_CODE");
                           input.setValue(releaseFlag,"ITEMS_FOR_RELEASE");
                             System.out.println("Imported");
                         catch (Exception ex)
                              ex.printStackTrace();
                              System.exit(1);
                          mConnection.execute(myFunction);
                JCO.Table codes = null;
               codes =myFunction.getTableParameterList().getTable("REQUISITION_ITEMS");
               size =codes.getNumRows();
               if (size == 0)
                  System.out.println("No value matches the selection cretaria");
               purchaseRequisitionNo = new String[size];
               item   = new String[size];
               requestorName = new String[size];
               description = new String[size];
               creatorName = new String[size];
               purchaseRequisitionDate = new String[size];
               plant = new String[size];
              // getter methods
         public int  getSize() { return size; }
         public String getPurchaseRequisitionNo(int i){return                                                        purchaseRequisitionNo<i>; }
          public String getItem(int i) { return item<i>; }
         public String getDescription(int i) { return description<i>; }
         public String getCreatorName(int i) { return creatorName<i>; }
         public String getPurchaseRequisitionDate(int i)
                                             {return purchaseRequisitionDate<i>; }
         public String  getplant(int i) { return plant<i>; }
    Now in the JSP page get the number of entries in the table and try to get row by row from the bean class using the row number.
    <%
    int count = PR.getSize() ; // This method will return the number of
    rows in the table.
    for ( int i = 0; i < count ; i++ ) {
    %>
    <TR><TD ALIGN = "center"><%= PR.getPurchaseRequisitionNo(i) %> </TD>
    <TD ALIGN = "center"><%= PR.getItem(i) %> </TD>
    <TD ALIGN = "center"><%= PR.getDescription(i) %></TD>
    <TD ALIGN = "center"><%= PR.getCreatorName(i)%> </TD>
    <TD ALIGN = "center"><%= PR.getPurchaseRequisitionDate(i)%> </TD>
    <TD ALIGN = "center"><%= PR.getplant(i)%> </TD>
    <% } %>
    Hope this is a simple way to get your requirement.
    Let me know if this does not help you.
    Thanks
    Kathirvel.

  • How to display graphics larger than canvas size?

    How do I display graphics larger than canvas size in Java AWT?
    I tried setting the canvas size() to a value larger than my monitor size, and then adding scroll bars to the canvas, but the scroll bars and the canvas won't go beyond the monitor size in pixels, which is only 800, so the large graphic I try to display gets cut off at the bottom.
    How can I overcome this problem? Has anybody encounter a similar dilemma before?

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    public class AWTSizing
        public static void main(String[] args)
            LargeCanvas canvas = new LargeCanvas();
            ScrollPane scrollPane = new ScrollPane();
            scrollPane.add(canvas);
            Frame f = new Frame();
            f.addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    System.exit(0);
            f.add(scrollPane);
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class LargeCanvas extends Canvas
        int w, h;
        final int PAD = 10;
        Rectangle r1, r2, r3;
        Rectangle[] rects;
        boolean firstTime;
        public LargeCanvas()
            w = 360;
            h = 360;
            firstTime = true;
        public void paint(Graphics g)
            super.paint(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            if(firstTime)
                initShapes();
            g2.setPaint(Color.red);
            g2.draw(r1);
            g2.draw(r2);
            g2.draw(r3);
        private void initShapes()
            r1 = new Rectangle(w/4, h/4, w/2, h*3/4);
            r2 = new Rectangle(w/2, h/2, w/2, h/2);
            r3 = new Rectangle(w*5/8, h/6, w*3/5, h*2/3);
            rects = new Rectangle[] { r1, r2, r3 };
            firstTime = false;
            invalidate();
            getScrollPane().validate();
        private ScrollPane getScrollPane()
            ScrollPane scrollPane = null;
            Component c = this;
            while((c = c.getParent()) != null)
                if(c instanceof ScrollPane)
                    scrollPane = (ScrollPane)c;
                    break;
            return scrollPane;
        public Dimension getPreferredSize()
            Dimension d = new Dimension(w, h);
            if(rects == null)                   // before calling initShapes
                return d;
            Rectangle r;
            for(int j = 0; j < rects.length; j++)
                r = rects[j];
                if(r.x + r.width + PAD > w)
                    d.width += r.x + r.width + PAD - w;
                if(r.y + r.height + PAD > h)
                    d.height += r.y + r.height + PAD - h;
            return d;
    }

  • How to display Frame Dynamically

    Hi friends,
    Plz tell me How to Display / Hide or Frame Dynamically in Oracle Forms.
    I am Using Oracle Forms 6i
    Thanks

    thanks Francois......but i need to hide only one small frame dynamically......
    Do you have any other Option...other than using a frame.....or a Frame alike.....
    Thanks

  • How to display uploaded image in jsp page.

    Hello,
    I am using struts 1.2.9 and and have uploaded image on the server. Now what I want to do display the image in jsp page after clicking on one link in jsp. I have tried many thing to display image in jsp page. But I am getting an error during displaying image in jsp. I have displayed absolute path in servlet. and used InputStream and outputstream to display image in jsp page.
    Can any one help.
    Thanks in advance
    Manveer Singh

    Follow this. This topic is very popular recently on the forum.

  • How to display the dynamic text in the selection screen

    Hi All,
    I want to display the dynamic text in the selection screen .... ( I searched in forums , didnt get the any answer fot this sort of qustion ).....
    EX: If i have the date of today 31st  it has to show message like " today date is 31 like some thing "  when i execute the report .
    Could any one face this sort of requirment, Please let me know.
    Thanks in advance.
    Reagrds,
    Bharani

    Where would you like this dynamic text being displayed? As an "message" or in some parameter field?
    If first
    parameters date type d.
    data: text type string.
    at selection-screen.
       concatenate 'Today is' date into text.
       message text type 'I'.
    If second
    parameters pa_text type c length 50.
    at selection-screen on date.
      if date is not initial.
        concatenate 'Today is' date into  pa_text.
      enidf.
    at selection-screen output.
       "show it as read only
       loop at screen.
        if screen-name = 'PA_TEXT'.
               screen-input = abap_false.
              modify screen.
        endif.
       endloop.
    Regards
    Marcin

  • How to display Arabic content in JSP ?

    Hi all,
    I used the following encoding method to display arabic content in JSP page.
    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
    I also set -Dfile encoding=ISO-8859-6 in the JVM Options.As a result the arabic data is getting displayed .
    Variable "data" contains the actual arabic data.
    function updateArabicData(data){
    try{
    document.getElementById('divtag').innerHTML=""+data;
    }catch(err){
    <html>
    <body>
    <div id="divtag" lang="ar-sa"></div>
    </body>
    </html>
    But the problem is the arabic data getting displayed in JSP (within the <div>)seems to be jumbled up.The users say that the arabic words within a single sentence are not arranged correctly.They are mixed up.Please help me with a solution.
    Edited by: Alance on May 27, 2010 5:34 AM

    Data is retrieved as follows
    if(msg.getField("GEN_UNICODE_MESSAGE_1")!=null){
    resultString=resultString+"N"+""+new String((byte[])msg.getField("GEN_UNICODE_MESSAGE_1").value.get(0),"ISO-8859-6");
    with content Type set as response.setContentType("text/html;charset=ISO-8859-6");
    ISO-8859-6 -since the data contains arabic news.
    Edited by: Alance on May 27, 2010 11:05 PM

  • How to display stored image in jsp  in ie7???

    i am using internet explore7. i have a problem when i am displaying an image in jsp its not properly coming. this image and image is stored in database.
    image is stored in database using "binarystream" .
    i am just simply calling the image path and using the html image display tag.
    <img src="<%=fileIpath%>" but image is not coming properly but this image is showing properly in lower ie version.
    Can anyone help me???

    can anyone reply this question??Appearently no.
    It might be that the question is not interesting enough to attract people.
    Or it might be that the details you provided do no suffice and some important pieces of information are missing. For eample: what are the contents of the variable? If you save the generated page, what do you get?

  • Hi all.... how to display tables dynamically in a JSP page

    im trying to display the list of tables in MYSQL datbase into a JSP.... i have a database name link on the page.... once i click on that the list of tables should be listed dynamically in the page as a link...Also is it possible to click on each table link and go to see the table details ...if so how.... please some one help me ...its very urgent........

    im trying to display the list of tables in MYSQL
    datbase into a JSP.... i have a database name link on
    the page.... once i click on that the list of tables
    should be listed dynamically in the page as a
    link...Also is it possible to click on each table
    link and go to see the table details ...if so how....DatabaseMetaData has a method (look in the documentation) to get the list of tables. It also has methods to get information on specific database objects
    please some one help me ...its very urgent........It's even urgent that you look in the documentation.

Maybe you are looking for

  • Table for Invoices not release

    Is there any table to find the list of invoices which are not released for accounting if yes please let me know Regards, KK

  • AirPort Express "boosting" wifi range

    I am going to be using an AX to stream music from my office to the living room home stereo. I am not intending to use it as a wireless router because I already have a linksys I am happy with. So, without an ethernet cable plugged into the AX, will it

  • Create a Webi report using QAAWS as a data source

    Hi Experts, I am on BO 4.1 SP 3, and using the Webi Rich Client to create a WEBi report using a QAAWS url as a data soruce. This is the first time I am trying this, so any tips/helpful links are welcome. I get the below error, when I try to map the f

  • Cascading Drop Down Menus

    Can cascading drop down menus be created in Acrobat XI Pro?  If so, how?

  • Custom Function for Descriptive Flexfield

    Hi Friends, How do I Create Custom Function for Descriptive Flexfield Setups & Create Custom Function for Key Flexfield Setups Thanks a lot