Commons file upload in IFRAME doesn't work

Is there any special handling for Using File Upload in a jsp page in IFRAME.
Because my upload code works every where in applicatuion but when used in
iFRAME it doesn't work
Please share your ideas what would be the problems using file uploads in IFRAMES?

It is working Alternatively if send the request processing to the parent page
Message was edited by:
raghuveer_vellanki
Message was edited by:
raghuveer_vellanki

Similar Messages

  • Jakarta Commons -- File Upload does not work with Application Server

    Hi ALl,
    I tried Jakarta Commons file upload. In the netbeans, I copied the common jar files "commons-io-1.2.jar" and "commons-fileupload-1.1.1.jar" in the
    netbeans-5.5\enterprise3\apache-tomcat-5.5.17\common\lib and set the class paths. It is working correctly when I compile and run from the netbeans. However, when I deployed in Sun Application Server PE 9.0, I am receiving the following errors. In Sun application I copied the above jars files to "C:\Sun\AppServer\jdk\jre\lib\ext"..
    I have read in several postings that it does not work this way but could find any solution. Any idea will be greatly appreciated.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:930)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:863)
         org.apache.jsp.fileUpload_jsp._jspService(fileUpload_jsp.java:109)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    root cause
    java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
         org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:116)
         org.apache.jsp.fileUpload_jsp._jspService(fileUpload_jsp.java:76)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    note The full stack trace of the root cause is available in the Sun Java System Application Server Platform Edition 9.0 logs.
    Sun Java System Application Server Platform Edition 9.0
    Thank you,
    --Sam                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi All,
    I solved this few minutes after I posted this question. Thought I should share with everybody, just in case some one else need it.
    I copied these three files in the folder C:\Sun\AppServer\jdk\jre\lib\ext
    1. servelet-api.jar
    2. commons-io-1.2.jar
    3. commons-fileupload-1.1.1.jar
    No need to set any class path.
    Thanks

  • I upgraded to Lion and now can't print PDF files and Acrobat reader doesn't work anymore. What can I do to get it working?

    I upgraded to Lion and now can't print PDF files and Acrobat reader doesn't work anymore. What can I do to get it working?

    If you upgraded and were using a version of Acrobat Reader that was legacy, that is PPC compatible, then you will have to upgrade to a version compatible with Lion as Lion no longer has Rosetta to interface with the legacy software.
    I know that Acrobat, full version, 10 works with Lion...use it myself.

  • File Upload UI element is not working properly inside Table Popin container

    Hi Expert,
    I created a table with popin, i placed file-upload UI element inside table popin contatiner.
    The file upload UI element is displaying properly but, when i click the browse button to select  the file, the file open dialog box is not popping out.
    will table popin support file-upload UI element inside it?
    it not is there any other way to call a file_open dialog box from inside the table popin.
    Thanks,
    James

    If you are on NetWeaver 7.01, you can try both the ACFUpDownload UI element or try creating your own FileUpload in Adobe Flex with Flash Islands.  ACFUpDownload requires the KPRO by default (which is why the same application isn't working for you), but you can write your own handler class to act as the KPRO receiver.  Here is an eLearning on the topic:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/109b9b52-bc00-2c10-8786-e4c5e96d7e04
    and source code:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70645070-bb00-2c10-f086-f126721acdb4
    If you want an eLearning on the FlashIslands approach, you can find it here as well:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50d42644-91ef-2b10-228c-9e0ae75b274e
    and Source Code:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f044b62c-90ef-2b10-64a6-9ec25294d133
    However in both of these approaches you still have to be careful with how you handle large files.  The problem is that they are processed often a single binary string.  This makes the processing easy, but requires total amount of session memory at least as large as the file being uploaded.  In NetWeaver 7.02 ABAP adds the concept of Streams and Locators to help with the partial processing of large files.  This feature doesn't come until later this year, but if you are interested you can learn about it here:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80f983df-213e-2c10-ba89-b5a12ef178e8

  • Uploading on DW6 doesn't work properly

    Uploading files via FTP on DW6 has lots of problems and for multiple files often doesn't work at all. I now have to use DW5 or an FTP application to do these tasks, where it works flawlessly!

    I have the same problem.
    Every time I upload a file to the remote server it changes the permisssions. It's happedned on every site I've been working on, on lots of different servers. So it's definately a CS6 probelm. What I've been doing is going to the file in the remote server, right-hand clicking on it select Set Permissions then click Read All, Write All, Execute All. it sets everything to 777 and the browser can read it again. It's a pain in the arse to do all the time but it's the only thing that I found that works. I just submitted a bug report so hopefully there's a fix out soon.

  • File Upload Action Button are not working

    Hi  ,
    In the File Upload Process when the processor are open change request there are Action Buttons  Approve/Reject ,
    When the CR Processor are Click on either Approve or Reject  these two Action Button are not working (means its not show any activity) , while rest of all action button like save,close check , Run validation  are working ...
    While Processor has authorization to Approve/Reject that CR ...

    Hello Nikhilesh
    These buttons are dependent upon the workflow steps. Check that. Check the linkage for workflow. Check SWI6 - CR number and the step. Based on the step you can identify whether the proper step is assigned or not.
    Thanks
    Kiran

  • Javascript multiple file upload with progressbar does not work in firefox, please help

    I want to upload files using this javascript snipped as well as processing non file fields on the same form. This works beautiful in IE11, Chrome and Opera, but not in firefox (version 34).
    I fired the non file handler with the action attribute on the <form> like this:
    <form id="upload_form" enctype="multipart/form-data" method="POST" action="nonFile.php">
    and the javascript with:
    <input name="submit" type="submit" style="background: green" value="Submit" onclick="return uploadFiles()"/>
    When I change type="button" the file uploads work in FF but the I have no control over the non file fileds.
    Can someone gives me an indication of what is wrong?
    oXHR.upload.addEventListener("progress", function(e){
    var percent=(e.loaded/e.total) * 100;
    _(idProg).value = Math.round(percent);
    _(idstat).innerHTML = filename.name + " "+Math.round(percent)+"% --- Please Wait";
    }, false);
    // Upload finish, show the size of the file in Bytes, KBytes or MBytes
    oXHR.onreadystatechange = function(){
    if (oXHR.readyState == 4 && oXHR.status == 200){
    var iBytesTransfered = bytesToSize(filesize);
    _(idstat).innerHTML = filename.name + " Size: " + iBytesTransfered + " "+100+"%";
    _(idProg).value = 100;
    // Upload failed
    oXHR.addEventListener("error", function(e){
    _(idstat).innerHTML = "Upload Failed";
    }, false);
    // Upload aborted
    oXHR.addEventListener("abort", function(e){
    _(idstat).innerHTML = "Upload Aborted";
    }, false)

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0, 0,0" width="600" height="360">
    <param name=movie value="example.swf">
       <param name="allowScriptAccess" value="always" />
    <param name="quality" value="high">
    <param name="allowScript" value="opaque">
    <param name="wmode" value="opaque">
    <embed src="example.swf" quality="high" allowScriptAccess="always" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=Shockwave Flash" type="application/x-shockwave-flash" width="600" height="360"></embed></object>

  • Image Policy when I create a PDF file: warn and continue doesn't work

    Hi!
    I need to create a PDF file with lots of images, and I need to know if any of that images is in low resolution (<300 ppi). I have tried to use the image policy in the PDF settings but it doesn't work, because if I choose "Warn and continue" (if the resolution of any image is <300 ppi, warn and continue) the program creates the PDF file but don't warm me and I don't see any message... and I'm sure that there are bad images because I have made a check test with 72ppi images.
    Thank you very much for your attention,
    best regards!!
    (Sorry if my English is not as good as it would be)

    Thank you very much Bernd Alheit, that's perfect for my job!
    Thank you!

  • Can't Join Group Chats, Can't Receive Files, and Skype Home Doesn't Work

    Okay, so back when Windows 8 was newer I got my current laptop and when I saw Skype's original Windows 8 design, I said hell no to that and downloaded an earlier version of Skype instead. When Skype did that big overhaul and stopped support for all older versions, I was at least happy to see it was back to being on the desktop instead of that Windows 8 pseudo-tablet nonsense. But at the same time, I stopped getting notifications from Skype Home - it always says it's unavailable. Some time after that, in between Skype's updates, I started having trouble with Groups. Every time someone tried to add me to one, I couldn't see it, even if they said I was in it on their screen. Eventually I had to start making all Group Chats myself, because at least then it worked for me... up until the 7.7 update. Now no matter how I try to get into a Group now, it straight up doesn't work. And before I got locked out of Groups entirely, I started having issues with files, right around when the "inline photos" thing happened - they just don't work when sent to me, and I can't send them either. When people try to send them to me it's just a grey image and something about how it's not supported or it didn't go through.  I've sort of just been patiently dealing with all of it until the newest update when Groups stopped working entirely and I was in the middle of trying to join an important conversation. I Googled that specific issue and found a ton of unresolved threads about it dating back to at least 2013, I believe. I tried every suggestion I could find - I restarted, uninstalled Skype, reinstalled Skype, restarted after uninstalling and then reinstalling... the list goes on. Every time I got it back, it was the same. Now I'm on Windows 8.1, and I don't know if that's related, but my boyfriend - who uses a Mac - is having none of these problems whatsoever, and he also has the latest version of Skype.  With older versions of Skype not available, I ended up trying Skype Web, and it's letting me see all the Groups, which is the most important thing but I'd really prefer to go back to the desktop version. All three of my issues might be unrelated, but they've all progressed as Skype has updated so I figured I'd try to get help for all of them. I'm at my wit's end, here. I use Skype for a pretty large portion of my online communication, and being unable to use Groups or get files is really crippling the experience. 

    Hi,
    I have the same problem.
    Since I'm using my new Laptop with Skype 7.0, I can't join to a group chat.
    It's a public chat and joining is enabled.
    With my former laptop and former Skype-Version, I never had this problem.
    I could click on a link in the browser and joined to the group.
    I have to chose a program.
    Unfortunately Skype.exe seems not to be the right decision.
    I'm asked to get a Skype-app, which I never needed with the old version.
    Which kind of app do I need and how can I get the app or what else can I do?

  • File download via servlet doesn't work with IE via https

    I have a URL from a jsp page which points to a struts action servlet. This works with firefox via http and https. With IE it works via http but it doesn't work via https. The error message I get is "Internet Explorer cannot download ...File_name.doc from Server_name.
    Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."
    Here is my code.
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)
                   throws Exception {
              String attachmentURL = AppSettings.get("EAIAttachmentURL");
              String encodingScheme = AppSettings.get("EAI_encoding");
              String filename = request.getParameter("URL");
              String fileStr = URLEncoder.encode(filename, encodingScheme);
              fileStr = fileStr.replaceAll("\\+","%20");
              URL targetURL = new URL(attachmentURL + "/" + fileStr);
              URLConnection connection = targetURL.openConnection();
              connection.setDoInput(true);
              connection.setDoOutput(false);
              connection.setAllowUserInteraction(false);
              BufferedInputStream attachmentStream = new BufferedInputStream(
                        connection.getInputStream());
              * Setting the content disposition filename, so that the
              * attachment preserves the original filename
              response.setHeader("Content-Disposition",
                        " attachment; filename=" + filename);
              if (connection.getContentType() != null) {
                   response.setContentType(connection.getContentType());
              else {
                   response.setContentType("application/octet-stream");
              response.setContentLength(connection.getContentLength());
              response.setHeader("Pragma", "public");
              response.setHeader("Cache-Control", "public, max-age=-1, must-revalidate");
              if ( connection.getContentEncoding() != null ) {
                   response.setHeader("Content-Encoding",
                             connection.getContentEncoding());
              BufferedOutputStream responseStream = new BufferedOutputStream(
                        response.getOutputStream());
              byte[] buffer = new byte[4096];
              int bytesRead;
              try {
                   while ((bytesRead = attachmentStream.read(buffer)) != -1) {
                        responseStream.write(buffer, 0, bytesRead);
              } catch (Exception e) {
                   log.error("AttachmentProxy error: " + e.getMessage());
              } finally {
                   if (attachmentStream != null) {
                        attachmentStream.close();
                   if (responseStream != null) {
                        responseStream.flush();
                        responseStream.close();
              return null;
    There is a bug with IE when downloading via https according to Microsoft support site. Refer to http://support.microsoft.com/default.aspx?scid=kb;en-us;812935
    According to this bug, I have set the response header - "pragma" to public and "cache-control" to public. I've also unchecked the Do not save encrypted pages to disk setting in IE Options, Advanced tab.
    Has anyone come across this problem or a similar problem. Any help is appreciated. Thanks.

    I have a URL from a jsp page which points to a struts action servlet. This works with firefox via http and https. With IE it works via http but it doesn't work via https. The error message I get is "Internet Explorer cannot download ...File_name.doc from Server_name.
    Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later."
    Here is my code.
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)
                   throws Exception {
              String attachmentURL = AppSettings.get("EAIAttachmentURL");
              String encodingScheme = AppSettings.get("EAI_encoding");
              String filename = request.getParameter("URL");
              String fileStr = URLEncoder.encode(filename, encodingScheme);
              fileStr = fileStr.replaceAll("\\+","%20");
              URL targetURL = new URL(attachmentURL + "/" + fileStr);
              URLConnection connection = targetURL.openConnection();
              connection.setDoInput(true);
              connection.setDoOutput(false);
              connection.setAllowUserInteraction(false);
              BufferedInputStream attachmentStream = new BufferedInputStream(
                        connection.getInputStream());
              * Setting the content disposition filename, so that the
              * attachment preserves the original filename
              response.setHeader("Content-Disposition",
                        " attachment; filename=" + filename);
              if (connection.getContentType() != null) {
                   response.setContentType(connection.getContentType());
              else {
                   response.setContentType("application/octet-stream");
              response.setContentLength(connection.getContentLength());
              response.setHeader("Pragma", "public");
              response.setHeader("Cache-Control", "public, max-age=-1, must-revalidate");
              if ( connection.getContentEncoding() != null ) {
                   response.setHeader("Content-Encoding",
                             connection.getContentEncoding());
              BufferedOutputStream responseStream = new BufferedOutputStream(
                        response.getOutputStream());
              byte[] buffer = new byte[4096];
              int bytesRead;
              try {
                   while ((bytesRead = attachmentStream.read(buffer)) != -1) {
                        responseStream.write(buffer, 0, bytesRead);
              } catch (Exception e) {
                   log.error("AttachmentProxy error: " + e.getMessage());
              } finally {
                   if (attachmentStream != null) {
                        attachmentStream.close();
                   if (responseStream != null) {
                        responseStream.flush();
                        responseStream.close();
              return null;
    There is a bug with IE when downloading via https according to Microsoft support site. Refer to http://support.microsoft.com/default.aspx?scid=kb;en-us;812935
    According to this bug, I have set the response header - "pragma" to public and "cache-control" to public. I've also unchecked the Do not save encrypted pages to disk setting in IE Options, Advanced tab.
    Has anyone come across this problem or a similar problem. Any help is appreciated. Thanks.

  • File Upload extension that doesn't time out?!

    Can anyone recommend a good File Upload utility that won't
    time out on a
    shared server? Ideally ASP/VBScript.
    Restrictions on our shared server mean that we only have 15
    seconds to
    execute a script.
    My concern is that this just isn't going to be possible on a
    shared server
    because if someone wants to upload a 3MB image then it's,
    naturally, going
    to take more than 15 seconds.
    Would appreciate any advice, thanks.
    Regards
    Nath.

    This is not a script issue, but a server issue. You would
    need to talk to
    your host.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "tradmusic.com" <[email protected]> wrote in
    message
    news:fu1qrl$r6e$[email protected]..
    > Can anyone recommend a good File Upload utility that
    won't time out on a
    > shared server? Ideally ASP/VBScript.
    > Restrictions on our shared server mean that we only have
    15 seconds to
    > execute a script.
    >
    > My concern is that this just isn't going to be possible
    on a shared server
    > because if someone wants to upload a 3MB image then
    it's, naturally, going
    > to take more than 15 seconds.
    >
    > Would appreciate any advice, thanks.
    >
    > Regards
    > Nath.
    >

  • WRT54GL Need the TFTP EXE link or file please, FTP link doesn't work 550 error.

    Bricked the router, bad flash. Power LED is flashing.
    Need the TFTP excutable please, FTP link doesn't work. 
    Thanks.

    Try this link to unbrick the Linksys Router.Download 44.3 KB the TFTP utility.
    Message Edited by Wizzard on 10-07-2009 09:38 AM

  • Journal Upload to iCloud doesn't work

    Hi! I want to Share a Journal from iPhoto to iCloud, so that I can Share a link to Others. But some how, during the Upload to iCloud the uploadbar Stops at One Point and the Loading Wheel keeps Spinning forever. I have some Files in iCloud, but the link in Safari doesn't Show the photos. Also the File size in iCloud Sems to small. It's like ist Beginns to Upload and then Stops at some Point. I have an iPad Mini and the beweist iOS Update. I trief many Suggestionen in the Internet but nothing wirkend. Can someone give me a hint?

    the upload bar stops at some point
    There are two reasons that I can think of:
    You may have exceeded an upload limit, see  iCloud: Photo Stream limits; in that case you will just have to wait a bit, before you can start uploading again.
    Or one of the photos in your journal is corrupted and cannot be uploaded. Then you will have to find the item that is causing the problem - try to create a small test journal with different photos and try to publish that. Can you publish journals at all, or does only your particular journal not work?
    To check for bad pictures or the layout of your Journal you miht try to share the journal to iTunes instead, if you have a mac:
    See the Paragraph
    Export a journal to iTunes : on this page: Publish on the web

  • Exception while excel processing after upload using commons file upload

    Hi all,
    I am experiencing problem while creating a workbook after getting the input stream from the uploaded file. its not going catch block instead it is going to finally and giving null pointer exeption in finally as one variable in finally is not defined. the variable is defined in try as well as catch but during run time the variable is not getting assigned any value also. I'll put the code over here. please help me with a solution
    import org.w3c.dom.* ;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import jxl.*;
    import org.apache.commons.fileupload.*;
    import org.apache.commons.fileupload.disk.*;
    import org.apache.commons.fileupload.servlet.*;
    import org.apache.poi.poifs.filesystem.POIFSFileSystem;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    public class CescoreUploadServlet extends baseHttpServlet
         private DataSource cesDS = null;
         public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
              doPost(req, res);
         public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
              String targetPage = null;
              File f = null;
              System.out.println("Upload Controller");
              HttpSession session = req.getSession(true);
              try
                   if(cesDS == null){
                        cesDS = new JNDIDataSource(getServletContext().getInitParameter(Constants.DATA_SOURCE_NAME));
                   CesRepository cRep = new CesRepository(cesDS);
                   if (session.getAttribute("DataContainerInfo") == null) {
                        System.out.println("Initializing DataContainerInfo");
                        DataContainer DataContainer = new DataContainer();
                        cRep.setInitialParameters(DataContainer);
                        session.setAttribute("DataContainerInfo",DataContainer);
                   else System.out.println("DataContainerInfo is available");
                   UserInfo userInfo = null;               
                   String login_id = req.getRemoteUser();
                   if(session.getAttribute("UserID") != null) login_id = (String)session.getAttribute("UserID");
                   if(session.getAttribute("userProfile") == null ) session.setAttribute("userProfile", cRep.getUserInfo(login_id));
                   userInfo = (UserInfo)session.getAttribute("userProfile");
                   System.out.println("<<<<<< userInfo contains : "+userInfo.getHrID()+" >>>>>>");
                   String projIdValue = null;
                   String msg = null;
                   boolean isMultipart = FileUpload.isMultipartContent(req);
                   if(isMultipart){
                        System.out.println("is MultiPart");
                        DiskFileUpload upload = new DiskFileUpload();
                        List fileList = upload.parseRequest(req);
                        InputStream uploadedFileStream = null;
                        String uploadedFileName = null;
                        ArrayList impArray = new ArrayList();
                        Iterator iter = fileList.iterator();
                        while (iter.hasNext()) {
                             System.out.println("inside while");
                             FileItem item = (FileItem) iter.next();
                             if (!item.isFormField()) {
                                  System.out.println("item is not form field");
                                  if (item.getSize() < 1)
                                       throw new Exception("No file was uploaded");
                                  else
                                       uploadedFileName = item.getName();
                                       System.out.println("uploaded file name "+uploadedFileName);
                                       System.out.println("uploaded file size is "+item.getSize());
                                       uploadedFileStream = item.getInputStream();
                                       System.out.println("uploaded input stream available size is "+uploadedFileStream.available());
                             else
                                  System.out.println("item is form field");
                                  String key     = item.getFieldName();
                                  String value = item.getString();
                                  System.out.println("key is"+key);
                                  System.out.println("value is"+value);
                                  if(key.equals("projectId2")){
                                       projIdValue = value;
                        System.out.println("outside while");
                        POIFSFileSystem fs = new POIFSFileSystem(uploadedFileStream);
                        System.out.println("got POIFSFileSystem");//this is been printed in logs
                        HSSFWorkbook wb = new HSSFWorkbook(fs);//it is breaking over here
                        System.out.println("got HSSFWorkbook");//this is not been printed in logs
                        HSSFSheet sheet = wb.getSheetAt(0);
                        System.out.println("got HSSFSheet");
                        Iterator rows = sheet.rowIterator();
                        if(rows.hasNext()){
                        while( rows.hasNext() ) {
                             System.out.println("rows iteration");
                             HSSFRow row = (HSSFRow) rows.next();
                             Iterator cells = row.cellIterator();
                             while( cells.hasNext() ) {
                                  System.out.println("cell iteration");
                                  HSSFCell cell = (HSSFCell) cells.next();
                                  HashMap hm = new HashMap();//if everything is fine i'll use this hashmap to store values
                             System.out.println("CES UPLOAD.SERVLET. After adding");
                             msg = "Attendees have been added successfully";
                             req.setAttribute("msgText", msg);
                             targetPage = "/ces_disp.jsp";
                        else
                             throw new Exception("The Excel Sheet Uploaded has no entries. Please check and try again");
                   else{
                        throw new Exception("The Form is not Multipart");
              catch (Exception e)
                   System.out.println("CES UPLOAD.SERVLET.EXCEPTION ::: Exception");
                   targetPage = "/ces_disp.jsp";
                   if(e != null) req.setAttribute("msgText", e.getMessage());
                   else req.setAttribute(Constants.EXCEPTION_ATTR_NAME, new Exception("Unknown Exception"));
                   e.printStackTrace();
              finally{
                   System.out.println("CES UPLOAD.SERVLET. ::: Finally");
                   ServletContext stx = getServletConfig().getServletContext();
                   RequestDispatcher dispatcher = sCx.getRequestDispatcher(targetPage);
                   dispatcher.forward(req, res);
    Message was edited by: Noufal
    Noufal_k
    Message was edited by:
    Noufal_k

    import org.w3c.dom.* ;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import jxl.*;
    import org.apache.commons.fileupload.*;
    import org.apache.commons.fileupload.disk.*;
    import org.apache.commons.fileupload.servlet.*;
    import org.apache.poi.poifs.filesystem.POIFSFileSystem;
    import org.apache.poi.hssf.usermodel.HSSFCell;
    import org.apache.poi.hssf.usermodel.HSSFSheet;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.poi.hssf.usermodel.HSSFRow;
    public class CescoreUploadServlet extends baseHttpServlet
    private DataSource cesDS = null;
    public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    doPost(req, res);
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    //including only relevant code
    String targetPage = null;
    System.out.println("Upload Controller");
    HttpSession session = req.getSession(true);
    try
    String projIdValue = null;
    String msg = null;
    boolean isMultipart = FileUpload.isMultipartContent(req);
    if(isMultipart){
    System.out.println("is MultiPart");
    DiskFileUpload upload = new DiskFileUpload();
    List fileList = upload.parseRequest(req);
    InputStream uploadedFileStream = null;
    String uploadedFileName = null;
    Iterator iter = fileList.iterator();
    while (iter.hasNext()) {
    System.out.println("inside while");
    FileItem item = (FileItem) iter.next();
    if (!item.isFormField()) {
    System.out.println("item is not form field");
    if (item.getSize() < 1)
    throw new Exception("No file was uploaded");
    else
    uploadedFileName = item.getName();
    System.out.println("uploaded file name "+uploadedFileName);//printing  c:/excelsheets/fileToUpload.xls
    System.out.println("uploaded file size is "+item.getSize());//printing size is 15872
    uploadedFileStream = item.getInputStream();
    System.out.println("uploaded input stream available size is "+uploadedFileStream.available());//printing available input stream size is 15872
    else
    System.out.println("item is form field");
    String key = item.getFieldName();
    String value = item.getString();
    System.out.println("key is"+key);
    System.out.println("value is"+value);
    if(key.equals("projectId2")){
    projIdValue = value;
    System.out.println("outside while");
    POIFSFileSystem fs = new POIFSFileSystem(uploadedFileStream);
    System.out.println("got POIFSFileSystem");//this is been printed in logs
    HSSFWorkbook wb = new HSSFWorkbook(fs);//it is breaking over here
    System.out.println("got HSSFWorkbook");//this is not been printed in logs
    HSSFSheet sheet = wb.getSheetAt(0);
    System.out.println("got HSSFSheet");
    Iterator rows = sheet.rowIterator();
    if(rows.hasNext()){
    while( rows.hasNext() ) {
    System.out.println("rows iteration");
    HSSFRow row = (HSSFRow) rows.next();
    Iterator cells = row.cellIterator();
    while( cells.hasNext() ) {
    System.out.println("cell iteration");
    HSSFCell cell = (HSSFCell) cells.next();
    HashMap hm = new HashMap();//if everything is fine i'll use this hashmap to store values
    System.out.println("CES UPLOAD.SERVLET. After adding");
    msg = "Attendees have been added successfully";
    req.setAttribute("msgText", msg);
    targetPage = "/ces_disp.jsp";
    else
    throw new Exception("The Excel Sheet Uploaded has no entries. Please check and try again");
    else{
    throw new Exception("The Form is not Multipart");
    catch (Exception e)
    System.out.println("CES UPLOAD.SERVLET.EXCEPTION ::: Exception");
    targetPage = "/ces_disp.jsp";
    if(e != null) req.setAttribute("msgText", e.getMessage());
    else req.setAttribute(Constants.EXCEPTION_ATTR_NAME, new Exception("Unknown Exception"));
    e.printStackTrace();
    finally{
    System.out.println("CES UPLOAD.SERVLET. ::: Finally");
    ServletContext stx = getServletConfig().getServletContext();
    RequestDispatcher dispatcher = stx.getRequestDispatcher(targetPage);//throwing null pointer exception for this line
    dispatcher.forward(req, res);
    }

  • Search files in current folder doesn't work

    When I search my whole mac for e.g. "Danse Macabre" i get the results from all over the place, which is to be expected.
    So when I go into the folder I get a list of files including the one I was searching for. So far so good.
    While typing in a new search inside that current folder, the file list refreshes and still shows me all files in that folder, even though the search string isn' part of most of the names:
    When I actually specify to only look at the actual file names, the list shows only the file including the actual string. Unintuitive but acceptable. Just pressing the enter key will still show the whole unfiltered directory.
    However - and that is my real grip - when I want to find specific files, e.g. all files containing the string "cab" then this happens:
    The list empties the moment I type in the third letter, which doesn't make any more sense than showing all files when typing in the first letter. And when I actually commit the search which should show me all files containing "cab" in the name, I got nothing.
    This makes the search feature in finder completely useless.
    What's going on?
    And how do I fix it?

    I played around with this a little.
    Although typing into the folder search field gives you an option labeled  "Filename contains…", what you really seem to get is a search for "Filename contains a 'word' that begins with…."
    A new "word" in the filename can be the beginning of the filename, anything that comes after a punctuation character, or a case change. The matching criteria itself ignores the case.
    So in your example, you had a file named "01 Danse macabre.mp3", and a filename search for "cab" didn't find it. I think that is because "cab" is in the middle of the string, and is not a "word" as defined above. As an exercise, I renamed one of my own files as "01 Danse macabre.mp3", and as expected, searching for the filename "cab" didn't find it. However if I then capitalized the "C" so that the filename was "01 Danse maCabre.mp3" then a search for "cab" did find it:
    "Cab" starts a new "word" because of the case change. The search itself is case-insensitive, so that searching for "cab" finds "Cab".
    This shows the problem, but doesn't fix it. As a work-around, instead of using the top-right search field to type in "cab", instead hit command-F to bring up the search window.  Change the initial "Kind is Any" line to "Name contains". Now you get a true "contains" search instead of a "word begins with" search. When I searched for "cab" this this way, I did find "01 Danse macabre.mp3":

Maybe you are looking for