Outputting JPEG using servlets

hi
Im trying to output the JPEG created by the StockGraphProducer class i found on Javaworld to a webpage using a servlet output stream.
The original code used a file output stream i have included a snippet of it below. I have also included my servlet where i have tried to amend it to render JPEG to the webpage but im not usre abotu it or what bits i need to change in the StockGraphProducer
I woudl be very grateful if someone could take a quick look at this .
thanks
public class StockGraphProducer implements ImageProducer
  private static int ImageWidth = 300;
  private static int ImageHeight = 300;
  private static int VertInset = 25;
  private static int HorzInset = 25;
  private static int HatchLength = 10;
   *  Request the producer create an image
   *  @param stream stream to write image into
   *  @return image type
// i want to try and use a servlet output stream to send the JPEG to the user insteadof outputstream.
public String createImage(Outputstream stream) throws IOException
    plottedPrices = new Point2D.Double[5];
    int prices[] =  {105, 100, 97, 93, 93};
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(stream);
//do i remove the stream paaremter from createiamge and above function???
    BufferedImage bi = new BufferedImage(ImageWidth + 10,
                                         ImageHeight,
                                         BufferedImage.TYPE_BYTE_INDEXED);
    graphics = bi.createGraphics();
    graphics.setColor(Color.white);
    graphics.fillRect(0, 0, bi.getWidth(), bi.getHeight());
    graphics.setColor(Color.red);
    createVerticalAxis();
    createHorizontalAxis();
    graphics.setColor(Color.green);
    plotPrices(prices);
    encoder.encode(bi);
    return "image/jpg";
public final class GraphRenderer extends HttpServlet
     public void doGet(HttpServletRequest request,
                           HttpServletResponse response)
       throws IOException, ServletException
          HttpSession session = request.getSession(true);
               response.setContentType("image/jpeg");
          ServletOutputStream sos= response.getOutputStream();
  //the original code
   /* try
       FileOutputStream f = new FileOutputStream("stockgraph.jpg");
       StockGraphProducer producer = new StockGraphProducer();
       producer.createImage(f);
       f.close();
    catch (Exception e)
      e.printStackTrace();
//i want to try and use a servlet output stream so that the JPEG is sent to the webpage     i tried the following butim not sure about it. I got rid of the outputstream parameter from StockGraphProducer and left it empty and tried .
          try
               StockGraphProducer producer = new StockGraphProducer();
                      producer.createImage();
               //i dont think i need this part.      
               /*Dimension size= producer.getPreferredSize();
               BufferedImage image = new BufferedImage((int)size.getWidth(),                (int)size.getHeight(), BufferedImage.TYPE_INT_RGB);
               Graphics g= image.createGraphics();
               gp.paint(g);*/
               // Send back image i dont think this is correct
               JPEGImageEncoder encoder= JPEGCodec.createJPEGEncoder(sos);
               JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(image);
               param.setQuality(1.0f, false);
               encoder.setJPEGEncodeParam(param);
               encoder.encode(image);
          catch(Exception ex)
          {

Hi,
I need to create a program where I get an Image from DB and then display it in Browser using servlets.
I was looking at the StockGraphProducer, but it seems the code is not fully posted.
I would greatly appreciate anyone who has this StockGraphProducer program would email me or post it.
Thanks in advance.
my email address is [email protected]
Again Thanks

Similar Messages

  • Problem writing to output using servlet

    Hi All,
    I created a servlet which reads file and writes to output . This works fine
    when request protocol is http . But if protocol is changed to https servlet doesnt write to output. This servlet is deployed in secure environment as EAR project .But pops up error in popup
    Internet explorer cannot download /ImageServlet/.... from the server....
    requested site is unavailable.
    Here is my servlet code
                        String key = request.getParameter("key");
                        if( key != null){
                             String[] keys = key.split(":");
                             System.out.println("request.getAuthType() :"+ request.getAuthType());
                             if(request.getAuthType() != null){
                             if(keys != null && keys.length >1){
                                  ImageUtil imageUtil = new ImageUtil();
                                  byte[] bytes = imageUtil.getDocumentContent(keys[0]);
                                  ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
                                  BufferedInputStream bis = new BufferedInputStream(bais);
                                  ServletOutputStream out = response.getOutputStream();
                                  BufferedOutputStream bos = new BufferedOutputStream(out);
                                  response.reset();
                                  if(keys[1].equalsIgnoreCase("doc") ) {
                                       response.setContentType("application/msword;charset=utf-8");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.doc\";");
                                  }else if(keys[1].equalsIgnoreCase("xls") ) {
                                       response.setContentType("application/vnd.ms-excel");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.xls\";");
                                  }else if(keys[1].equalsIgnoreCase("rtf") ){
                                       response.setContentType("application/msword");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.rtf\";");                         
                                  }else if(keys[1].equalsIgnoreCase("html") || keys[1].equalsIgnoreCase("htm")){
                                       response.setContentType("text/html");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.html\";");                         
                                  }else if(keys[1].equalsIgnoreCase("txt")){
                                       response.setContentType("text/plain");
                                       response.setHeader("Content-Disposition","inline;filename=\"file.txt\";");                         
                                  //setting some response headers
                                  response.setHeader("Cache-Control","no-store, no-cache, must-revalidate,post-check=0, pre-check=0"); //HTTP 1.1
                                  response.setHeader("Pragma","no-cache"); //HTTP 1.0
                                  response.setDateHeader ("Expires", 0);
                             int i;
                             while ( (i = bis.read(bytes)) > 0)
                                  bos.write(bytes,0,i);
                             bos.flush();               
                             bos.close();
                             bis.close();
                             bais.close();
                             System.out.println("Has written");
                             }else{
                                  log.error("Key is not good.");
                   }else{
                        log.error("Please enter key for streaming.");
              }catch(Exception e)     {
    log.error(e.toString());
    e.printStackTrace();
    In web.xml
         <servlet>
              <servlet-name>ImageServlet</servlet-name>
              <servlet-class>
                   com.pfpc.opdesktop.image.servlet.ImageServlet
              </servlet-class>
         </servlet>     
         <servlet-mapping>
         <servlet-name>ImageServlet</servlet-name>
         <url-pattern>/ImageServlet/*</url-pattern>
         </servlet-mapping>
         <security-constraint>
              <display-name>ImageServlet</display-name>
              <web-resource-collection>
                   <web-resource-name>ImageServlet</web-resource-name>
                   <description>ImageServlet</description>
                   <url-pattern>/ImageServlet/*</url-pattern>
                   <http-method>GET</http-method>
                   <http-method>POST</http-method>
                   <http-method>OPTIONS</http-method>
              </web-resource-collection>
              <auth-constraint>
                   <description>ImageServlet</description>
                   <role-name>ImageServlet</role-name>
              </auth-constraint>
              <user-data-constraint>
                   <transport-guarantee>NONE</transport-guarantee>
              </user-data-constraint>
         </security-constraint>
              <security-role>
              <description>ImageServlet - OpDesktopWAR</description>
              <role-name>ImageServlet</role-name>
         </security-role>
    In application.xml
         <security-role id="SecurityRole_1164052833984">
              <description>ImageServlet - OpDesktopWAR</description>
              <role-name>ImageServlet</role-name>
         </security-role>
    Can anyone please tell me what is problem.very urgent.
    Thankyou

    Hi,
    Found the solution for the problem. For some reason
    response.setHeader("Cache-Control","no-store, no-cache, must-revalidate,post-check=0, pre-check=0"); //HTTP 1.1
                                  response.setHeader("Pragma","no-cache"); //HTTP 1.0
                                  response.setDateHeader ("Expires", 0);
    These header settings were causing this issue. If I take out these settings then it works
    FYI
    Thankyou very much for all help

  • Problem to output image using ServletOutputStream

    Hallo everybody! Can anybody help me? I try to output image (jpeg) using ServletOutputStream. First I upload jpeg image to server disassemble it to binary data and save to database binary data, image length, and image type. Then I try to output image.
    Here the code:
    response.reset();
    response.setContentType(strContentType);
    ServletOutputStream sos=response.getOutputStream();
    sos.write(buf,0,bflen);
    sos.close();
    variable buf is array of byte with binary data
    bflen is image length
    strContentType it image type (image/pjpeg)
    I use JRun server 3.1
    I tried to save an image file:
    FileOutputStream fos = new FileOutputStream("test_logo.jpg");
    fos.write(buf,0,bflen);
    fos.close();
    And I got an jpeg file.

    I've done the exact same thing... almost. I have a
    servlet that sends a jpeg file to an applet for
    processing. Anyway, I did two things differently.
    First I used the write(byte[]) rather than
    write(byte[], int offset, int length). If you're
    going to send the whole array anyway, don't bother
    with the other parameters.
    Second, I call flush() on the output stream before I
    close it. I have a feeling this is why. Remember,
    web connections are connectionless. You don't know if
    the data was send or received. I assume what is
    happening is that you try to send the data then close
    the connection right away and the data may not get to
    the destination.
    Here's what I have. I don't think the content type
    really matters but I know multipart/form-data is
    binary.
    response.setContentType("multipart/form-data");
    response.getOutputStream().write(image.data);
    response.getOutputStream().flush();
    response.getOutputStream().close();
    I'll try it. But I have problem to call getOutputStream() method. It produce IllegalStateExeption. I think that because implicit getWriter() method calls. (I use JSP)
    Do you know how to reset somehow response to have ability to call getOutputStream()?

  • Applescript to convert PDF to JPEG using Preview?

    I know there's an existing script available on the internet that converts PDFs to JPEGs (it's here: http://macscripter.net/viewtopic.php?id=25350) BUT, for whatever reason, the quality, even when set to 600dpi, is crap. I get better results simply opening the PDF in Preview then saving as JPEG... even a 150dpi JPG from Preview is higher quality than a 600dpi file from this script I found...
    So, what I need help with is creating a applescript that converts PDF's to JPEGs using Preview (or whatever, as long as the quality of the JPEG is good). I have very little scripting experience so help is appreciate.
    Ideas?
    Thanks.

    Frank Caggiano wrote:
    Decided to finish this up as an interesting exercise. Hope you find it useful.
    One question for the  Applescripters here. The Automator action run as a shell script seems to return a list of filename aliases but the return value while looking like a list didn't behave as a list. I managed to rip it apart to get to the filepaths and the script works but it seems really kludgey . So my question is given the return of the Automator run as a do shell script what is a more correct way to handle it?
    Convert PDF to JPG
              © 2011 Frank Caggiano
              GNU Public License
              Convert pfd files to jpg images.
              The converted JPG files wil have the name of the original PDF files with the extension changed to JPG.
              The actual conversion uses the Automator action Render PDF Pages as Images.
              The user needs to create an Automator action with Render Pages as Images as the single action.
              Set the parameters for the conversion in the action.
              NOTE: this script assumes you're converting to jpg files If you select another output format in the action this script will
              need to be modified.
    -- choose PDF files
    try
              set sourceFiles to choose file with prompt "Select PDF files" of type {"com.adobe.pdf"} with multiple selections allowed
    on error msg number n
              if n ≠ -128 then
                        error "Unknow error: " & msg & space & n
              else
      quit
              end if
    end try
    -- choose destination folder
    try
              set destFolder to choose folder with prompt "Select Destination Folder"
    on error msg number n
              if n ≠ -128 then
                        error "Unknow error: " & msg & space & n
              else
      quit
              end if
    end try
    set destFolder to quoted form of POSIX path of destFolder
    -- select workflow
    try
              set workFlow to choose file with prompt "Select Work Flow" of type {"com.apple.automator-workflow"}
    on error msg number n
              if n ≠ -128 then
                        error "Unknow error: " & msg & space & n
              else
      quit
              end if
    end try
    set workFlow to POSIX path of workFlow
    repeat with sourceFile in sourceFiles
      -- get base name of the source file
              set bName to do shell script "basename " & quoted form of POSIX path of sourceFile
      -- Strip off the extension
              set text item delimiters to "."
              set bName to text item 1 of bName
              try
                        set res to do shell script "automator -i " & quoted form of POSIX path of sourceFile & space & workFlow
              on error msg number n
                        error msg & space & n
              end try
      -- Seems strange to  do it this way but it works
              set text item delimiters to "\""
              set theList to text items of res
    We go through the list of converted files. If there is more then one then the second and subsequent files
    will get and integer added to the name to avoid conflict.
              set cnt to 0
              repeat with convertedFile in theList
                        if convertedFile does not contain "alias" and convertedFile does not contain "}" then
                                  set fullPath to quoted form of POSIX path of convertedFile
                                  if cnt ≠ 0 then
                                            do shell script "mv " & fullPath & space & destFolder & bName & "_" & cnt & ".JPG"
                                  else
                                            do shell script "mv " & fullPath & space & destFolder & bName & ".JPG"
                                  end if
                                  set cnt to cnt + 1
                        end if
              end repeat
    end repeat
    Hi Frank--
    I tried the script you wrote and created the Automator workflow with the single action as requested, saved it to the desktop then selected it when your script's dialogue requested it. However, at that point your script game me the following error. Ideas? I did save the workflow as a workflow and I selected it directly, so I'm not sure why it thinks that the "workflow file does not exist" ? :
    error "The workflow file does not exist. 255" number -2700 from «script» to item

  • Accessing postgresql record using servlet

    Hello every body,
    I am trying to access the postgresql database using servlet. But I found the error of ClassNotFound exception: org.postgresql.Driver. One thing more I am using eclipse ide. I have used the postgresql-8.1-404.jdbc3 driver. And I have set it on class path in eclipse.
    package dbservlet.example;
    import java.io.*;
    import java.sql.*;
    import java.text.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class DbServletExample1 extends HttpServlet{
         public String getServletInfo() {
              return "Servlet connects to PostgreSQL database and displays result of a SELECT";
         private Connection dbcon; // Connection for scope of DbServletExample1
         public void init(ServletConfig config) throws ServletException { // "init" sets up a database connection
              String loginUser = "ali";
              String loginPasswd = "ali";
              String loginUrl = "jdbc:postgresql://127.0.0.1:5432/ali"; // Load the PostgreSQL driver
              try{
                   Class.forName("org.postgresql.Driver");
                   dbcon = DriverManager.getConnection(loginUrl, loginUser, loginPasswd);
              catch (ClassNotFoundException ex){
                   System.err.println("ClassNotFoundException: " + ex.getMessage());
                   throw new ServletException("Class not found Error");
              catch (SQLException ex){
                   System.err.println("SQLException: " + ex.getMessage());
         // Use http GET
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                             throws IOException, ServletException {
              response.setContentType("text/html"); // Response mime type
              PrintWriter out = response.getWriter(); // Output stream to STDOUT
         out.println("<HTML><Head><Title>Db Servelt Example</Title></Head>");
         out.println("<Body><H1>Example of Servlet with Postgres SQL</H1>");
         try {                // Declare our statement               
              Statement statement = dbcon.createStatement();
              String query = "SELECT empid, name, dept, "; // Perform the query
              query += " jobtitle ";
              query += "FROM employee ";
              ResultSet rs = statement.executeQuery(query);
              out.println("<table border>");
              while (rs.next()) {      // Iterate through each row of rs
                   String m_id = rs.getString("empid");
                   String m_name = rs.getString("name");
                   String m_dept = rs.getString("dept");
                   String m_jobtitle = rs.getString("jobtitle");
                   out.println("<tr>" +
                                       "<td>" + m_id + "</td>" +
                                       "<td>" + m_name + "</td>" +
                                       "<td>" + m_dept +"</td>" +
                                       "<td>" + m_jobtitle + "</td>" +
                                  "</tr>");
              out.println("</table></body></html>");
              statement.close();
         catch(Exception ex){
              out.println("<HTML>" +
                             "<Head><Title>" +
                             "Bedrock: Error" +
                             "</Title></Head>\n<Body>" +
                             "<P>SQL error in doGet: " +
                             ex.getMessage() + "</P></Body></HTML>");
              return;
         out.close();
    and web.xml file is
    <web-app>
              <database>
                   <driver>
                   <type>org.postgresql.Driver</type>
              <url>jdbc:postgresql://127.0.0.1:5432/ali</url>
              <user>ali</user>
              <password>ali</password>
                   </driver>
              </database>
              <servlet>
              <servlet-name>DbServletExample1</servlet-name>
              <servlet-class>dbservlet.example.DbServletExample1</servlet-class>
              </servlet>
              <servlet-mapping>
              <servlet-name>DbServletExample1</servlet-name>
              <url-pattern>/db11</url-pattern>
              </servlet-mapping>
    </web-app>
    Thanks in advance

    That web.xml doesn't look right to me.
    what's that <database> tag? I would only expect to see a <resource-ref> in the web.xml.
    I would not touch the server.xml. Create a context.xml and put it in your META-INF directory. That should look like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/your-path" reloadable="true" crossContext="true">
        <Resource name="jdbc/your-jndi"
                  auth="Container"
                  type="javax.sql.DataSource"
                  username="your-username"
                  password="your-password"
                  driverClassName="your-driver-class"
                  url="your-url"
                  maxActive="10"
                  maxWait="60000"
                  removeAbandoned="true"
                  removeAbandonedTimeout="60000"/>
    </Context>%

  • Problem downloading .doc, .xls file using servlet

    i have a servlet which downloads the files to client(browser). It works file for .txt file but .doc, .xls files are opend but they contain garbage.
    plz letr me know if u know problem!!!!!
    -amit

    Probably because you output them using the Writer you got from getWriter instead of using the OutputStream you can get from getOutputStream.

  • PageNotFound when using servlets as clients for EJB

    Can anyone help me? I have a container managed EJB. I'm using servlets as my client. I placed my EJB's in a jar file and my servlets and html pages in a WAR file. I deployed them using J2EE's deploytool. I can access my html files but not my servlet files. It always says file not found or a 405 error (resource not allowed) I access my servlet this way...
    http://localhost:8000/ReservationContextRoot/ReservationAlias
    my web.xml file looks like the following:
    <?xml version="1.0" encoding="Cp1252"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN' 'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd'>
    <web-app>
    <display-name>ReservationWAR</display-name>
    <description>no description</description>
    <servlet> <servlet-name>ReservationServlet</servlet-name>
    <display-name>ReservationServlet</display-name>
    <description>no description</description>
    <servlet-class>ReservationServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ReservationServlet</servlet-name>
    <url-pattern>ReservationAlias</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <resource-ref>
    <description>no description</description>
    <res-ref-name>jdbc/ReservationDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <ejb-ref> <description>no description</description>
    <ejb-ref-name>ejb/Reservation</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>ReservationHome</home>
    <remote>Reservation</remote>
    </ejb-ref>
    </web-app>

    Are you sure your servlet class itself can run without problem? Try debug in the these steps:
    1. Change your servlet to simply output some HTML text, so you can be sure tomcat can get to your servlet. If this is OK, it means the servlet itself has problem, probably the EJB stuff.
    2. Make sure the EJB container is running.
    3. Make your servlet a standalone client (not a servlet) and see if it can run. Pay attention to how you do JNDI lookup of the EJB.
    Yi

  • When to use servlets / when applets

    hi there,
    building a web application when do I use servlet technology and when applets? What are the arguments to let me choose between them? Or combine both servlets and applets? Any ideas/URLs are welcome.
    greetings

    is it a matter how powerful my servermachine is?
    No, not really, but an applet will use the processor on the client and the servlet will use the server's cpu, so that could potentially be an issue for you.
    or a matter of security or whatever?
    There are security issues with Applets, as they cannot access system resources, but neither can Servlets, so I think that's a non issue.
    What exactly do you need to do with the data once you get it out of the database? THAT is the real question! If you want to fetch data and then display the data as text or HTML in a browser, use a servlet. If you need the client to interact with the data in a more sophisticated way, use an Applet. With an Applet, you can put buttons and sliders and whatever and control things, and interact with the application. But a Servlet is not an application, nor is it interactive. A Servlet is called, it gets parameters from an HTTP client, and then it responds, and it's done. An Applet has runtime, and stays running, to interact with the client indefinitely.
    I'll give you a real world example. With a Servlet, you might output a web page to a browser, and show an advertisement somewhere on the page. However, an Applet could show an advertisement, and update that ad every few seconds or so, and show one after another, like a slideshow. Even better, an Applet could go get a BRAND NEW ad that was just put in the database and get the new ad at runtime, showing up to the minute results. An Applet could do a stock ticker program, Servlet cannot. Get the difference?

  • Why we use servlets

    Hi everyone,
    My question may sounds stupid but what I can't uderstand is that why should I use servlets when I can use simple java classes in JSP files. For example, I can include my java classe in JSP page for database handling, why would I ever use a servlet for the same purpose?

    Whereas the JSP scenario might work in this situation, real servlets can come in useful in other cases.
    If you use velocity engine to generate the pages, the page contents do not need to be put into jsp's.
    If you provide binary output (image, PDF etc.), servlets are better.
    Servlets can be used to build frameworks etc.

  • Why do you still use servlet since the jsp is powerful?

    Jsp is servlet,I think.
    Jsp is more useful, because it's auto compile,output HTML easily and need not deploy.
    Would you please tell me anything must be implemented by servlet?

    just using jsp is as "wrong" as just using servlets.
    first it depends on what you are doing.
    Servlets are best fit for complex programming stuff i.e. business logic. JSP are best fit for userinterface task, to present data, for a lot of html work.
    so normally you use servlet for request processing, than you put the response data in a bean and redirect the request to a jsp which gets the presentation data from the bean.
    So, it's not jsp or servlet better or worse, they are, together with beans the three musketiers.... :-)

  • How to read a file using servlet

    hi ,
    i've to read a file using servlet ,
    should read the file using servlet and display it in JSP,Could anybody get me how can i do it .
    Shiva

    To do that you need to get the response output stream and write yur file contents to that.
    response.setContentType(mimeType); //Set the mime type for the response
    ServletOutputStream sos = resp.getOutputStream();
    sos.write(bytes from your file input stream);
    sos.close();

  • URGENT.........File Upload using Servlets and jsp

    I am a new servlet programmer.......
    iam using tomcat server......
    can any one pls help in writing code for file upload using servlets and jsp without using multipart class or any other class like that....
    Please URGENT..

    Slow down! "Urgent" is from your perspective alone. I, myself, am not troubled or worried in the least.
    hi ugniss
    thanks for ur reply....sorry i was not
    y i was not asked not to use multipart class or any
    other class like that...is there any other
    possibility to do file uploading from jsp to
    servlet...
    Just as an aside, a JSP is a Servlet. But even if I move beyond that, the question does not make sense. If you want a "JSP to upload to a Servlet", then simply do so in memory. You are still (likely) within the same scope of a given request. However, if instead you are referring to a JSP that is displayed on a browser, then really you are talking about HTML, which is what the browser will receive. And since you are now talking about a browser, your only real, viable option is a multi-part file upload. So, it is either server or it is browser. And either way, the question leads to very established options, as outlined above.
    the main concept is.. in the browser the user selects
    a particular file and clicks the button upload..after
    clicking upload the jsp should sent the file to the
    servlet in streams...there the servlet gets in and
    saves in a server location........this is wat i hav
    to do...
    Okay. So, after reading my previous (redundant) paragraph, we have arrived at the crux of the issue. You have a JSP that will be output as HTML to a client (browser) which you want to upload content to your server (handled by a Servlet). So, you are now stuck again with multi-part. The requirement to not use multi-part is non-sensical. You can overcome it, say, if you write your own applet or standalone Swing client. However, if your users are invoking this functionality from a browser, you are limited by the options that W3C has provided you. Use multi-part.
    is there aby possibilty to do this.....can any one
    pls help....Take the advice to download and review Jakarta Commons FileUpload. Inform your management that their requirement makes no technical sense. Research on your own. There are dozens of examples (and tutorials) on file upload using multi-part. Embrace it. Live it. Love it.
    - Saish

  • Open Jasper Report in new page using servlet

    Guys,
    Looks very simple but i am having problem making this process work. I am using 11.1.1.4
    This is my use case:
    - From a employee page, user clicks on a menu item to open report for current employee. I need to pass appropriate report parameters to servlet and open report into new page.
    I can successfully call servlet using commandmenuitem and set request parameters and call servlet from backing bean.... but that doesn't open report in a new page.... any way i can do this?
    Another option i tried was that using gomenuitem and setting target=blank but in that case i need to pass the parameter using servlet url which i like to avoid.(in case i need to pass many parameters in future) (also values will be set on page so i need to generate url when then click the menuitem...... so there are some hoops and loops i need to go through) I don't know a way to pass the request parameter using backing bean to servlet... i don't think it is possible.
    Those are the two approaches i tried.
    If you have any better approach...I would appreciate if you can let me know. (i have searched on internet for two days now.... for the solution)
    -R
    Edited by: polo on Dec 13, 2011 7:22 AM

    Hi,
    Hope following will useful
    http://sameh-nassar.blogspot.com/2009/10/using-jasper-reports-with-jdeveloper.html
    http://www.gebs.ro/blog/oracle/jasper-reports-in-adf/

  • Need to convert an image to .jpeg using Java !

    Hello,
    i am working in images now. i need to convert any image in the form of .jpeg using Java. in other words, i need to store an image in the form of .jpeg format. can any of u help me ! thanks in advance.
    - Krishna

    There's also jimi, at http://java.sun.com/products/jimi/
    You can do something like:
    image = new BufferedImage (width, height, BufferedImage.TYPE_INT_RGB);
    // create your image
    String path = "/path/image.jpg";
    Jimi.putImage(image, path);
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to define target window when redirecting within frames using servlet?

    Howdy:
    Is there a way to define target window when redirecting within frames using servlets?
    How to do it in JSP as well?
    T.I.A.
    Oriental Spirit

    Your servlet (or JSP) can't decide where it is going to be displayed. The browser has already decided that when it makes the request to your servlet.

Maybe you are looking for

  • Vendor Account group assign recon. account

    Hi Experts, I'm looking tcode to assing recon. account for vendor account group. I created Vendor account group and recon. account. I would like to have in tcode fk01 assing Vendor account group to recon. account. Now in tcode fk01 I choose vendor ac

  • When I try to sign into my Apple ID its says that the maximum number of free accounts have been activated on this iPod touch

    When I try to sign in its says I can't because of the maximum free accounts were activated

  • Applying SSL

    Hi, Our company has a Critical info. in document management system. We have Oracle 9ias, Oracle iFS, and Oracle 9i. How to implement security of documents Apart from the ACL's supplied by Oracle. Regards, Nagavenugopal

  • Program crashes when communicat​ing GPIB with a Ruska 6610

    We running a simple vi that is controlling and reading data from a Ruska 6610.  We have recently upgraded our computers (operating system Window 7) and software to LabVIEW 2009.  When we run the vi or executable, the program crashes for no apparent r

  • ASCP Scenario Testing Scripts

    Hello! Group, We are in the process of starting the implementation of the ASCP Module 11.5.8. I was wondering if any one in the forum would be willing to share or guide me in creating a scenario testing script for the ASCP module to validate the func