How to print the image data stored in object of 'java.io.File' Class in jsp

I have created a file object for the image file in the system temporary directory.Now I want to display it in my page. please tell,How to print the image data stored in object(in my program it is imgr) of 'java.io.File' Class in jsp

Create a servlet which gets an InputStream of the file and writes it to the OutputStream of the response and call this servlet in `src` attribute. That's basically all.
Here's an example which covers the most of the minimum needs: [http://balusc.blogspot.com/2007/04/imageservlet.html].

Similar Messages

  • IPhoto 11 and PSE 11: where is the image data stored?

    I have been using iPhoto on my new macbook for the last 3 mos. It has some useful features such as quick editing,  easy sharing and making neat collages etc. However its editing capability is limited and so i just bought PSE 11 for mac.
    My questions:
    1. I am trying to figure out as I import new pictures, where do I keep them, iPhoto or PSE? The pictures I take from iPhone , iPad obviously go into iPhoto first. However it is the photos I take with my other digital cameras that I am not sure where to bring them in. 
    2. If I import first into iPhoto and then into PSE, does the image data get duplicated?
    3. If I bring a photo from iPhoto into PSe and edit it, the picture remains in PSE. How do I take it back into iPhoto? Should I delete the edited photo from PSE after exporting it to iPhoto to avoid duplicate images?
    Your recommendations appreciated.

    In general it’s best not to use Organizer and iPhoto together. It’s one or the other to avoid duplicating your images.
    If you already have lots of photos in iPhoto, you could set up the iPhoto prefs, to enable the PSE11 Editor application for external editing. You can then use Edit In or Cmd+E directly from you iPhoto thumbnails.
    See link below.
    http://helpx.adobe.com/photoshop-elements/kb/photoshop-elements-iphoto-mac-os.html

  • Printing Table data: How to print the row data in 'Western Text' ?

    Hi,
    Scenario:
    I have a table containing, say 5 records. The table is placed in a sub form (Properties: Content - Flowed, Flow direction - Western Text) which is adjusted in a manner to occupy only half of the page (vertically).
    I need the records to be printed adjacent to each other i.e. after printing the first row of the table , the next record should be placed in the other half of the page and so on.
    Issue:
    The problem is that even though I have set the property (flow direction) to Western text, the data is printed one below the other as in the Top to bottom property.
    Am I missing something?
    Kindly advice how to resolve this issue.
    Please let me know if the question is anyway unclear.
    Regards
    s@k

    Hi Otto,
    Thanks a lot for your prompt response.
    yes there is plenty of space.
    I am trying to display the records of a table. I used sub forms to behave like table and body row.
    The body row sub form occupies left half the page (to make it clear, say you divide the page vertically). The other half (i.e. right half ) is blank. I have checked the box to repeat itself for each data item.
    Now after printing the first record on the left hand side, I want the second record to be printed on the right hand side and if there is a 3rd record in the table, it should be printed just below the 1st record.
    Please do let me know if still the issue is not clear.
    Kindly suggest.
    Regards
    s@k

  • How to print the current date and time?

    Hi Friends!
    I have tried this program to print the current time and date,
    #include <iostream>
    #include <time.h>
    using namespace std;
    int main()
    time_t tim;
    time(&tim);
    cout << ctime(&tim);
    return 0;
    But it show the warning as;
    warning C4996: 'ctime': This function or variable may be unsafe. Consider using ctime_s instead.
    Can anyone suggest whats wrong with this?

    i also got many warring when i use old version keyword. as i note on think thatin new vc++ has many keyword change with _s. the old keyword works even get warring.or you can change to as it suggest.For About ctime_s
    Check this link for more detail (RefLink)
    No, it shows error, when you use ctime_s instead of ctime.
    error C2660: 'ctime_s' : function does not take 1 arguments

  • How to read the Image Data using HTTp Request response

    i want to read image data from server please send me any code or answers.
    and also i want to exit application using button control for iphone simulator.
    thanks in advance.

    You would do a URLRequest and download the image. You could save it to disk and then load it or directly create a new image with the binary data.

  • How to print the contents(data) of an Applet

    My problem:
    I have an html page that is split up into several frames. One of these frames is actually an applet that has a table of data that I retrieve from a database. I want to be able to print out ALL of the data from the applet. I added a button to one of the frames(not the Applet frame) to print. For the button.onClick event, I created a function called "print". That function's code right now is Applet.print(Graphics), but when I try to click the button I get a Runtime Error that says "'Applet' is undefined". Am I even close to getting this working?? How would I define the 'Applet' in the frame that I have the Print button in?

    Hi pargol4
    I have problem retrieving data from the database by an applet that needs new data in one second interval. The communication between the applet and the database is too diffucult for me.
    All I have is just two files, one is the applet DrawMe.java and the other is MyData.java to communicate with the database. If I need to communicate with the database from the applet, where I have to put my code like InputBuffer and OutputBuffer, is the run() method of the applet the right place for it? ... do you have a code bit to illustrate that for me?
    Thanks in advance ... Carina

  • How to print the same data in different pages of different trys

    Hi,
    Part II: Check stub u2013
              We need to print Vendor account # (REGUH-LIFNR), Vendor Name ((REGUH-NAME1), Payment doc # (REGUH-VBLNR), Check date (PAYR-ZALDT) and Check number (PAYR-CHECT) in the header portion and in the detail portion Invoice # (REGUP-XBLNR), Date (REGUP-BUDAT), Amount (REGUP-DMBTR), Amount, Discount and Net amount paid (REGUP-DMBTR).      
    Part III: Check stub u2013
              We need to print Vendor account # (REGUH-LIFNR), Vendor Name ((REGUH-NAME1), Payment doc # (REGUH-VBLNR), Check date (PAYR-ZALDT) and Check number (PAYR-CHECT) in the header portion and in the detail portion Invoice # (REGUP-XBLNR), Date (REGUP-BUDAT), Amount (REGUP-DMBTR), Amount, Discount and Net amount paid (REGUP-DMBTR).
    i am printing like the above and my question is as below.
    Q) If the detail section of Part II and Part III spills beyond the available space then the remainder should be printed on a separate white paper picked from the next tray after printing all the checks. Ensure that this will not be printed on the following check.
    Can anyone please answer this.

    Hi Swathi,
    Where does that check box available, could please give your answer in details so that i can follow like that.
    Thanks
    Srinivas

  • How to store the member data of an object?

    hi,
        how do i store the data member of an object in labview? I want the data to be available from a different vi as well. i'll cretae an object and would set some attributes to it. So when i call this object by its name from a different vi, i want the attributes that was set to the object to be displayed. how do i achieve this.
    Regards
    Jayaraman

    If the only thing you need is a container to store values, then, as I mentionned in your other post:
    Do a search on "Action Engine" within this forum.  A sub-section of Action Engines is something called a "Functional Global Variable".
    You can also do a search on that.  Functional Global Variables are VERY different from Globals or Shared Variables.  They are often used as a container to store values and allow to share among VI's.  It only retains the last value written to it (unless you modify the structure but I won't get into that). 
    Here is an example of what an AE looks like: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_descending&message.id=311549#M311549
    Another Action Engine example: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_descending&message.id=289773#M289773
    Nugget on Action Engine: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=240328
    Simple explanation of Functional Globals: http://forums.ni.com/ni/board/message?board.id=170&view=by_date_descending&message.id=56747#M56747

  • How can I get the image data from Clipboard with LV

    Anybody knows How can get the image data after pressd "print screen button" with LV?
    I want to program a software which can save a image as a bmp or jpeg etc, and the image data is from pressed print screen button. 
    How to get it out from clipboard. I am trapping about. thanks in advance.
    Try to make everything Automatic

    You can have a look at Rolf Kalbermatter's post here (give him stars) or, if you're using scripting, you can use the Application class Get Clipboard Image method.
    Try to take over the world!

  • I want to use Get Panel Image in Labview 5.0.1 and need details on how to save the BMP data generated

    I am trying to generate an application that saves a copy of its front panel on completion. This is easy to do using an invoke node with Print VI to HTML but this does not work in an .exe format. I have seen elsewhere that you have to use the Get Panel Image method, but no details are supplied in LV 5.0.1 documentation of how to use the "image" data (1-D Unsigned Byte array) that is generated. I want to save this in a format that can then be read as a bitmap in any standard graphics package. Any assistance?

    Hi,
    If you'd upgrade to LV5.1 or 6 you could use the 'standard' vi's for this.
    You need a VI called "Write BMP File.vi". It's not shipped with LV5.0.1.
    This vi only uses 3 subVI's, so perhaps someone at NI can convert it and
    send it to you (sorry, I won't, it's copywrited).
    If you cannot get this VI anywhere, you'll need to figure out the BMP file
    format yourself. It's not too complicated, but still could take some days.
    Perhaps someone figured it out before LV5.1 was released.
    Regards,
    Wiebe.
    "RDK" wrote in message
    news:[email protected]..
    > I want to use Get Panel Image in Labview 5.0.1 and need details on how
    > to save the BMP data generated
    >
    > I am trying to generate an application that saves a copy
    of its front
    > panel on completion. This is easy to do using an invoke node with
    > Print VI to HTML but this does not work in an .exe format. I have seen
    > elsewhere that you have to use the Get Panel Image method, but no
    > details are supplied in LV 5.0.1 documentation of how to use the
    > "image" data (1-D Unsigned Byte array) that is generated. I want to
    > save this in a format that can then be read as a bitmap in any
    > standard graphics package. Any assistance?

  • Is list of custom headers and footers. I can't find how to change the footer to print the Long Date

    '''There should be a list of custom headers and footers.''' I can't find how to change the footer to print the '''Long Date'''. It took awhile just to find Page &PT. So I would appreciate if someone could post a list. Also if someone can answer how to print the Long Date.
    Thank you

    When you're on a call, use the volume buttons on the left side of the device.  This will then adjust the In-Call Volume.

  • How to get the pixel data so as to work on it?

    Hi all,
    I am trying to write a plug-in that will crop and scale the image, edit the selection in the image document based on image data. For this purpose I need the pixel data of the image. How to get the image data as different pixels and what is the data structure used to store this data?
    Assumption: No layers i.e., only background
    Thanks in advance,
    Sailu

    Hi Ilya,
    Thank you for your post. In the plugin architecture you propose (automation + filter), do you have an idea about how to share the pixel data between the two plugins? I have found a post that gives details about how to get pixel data and show it using ADM components
    Matthew Hollingworth, "ADM Color Managed Preview?" #1, 22 Oct 2007 11:53 pm but it supposes that you have a filter plug-in.
    Again, does anyone knows how to preview the current image in a AUTOMATION plug in? This seems impossible.
    Thank you all for your help
    Cheers,
    Chaker

  • How to get the image stored in archieve link as an attachment in work item.

    Hi All,
    through transaction OAWD we are storing scanned images.
    Once this transaction is executed a workitem appears in the inbox of the initiator with the scanned invoice as attachment.
    When the user executes the work item FV60 screen is displayed where the user enters the data based on the scanned invoice attachment.
    After the user Parks the document the custom workflow triggers and a workitem appears in the inbox of an approver.
    Our requirement is that the scanned image should also appear as the attachment.
    Can you please suggest how to get the image stored in archieve link as an attachment in work item.
    Regards
    Shraddha

    Hi Martin,
    with every parked document a scanned image is linked.
    I need to create a link under objects and attachments in the work item, such that when the user clicks that link the image is displayed.
    At present the following functionality is available.
    The BO used is FIPP
    Objects and attachments:
    parkeddocument:AK0108500001252008.(via FIPP binding with WIOBJECT_ID)
    On clicking the link below objects and attachments: the parked document AK0108500001252008 opens in display mode.
    Now we want to have 2 links:
    parkeddocument:AK0108500001252008.
    image.
    When we click on the link image then the scanned invoice linked to the document should get opened.
    I am able to get the image id of the the image through  SAP_WAPI_GET__OBJECTS,
    export parameter leading_object provides the detail.
    But I am not able to figure out how to use it in my workflow to display it as an attachment.
    Hope this will give a better understanding of my question.
    can you please suggest as to how I should proceed with it.

  • How to receive the images / binary data t ype

    How to receive the images / binary data type in webdynpro....
    i have a website that let's the user send email, the email attachment and message are stored in both in images data type....
    q1) can i stored the message into binary data type...but the message is very long.....
    q2) if i have a textbox ...i surely will need to display the message  in string ,right ?
    [......... msg here ........]
    what is the codes to receive the images / binary data type in webdynpro....

    As in your previous post if you are storing them as BLOB object.. am sure you are able to get a byte stream or byte array(bytes[]) out of it.
    There should be some way to identify if its a image or a message BLOB. If its a image , convert into bytes and use 
       WDWebResource.getWebResource(bytes,resource type).getAbsoluteURL()
    to obtain the url.. assign this image UI element..
    In case its the message , use bytes.toString to get the message ..
    Regards
    Bharathwaj

  • How to access the images stored in folder which is kept inside theapplicati

    Iam new to java..
    I want to display the images (.jpeg,,.gif, flash) which are kept in one folder
    Using Jsp...
    Its Executing fine in local system..
    Its not working 1)when i execute that jsp from other system
    2)if i give the full url then only its executing in local system
    Please help me...
    thanks in advance...
    by Priya
    <%@ page import="java.io.*"%>
    <html>
    <head>
    <title>Movie Details</title>
    </head>
    <body text="#000000" bgcolor="#FFFFFF">
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber1">
    <%
    File f=new File("..E:\application\Images");
    File []f2=f.listFiles();
    for(int ii=0;ii<f2.length;ii++)
    if(f2[ii].isFile())
    String fname=f2[ii].getPath();
    %>
    <tr>
    <td width="87%"><%=fname%> </td>
    <td width="14%"><img border="0" src="<%=fname%>" width="150" height="100" ></td>
    </tr>
    <%
    System.out.println(f2[ii].getPath());
    %>
    </table>
    </body>
    </html>

    Hi,
    Well i guess a Simple concept of a image servlet can cater your requirement here.
    checkout the below example of how to do it
    Configurations needed in /WEB-INF/web.xml:
    <servlet>
        <servlet-name>ImageServlet</servlet-name>
        <servlet-class>com.ImageServlet</servlet-class>
        <init-param>
           <param-name>backupFolderPath</param-name>
           <param-value>E:/application/Images</param-name>
           <!--Could use any backup folder Available on your Server and make sure we place a image file named noImage.gif which indicates that there is no file as such-->
        </init-param>
         <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>DownloadServlet</servlet-name>
        <url-pattern>/Image</url-pattern>
    </servlet-mapping>
    ImageServlet.java:
    package com;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.BufferedOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    *@Author RaHuL
    /**Image Servlet
    *  which could be accessed Image?fid=fileName
    *  or
    *  http://HOST_NAME:APPLN_PORT/ApplnContext/Image?fid=fileName
    public class DownloadServlet extends HttpServlet{
      private static String filePath = new String();
      private static boolean dirExists = false;
      public void init(ServletConfig config){
          // Acquiring Backup Folder Part
          filePath = config.getInitParameter("backupFolderPath");
          dirExists = new File(filePath).exists();      
      private void processAction(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
           // getting fileName which user is requesting for
           String fileName = request.getParameter("fid");
           //Building the filePath
           StringBuffer  tFile = new StringBuffer();
           tFile.append(filePath);    
           tFile.append(fileName); 
           boolean exists = new File(tFile.toString()).exists();
           FileInputStream input = null;
           BufferedOutputStream output = null; 
           int contentLength = 0;
           // Checking whether the file Exists or not      
           if(exists){                  
            try{
                // Getting the Mime-Type
                String contentType = this.getContentType(tFile.toString());          
                input = new FileInputStream(tFile.toString());
                contentLength = input.available();
                response.setContentType(contentType);
                response.setContentLength(contentLength);
                 String contentDispo = "";
                  try{
                     contentDispo = request.getParameter("coid");
                  }catch(Exception exp){
                 if(contentDispo != null && contentDispo.equals("69125"))
                   response.setHeader("Content-Disposition","attachment;filename=\""+fileName+"\"");       
                this.exportFile(input,response.getOutputStream());
             }catch(Exception exp){
                 exp.printStackTrace();
                 this.getServletContext().log("Exception Occured:"+exp.getMessage());
                 throw new ServletException(exp.getMessage());
           }else{
              try{
                 // Getting the Mime-Type
                String contentType = this.getContentType(filePath+"noImage.gif");          
                input = new FileInputStream(filePath+"noImage.gif");
                contentLength = input.available();
                response.setContentType(contentType);
                response.setContentLength(contentLength);
                this.exportFile(input,response.getOutputStream());
              }catch(Exception exp){
                 exp.printStackTrace();
                 this.getServletContext().log("Exception Occured:"+exp.getMessage());
                 throw new ServletException(exp.getMessage());
      /** Gets the appropriate ContentType of the File*/
      private String getContentType(String fileName){
            String url = java.net.URLConnection.guessContentTypeFromName(fileName);
               if(url == null)
                 return "application/octet-stream";
               else
                 return url;
           or one may use
           return new  javax.activation.MimetypesFileTypeMap().getContentType(fileName);
           NOTE: Do not forget to add activation.jar file in the classpath
      /** Prints the Image Response on the Output Stream*/
      private void exportFile(InputStream input,OutputStream out) throws ServletException,IOException{
             try{
                    output = new BufferedOutputStream(out);
                    while ( contentLength-- > 0 ) {
                       output.write(input.read());
                    output.flush();
              }catch(IOException e) {
                    e.printStackTrace();
                     this.getServletContext().log("Exception Occured:"+e.getMessage());
                     throw new IOException(e.getMessage());
              } finally {
                   if (output != null) {
                       try {
                          output.close();
                      } catch (IOException ie) {                     
                            ie.printStackTrace();
                         this.getServletContext().log("Exception Occured:"+e.getMessage());
                         throw new IOException(ie.getMessage());
      /** HttpServlet.doGet(request,response) Method*/
      public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{       
            // Calling  respective Action Method to Provide File Service
            this.processAction(request,response); 
      /** HttpServlet.doPost(request,response) Method*/
      public void doGet(HttpServletRequest request,HttpServletResponse response) throws         ServletException,IOException{
            // Calling  respective Action Method to Provide File Service
            this.processAction(request,response); 
    NOTE: The following code could be used to provide service to stream any sort of files with any sort of content
    with some minor modications.
    Inorder to access all the images you can restructure your jsp like the one below
    JSP:
    <!--
         And say we have are storing Image name & Movie details in the database and we are created a collection
         of all the database results like bean here is how we would display all the details with images
         Say you wrote a query to findout Moviename,timings,Hall Number & pictureFileName
         example:
            Movie: DIE HARD 4.0
            Timings: 10:00AM,2:00PM,9:15PM
            Hall NUmbers: 1,1,2,4 
            pictureFileName: die_hard_4.jpg
             or
            Movie: Transformers
            Timings: 11:20AM,2:20PM,10:15PM
            Hall NUmbers: 2,3,1,5 
            pictureFileName: transformers.jpg
         say you are saving the information in a dtoBean with properties like
          public class MovieBean{
             private String movieName;
             private String timings;
             private String pictureFileName;
             /* and followed by getters & setter of all those*/
          and say we have queried the database and finally collected an ArrayList<MovieBean> from the query results and
          saving it within the scope of session with the attribute name "MovieList"
    -->
    <%@ page language="java"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
    <html>
    <head>
    <title>Movie Details</title>
    </head>
    <body text="#000000" bgcolor="#FFFFFF">
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber1">
    <thead>
    <tr>
        <td>Movie Name</td>
        <td>Timings</td>
        <td>Hall Numbers</td>
        <td>Poster</td>
    </tr>
    </thead>
    <tbody>
    <c:forEach var="movieBean" items="${sessionScope.MovieList}">
        <tr>
             <td><c:out value="${movieBean.movieName}"/></td>
             <td><c:out value="${movieBean.timings}"/></td>
             <td><c:out value="${movieBean.hallNo}"/></td>
             <!-- Here is where we are making use of image servlet and trying to retrive images -->
             <td><img src="Image?fid=<c:out value="${movieBean.pictureFileName}"/>" align="center" width="30" height="30"/></td>
        </tr> 
    </c:forEach>
    </tbody>
    </table>
    </body>
    </html>Hope this might help,If that does do not forget to assign the duke stars which you promised :)
    REGARDS,
    RaHuL

Maybe you are looking for

  • In the market for a new phone

    A strange topic you may think however, I'm still a pretty new mac user and want to know which phone to buy that has good compatability with my shiny MBP. IE will send texts from address book because I know the posh nokia with no keyboard doesn't. So

  • Problem in AppIntegrator user mapping parameter

    Hi , I am trying sso for http://www.diamondintelligence.com/include/login.aspx? (Note I have done AppIntegrator for Yahoo) I have created system, Name of the server:www.diamondintelligence.com protocaol: http URI of web application: /include/login.as

  • OBIEE Write Back ERROR

    Hi All, Pl Help me in Resolving the Error "Write Back Error The system is unable to read the Write Back Template 'HIRING_STATUS'. Please contact your system administrator. " FolderPath:\\ C:\OracleBI\web\msgdb\customMessages\Hiring_status.xml Here Ta

  • Order related or delivery related billing

    Arnab Sarkar In Sales doc header control, if the field of Del. related billing and order related billing is filled up, then what kind of billing takes place during the invoice creation? del. related billing or order related billing?

  • Data Services 3.2 (Cyricllic Code)

    Hi Folks,                  I am trying to find out a way around this Cyricllic Code                            So i am trying get a short text from the SAP R3 server and pass it on to the Oracle Server. Say for Eg; Short_text - N'0JLRi9C/0YPRgdC6INCy