[JSF 2] File upload. Is this feature handled already?

Hello,
I need to allow a user to upload many files through the same form.
This is what I would have done with Struts with this HTML code:
<input type="file" name="file1" size="62" value="" />
<input type="file" name="file2" size="62" value="" />
<input type="file" name="file3" size="62" value="" />and the use of the org.apache.struts.upload.+FormFile+.
However, I see no direct access to this feature through the JSF 2.0.
no special <h:> tag.
Reading old JSF code on the web, Tomahawk or Icefaces were used for this task.
But today, Tomahawk doesn't support JSF 2, and Icefaces has an 2.0 Alpha 2 version that offers many features except File Upload that is still not working (for their update of the month of January: no updates since?).
More than that, I was trapped few days ago by a strange behavior of JSF 2.0.
Setting a "+multipart/form-data+" enctype to my form made JSF 2.0 loop on form validation, without ever submitting it.
I am sure I didn't dreamed when it happened to me. And removing that enctype made the <h:form> returning to its default "+application/x-www-form-urlencoded+" enctype generation, and everything went fine then.
But I know that attempting to upload files form a web page involve setting a "+multipart/form-data+" enctype on it... I feel doomed.
All these questions make me return to you all, again. I wonder if you have succeed in using file upload with JSF 2.0 already.
What mean do you use for that? Any component already exist that is compliant with JSF 2.0?
Thanks for your help,
Grunt.

Are you aware that multi-part forms are not supported by Servlet implementations out of the box? You need to add a filter or manually invoked multi-part processing to support file uploads in any Servlet based solution.You're right. Until JSF 2 takes benefits from Servlet 3.0 who offers a getPart() function, a filter looks mandatory.
Therefore, I tried the most advanced "faces" available for file upload: Primefaces 2.0.2, who provides a filter. However, it's not enough. The whole Primefaces solution for file uploading works chaotically. For me, it handles the multipart request well, but isn't able to join the listener the uploadFile tag defines, at submission time. I won't enter into details because this is not the good forum to discuss of that specific trouble of Primefaces. I did post my problem on Primefaces forum, and learned that this feature isn't working well yet.
Icefaces doesn't offer the file uploading currently. Even its compatilibilty mode to version 1.8 is told (by the release note) not being able to handle file uploading yet.
Richfaces just began its version 4.0.0 and is far from offering file uploading.
If creating a working file upload was something possible yet, I can say for sure that any of these "faces" would had offered a working feature the sooner they could. But rather than that, I am reading ideas about some Mojarra 2 low level bugs that would disallow this feature to be implemented at the moment.
It can't be only a story of a filter to write. That filter would have been written already hundred of times, else. A complete working solution would be shown everywhere.
Currently, to summarize all, whatever a theorical reason is given, or a practical one (RFE missing, no time to write it, not a critical feature, or even unwished feature, depending of everyone thoughts in the previous replies to this post), file uploading is not available for JSF 2.0 by any existing way. No tier API or Faces is able to provide it, as it could be easily proven by the fact... that no samples are currently existing, working.
Myself, but I might be alone believing it, I consider this missing feature like a JSF 2 flaw.
I guess its a mojarra internal bug that disallows developers to provide a solution yet. This is not abnormal: JSF 2.0 has six months only, and can't work perfectly yet.
But the more the correction of that feature will be delayed, and the more the developers will be in trouble, as nothing else is able to work in compatibility with JSF 2.0 (no existing working sample, I need to repeat it). And worst than that, this kind of flaw is one of those that in enterprise, at decision time, can makes JSF 2 discarded for another framework, less smart, but doing everything expected. It would be a shame, then.
So, I think this problem should not be taken disdainfully. It's not a matter of "+You should only put a filter here+", "+It's not our work+", "+Please write our specs+", "+Wait, only wait, it will come for sure one day...+". Its more significant than that. It requires your study. The one of competent people like you are, and having goodwill. Because I understand that this is a problem that has been thrown away since a long time! But it is returning back to us like a boomerang at great speed.
Among the features that JSF 2 offers and the ones that are currently under development, they are many, many of them, that will look secondary if at the end of all, file uploading isn't available.
Regards,
Grunt.

Similar Messages

  • JSF Calendar/ File Upload

    Can any one of you suggest me any tutorial about Calendar function? How to add the calendar component into Studio Creator? Highly appreciate your help.
    Also, I need help on File upload.

    Thanks for the information. But I have a question on Calendar component . I want the Calendar component to be open when user wants to enter a date. Otherwie it looks akward in a page to keep the component visible all the time. How do I do that? What I am thinking is, i want to make this small and upon clicking it will open the calendar and select date. Thanks for your help in advance.
    About Fileupload
    Do I have to copy any jar file from MyFaces. I am using SUN Studio Creator. Do I have to import anything?

  • File upload and download feature

    Hi,
    I want to make a application using APEX that will help to upload a file to a specified web directory and create a link to download it further. Can you please help me.
    Thanks & Regards,
    Kaushik

    Thanks Andre !!
    I have created the application below, and it works (http://apex.oracle.com/pls/apex/f?p=33295:1:2882346186436::::: user/pwd: kaushik).
    Now my requirement is, I have to upload and store files category wise(.doc files in \main\doc folder, .xls files in \main\excel folder) and I want to download them with corresponding path. Please help.
    Appreciate if you can send me a link with demo.
    Regards,
    Kaushik

  • Error while during file upload in JSF

    Hi
    I do get this error while uploading a file in JSF .
    org.apache.myfaces.webapp.filter.MultipartRequestWrapper.parseRequest(MultipartRequestWrapper.java:134)
         at org.apache.myfaces.webapp.filter.MultipartRequestWrapper.getParameter(MultipartRequestWrapper.java:163)
         at javax.servlet.ServletRequestWrapper.getParameter(ServletRequestWrapper.java:157)
         at com.sun.faces.context.RequestParameterMap.get(ExternalContextImpl.java:673)
         at jsf.PagePhaseListener.afterPhase(PagePhaseListener.java:18)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:211)
    Can anybody wat i must do

    thanks....
    but that answer is not solve my question. Actually i want to know.. can we develope a custom tag in JSF for file upload......

  • Multipart form (file upload) processing in providers

    Hello,
    Just want to find out if anyone has successfully implemented a file upload mechanism within a Portal channel.
    According to the Provider API (http://docs.sun.com/source/816-6428-10/com/sun/portal/providers/Provider.html), the wrapped request/response objects do not support several methods that are essential to process file uploads, namely "getContentLength" and "getInputStream". I am currently trying to use the Apache commons-fileupload utility which uses those methods to process file uploads. This is also the case for another popular file upload utility from servlets.com.
    Does anyone have any info/explanation regarding this limitation in Portal Server 6, and any workarounds to this issue. One workaround is to have a window popup that interacts directly with an external webapp.
    Any ideas/suggestions will be appreciated, thanks in advance.
    jeff

    Hi Jeff,
    The Sun ONE Portal Server DesktopServlet does not have the ability to process a request with the content encoding type of multipart/form-data. DesktopServlet does not pass the input stream for the request on to the Provider.
    To accomplish handling of multipart/form-data type requests, it is necessary to create a companion servlet or JSP that process the multipart/form-data. This servlet can then pass control back to the Portal channel. The data from the file can be shared between the servlet and the provider by using static Java members or by storing the data in a back-end database and then passing a reference to the data over to the provider.
    Sanjeev

  • File upload tomahawk

    Hey Guys,
    i implemented a file upload using this tutorial:
    http://www.nabble.com/Tomahawk-1.1.3-inputFileUpload-solution-to6449010.html
    It works fine. I basically just want to extract the content of a text file.
    private UploadedFile upFile;
    public String getContentFromTextFile() {
              try {
                   if (upFile.getName().endsWith(".txt")) {
                        InputStream inputStream = upFile.getInputStream();
                        InputStreamReader infile = new InputStreamReader(inputStream);
                        BufferedReader inbuf = new BufferedReader(infile);
                        StringBuilder stringBuilder = new StringBuilder();
                        String line;
                        while ((line = inbuf.readLine()) != null) {
                             stringBuilder.append(line);
                             stringBuilder.append('\n');
                        this.currentQuestion.setText(stringBuilder.toString());
                        return "forward";
                   } else {
                        FacesContext
                                  .getCurrentInstance()
                                  .addMessage(
                                            null,
                                            new FacesMessage(
                                                      "Make sure that the file is a text file with the extension .txt"));
                        return "error";
              } catch (IOException ioe) {
                   FacesContext
                             .getCurrentInstance()
                             .addMessage(
                                       null,
                                       new FacesMessage(
                                                 "Make sure that the file is a text file with the extension .txt"));
                   return "error";
              } finally {
                   this.upFile = null;
         }I don't want to store any files, so I added the finally statement setting the upFile property to null. Is that sufficient, to make sure that any files will be left? I appreciate any help in advance.
    konfri

    GrEEn_SK wrote:
    I find, that problem was that page was in subview.That shouldn't be a problem. It's entirely server-side.
    This problem can however be caused by nesting multiple forms in each other --which is prohibited by our holy W3 HTML specification. JSF can't do much against it then. So make sure that your subview doesn't syntactically end up like
    <f:view>
        <h:form>
            <f:subview>
                <h:form>
                </h:form>
            </f:subview>   
        </h:form>
    </f:view>but more as
    <f:view>
        <h:form>
            <f:subview>
            </f:subview>   
        </h:form>
    </f:view>or
    <f:view>
        <f:subview>
            <h:form>
            </h:form>
        </f:subview>   
    </f:view>You can however use multiple forms in parallel.

  • In the new iTunes you no longer have the 'create iPod version' or 'create Apple TV version,' for converting movies. Will this feature return..?

    After installing the new itunes, I inserted some video files, and wanted to create a version for my iPod classic. Before, I could just click on the video and then select 'create iPod version' from the menu. It would then convert the file. However, this feature no longer exist. Is there another way I can easily convert my files?

    David,
    You've probably sorted kahlia_1's problem too! https://discussions.apple.com/thread/4613451?tstart=0

  • [JSF 2.0] How to add a non-displayed comment in JSF xhtml files?

    Hello!
    I would like to know how to put a non-displayed comment in a JSF xhtml file.
    Currently, a *<!-- My comment -->* will be sent in the HTML output.
    I've tried also:
    *// My comment*
    *<%-- My comment --%>*
    and other ideas, but they are failing.
    On the web, I red an ugly solution, implying to add one parameter in each faces-config.xml files our project could have, and asking JSF not to parse some statements (if I remember well).
    Whatever, I am quite sure it was a solution for JSF 1.0 or 0.9...
    There must be a clean way to write a comment, but I just can't find it.
    How do I write a comment that is not displayed on HTML output, in a JSF xhtml file?
    Regards,
    Grunt.
    Edited by: Grunt2000 on May 10, 2010 9:23 AM

    Grunt2000 wrote:
    Hello!
    I would like to know how to put a non-displayed comment in a JSF xhtml file.
    Currently, a *<!-- My comment -->* will be sent in the HTML output.
    I've tried also:
    *// My comment*
    *<%-- My comment --%>*
    and other ideas, but they are failing.
    On the web, I red an ugly solution, implying to add one parameter in each faces-config.xml files our project could have, and asking JSF not to parse some statements (if I remember well).
    Whatever, I am quite sure it was a solution for JSF 1.0 or 0.9...
    There must be a clean way to write a comment, but I just can't find it.
    How do I write a comment that is not displayed on HTML output, in a JSF xhtml file?Does this help?
    <context-param>
        <param-name>facelets.SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>I'm not sure if that works under JSF 2. If not, you can always use <ui:remove/>.

  • Can anybody provide the SQL query to find the files uploaded in a particular folder?

    Hi All,
    Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
    GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
    Any help is greatly appreciated.
    With best regards,
    Nevin

    Nevin,
    Be great if we could know the version of Portal. For Rel. 1, here's the query
    select id,masterthingid from wwv_things
    where siteid = &site
    and cornerid = &corner
    &site - Content Area id
    &corner - Folder id
    if you don't know the folder id, use
    select id from wwv_corners where siteid = &site
    and name = &folder
    Hope this helps. I have run into this situation before. Usually, the culprits were
    one of the following:
    1. Junk Characters in description of item (caused due to Copy-Paste)
    2. Special Characters in the File name
    Hi All,
    Can anybody provide the SQL query to find the documents (document name) uploaded in a particular folder? While clicking on folder in
    GUI I'm hitting the Timeout error. I would like to find the files uploaded into this folder from SQLPLUS.
    Any help is greatly appreciated.
    With best regards,
    Nevin

  • Character Direction: where can I find the settings for this feature?

    Hi there,
    I keep getting an override in my Paragraph Style-menu saying: "Character Direction: Left To Right". It might have to do with the fact that I'm using styles that were created in CS3 - I'm using old .indd-files.
    Is this feature even mentioned somewhere in a menu or panel? Cause I've been looking everywhere and I'm getting slightly frustrated by now - even more because the Character Direction is in fact Left To Right as far as my eyes can see.
    How can I clear the override without having to use Alt+click?
    Thnx.
    Gijs

    That's my main issue with scripts, it should be easy, but somehow they hardly ever work for me.
    Did what you said and I got this error.If I don't select the text frame it will give me another error. If I select the text it doesn't do anything.
    Alt+click will do fine, don't worry. Thanx for the help though.
    Greetz,
    G

  • CF9 Multi File Upload Widget

    This new CF9 Multi File Upload widget looks great but it appears it is built using the old CFFILE code rather than that found in the new fileOpen, fileRead etc. functions - the difference being that the latter doesn't load the entire document in memory before writing which avoids several problems.
    Am I correct in that this new widget is built on CFFILE 'technology'?
    Thanks!
    Shane

    No - they do not work the same.  Unfortunately, there is no fileUpload.
    I cannot find a single example of how to use the new functions to perform a file upload.  This is the code I have come up with and it works fine - except the doc gets saved with the temp name instead of the 'real' name.
    <!--- get file name --->
    <cfset originalFileName = GetFileFromPath(FORM.sFile)>
    <!--- upload file --->
    <!--- instantiate object --->
    <cfset fileOb = fileOpen(FORM.sFile, "read")>
    <!--- move file from temp directory to final folder --->
    <cfset destinationfile = "c:\fileUploads\test\#originalFileName#">
    <cfif FileExists(destinationfile)>
         <cfoutput>A copy of #destinationfile# already exists.</cfoutput>
    <cfelse>
         <cfscript>
           FileCopy(originalFileName, destinationfile);
           </cfscript>
           <cfoutput>Copied: #originalFileName# <BR>
           To: #destinationfile#</cfoutput><BR>
    </cfif>
    <!--- close object --->
    <cfset fileClose(fileOb)>
    <cfset info = getFileInfo("c:\fileUploads\test\#originalFileName#")>
    I'm looking into using JS to set a hidden form value with the original name (file upload object defaultValue) but I'm still not particulary proficient at JS and I doubt it is necessary - I must be doing something wrong with these new CF8 file functions.

  • Tips or tools for handling very large file uploads and downloads?

    I am working on a site that has a document repository feature. The documents are stored as BLOBs in an Oracle database and for reasonably sized files its not problem to stream the files out directly from the database. For file uploads, I am using the Struts module to get them on disk and am then putting the blob in the database.
    We are now being asked to support very large files of 250MB+. I am concerned about problems I've heard of with HTTP not being reliable for files over 256MB. I'd also like a solution that would give the user a status bar and allow for restarts of broken uploads or downloads.
    Does anyone know of an off-the-shelf module that might help in this regard? I suspect an ActiveX control or Applet on the client side would be necessary. Freeware or Commercial software would be ok.
    Thanks in advance for any help/ideas.

    Hi. There is nothing wrong with HTTP handling 250MB+ files (per se).
    However, connections can get reset.
    Consider offering the files via FTP. Most FTP clients are good about resuming transfers.
    Or if you want to keep using HTTP, try supporting chunked encoding. Then a user can use something like 'GetRight' to auto resume HTTP downloads.
    Hope that helps,
    Peter
    http://rimuhosting.com - JBoss EJB/JSP hosting specialists

  • JSF RI 1.0 File Uploads mit Multipart Filter

    Hi there,
    I already posted my problem - I need support for a basic file upload. My requirement is, that I want to access teh file data in a Managed Bean method and then decice what to to with it.
    I decided to use Jason Hunters Multipart Filter, that comes with the oreilly servlet jar file. My problem with the following code is, that the upload() method is never called. I think the filter is not invoked, but I don't know why. Could anyone please see, if I am on the right track?
    First, here is my web.xml with the filter:
         <!-- OReilly MultiPart Filter - by Jason Hunter -->
         <!-- JSF RI 1.0 cannot handle MutliPart Requests -->
    <filter>
    <filter-name>multipartFilter</filter-name>
    <filter-class>com.oreilly.servlet.MultipartFilter</filter-class>
    <!-- we do not specify a special directory, the servlet containers tmp directory is used
    <init-param>
    <param-name>uploadDir</param-name>
    <param-value>/tmp</param-value>
    </init-param>
    -->
    </filter>
    <filter-mapping>
    <filter-name>multipartFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    --> this code comes at the end of my web.xml, so after the jsf cotnroller servlet is configured, etc.
    in my jsp page, I got this form:
    <h:form enctype="multipart/form-data">
    <table width="100%" border="1" cellspacing="2" cellpadding="2">
    <tr>
    <td width="25%" align="right">Bild</td>
    <td width="75%"><input type="file" name="file"></td>
    </tr>
    <tr>
    <td> </td>
    <td><h:commandButton id="upload" action="#{uploadBean.upload}" value="#{messages.uploadFile}"/>
         </td>
    </tr>
    </table>
    </h:form>
    --> the file upload is done with a normal html tag, because there is no jsf tag for it.
    then, here us may upload() method in the managed bean:
    (the upload method is never called... why???? )
         public String upload()
              log.debug("entering upload()...");
              // Files can be read if the request class is MultipartWrapper
              // Init params to MultipartWrapper control the upload handling
              HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
              if (request instanceof MultipartWrapper)
                   log.debug("The MultiPart Filter recognized the mulitpart request.");
                        // Cast the request to a MultipartWrapper
                        MultipartWrapper multi = (MultipartWrapper) request;
                        // Show which files we received
                        Enumeration files = multi.getFileNames();
                        while (files.hasMoreElements())
                             String name = (String) files.nextElement();
                             String filename = multi.getFilesystemName(name);
                             String type = multi.getContentType(name);
                             File f = multi.getFile(name);
                             log.debug("name: " + name);
                             log.debug("filename: " + filename);
                             log.debug("type: " + type);
                             if (f != null)
                                  log.debug("length: " + f.length());
              return "upload";
    THANX! it would be great to get this sample running!

    Hello!
    I have a photo which I store in MSSQL db as a BLOB so it looks like:
    | |
    | Photo |
    | |
    -----------------------+
    | c:\my.jpg | choose |
    -----------------------+
    where
    <f:verbatim>
    <input name="photo" id="photo" type="file">
    </f:verbatim>
    is rendered into standard choose file dialog (unfortunately I can't change it).
    So when user click "choose" it's able to select local file (a picture).
    Then in textbox (input) appear the path (of course it can write it directly).
    A click to the picture
    a) launch javascript:
    onclick="document.getElementById('photo').name='#{DatosPersonalesForm.foto}';"
    that change image value (file name) so I could know which file to look for later:
    <h:graphicImage value="#{DatosPersonalesForm.foto}" ...
    b) after this id calls the actionListener:
    <h:commandLink actionListener="#{DatosPersonalesForm.uploadPhoto}" ...
    In DatosPersonalesForm I have foto property (with get/set) which store foto
    public String getFoto()
    public void setFoto()
    The problem is how to return foto: I put an image in a session and get it from another servlet (registred in web.xml) which intercepts /images/* and return ones from the session.
    I tried use Base64 encoding to embedd images directly, but it works only in Mozilla (even it's html 4.01).
    here is my full DatosPersonalesForm.class (with some additional crap):
    public class DatosPersonalesForm implements Observer, Serializable
    private int idCentro = 1;
    private CurrentClient client;
    private String foto;
    //private String data;
    private Abonado abonado;
    private Persona persona;
    private DireccionTableModel direcciones;
    public DatosPersonalesForm()
    abonado = new Abonado();
    persona = new Persona();
    direcciones = new DireccionTableModel();
    public void setClient(CurrentClient client)
    this.client = client;
    client.addObserver(this);
    public void setIdCentro(int idCentro)
    this.idCentro = idCentro;
    direcciones.setIdCentro(idCentro);
    public void setIdAbonado(int idAbonado)
    if (idAbonado > 0)
    try
    abonado = AbonadoDAO.load(idAbonado, idCentro);
    persona = PersonaDAO.load(idAbonado, idCentro);
    catch (Exception ex)
    FacesContext.getCurrentInstance().getExternalContext().log(ex.toString());
    else
    abonado = new Abonado();
    persona = new Persona();
    direcciones.setIdPersona(idAbonado);
    public Abonado getAbonado() { return abonado; }
    public void setAbonado(Abonado abonado) { this.abonado = abonado; }
    public Persona getPersona() { return persona;}
    public void setPersona(Persona persona) { this.persona = persona; }
    public DireccionTableModel getDirecciones() { return direcciones; }
    public void setDirecciones(DireccionTableModel direcciones) { this.direcciones = direcciones; }
    //public String getData() { return data; }
    public String getFoto()
    if (persona != null)
    try
    Imagenes imagenes = ImagenesDAO.load(persona.getIdImagen(), idCentro);
    if (imagenes != null)
    foto = "/images/" + putImage(imagenes.getImagen());
    //data = Base64Encoder.encode(imagenes.getImagen());
    catch (Exception ex)
    foto = "/img/photo_unavailable.jpg";
    FacesContext.getCurrentInstance().getExternalContext().log(ex.toString());
    return foto;
    public void setFoto(String foto) { this.foto = foto; }
    public void uploadPhoto(ActionEvent e)
    // for which person to upload???
    if (persona != null)
    HttpServletRequest r = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
    if (r instanceof ServletRequestWrapper)
    ServletRequest req = ((ServletRequestWrapper)r).getRequest();
    if (req instanceof MultipartRequestWrapper)
    MultipartRequestWrapper request = (MultipartRequestWrapper)req;
    byte[] photo = (byte[])request.getFiles().get(foto);
    if (photo != null)
    try
    BufferedImage original = ImageIO.read(new ByteArrayInputStream(photo));
    if (original == null) // not an image?
    return;
    BufferedImage scaled = new BufferedImage(128, 160, BufferedImage.TYPE_INT_RGB);
    Graphics g = (Graphics2D)scaled.getGraphics();
    g.drawImage(original,0,0,128,160,null);
    g.dispose();
    ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
    ImageIO.write(scaled, "jpg", out);
    photo = out.toByteArray();
    catch (IOException ex)
    FacesContext.getCurrentInstance().getExternalContext().log(ex.toString());
    return;
    Imagenes imagenes = new Imagenes();
    imagenes.setIdCentro(idCentro);
    imagenes.setIdImagenes(persona.getIdImagen());
    imagenes.setImagen(photo);
    try
    ImagenesDAO.save(imagenes);
    catch (Exception ex)
    FacesContext.getCurrentInstance().getExternalContext().log(ex.toString());
    return;
    putImage(imagenes.getImagen());
    public String clear()
    if (client != null)
    client.setIdAbonado(0);
    // must be mapped in faces-config.xml
    return "clear";
    public void save(ActionEvent e)
    try
    if (persona.getIdPersona() == 0)
    abonado.setIdCentro(idCentro);
    persona.setIdCentro(idCentro);
    Connection con = DatasourceFactory.getConnection();
    try
    con.setAutoCommit(false);
    PersonaDAO.create(con, persona);
    abonado.setIdAbonado(persona.getIdPersona()); // idPersona == idAbonado is autoGenerated by database
    AbonadoDAO.create(con, abonado);
    con.commit();
    catch(SQLException ex)
    con.rollback();
    persona.setIdPersona(0);
    FacesContext.getCurrentInstance().getExternalContext().log(ex.toString());
    finally { con.close(); }
    // notify all about client change
    if (client != null)
    client.setIdAbonado(persona.getIdPersona());
    else
    Connection con = DatasourceFactory.getConnection();
    try
    con.setAutoCommit(false);
    PersonaDAO.save(con, persona);
    AbonadoDAO.save(con, abonado);
    con.commit();
    catch(SQLException ex)
    con.rollback();
    FacesContext.getCurrentInstance().getExternalContext().log(ex.toString());
    finally { con.close(); }
    catch (Exception ex)
    FacesContext.getCurrentInstance().getExternalContext().log(ex.toString());
    direcciones.save(e);
    private String putImage(byte[] image)
    String name;
    HttpSession ses = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false);
    if (ses != null)
    name = "photo_" + String.valueOf(idCentro) + "_" + String.valueOf(persona.getIdPersona()) + ".jpg";
    HashMap map = (HashMap)ses.getAttribute("ImageMap");
    if (map == null)
    map = new HashMap();
    ses.setAttribute("ImageMap", map);
    map.put(name, image);
    else
    name = null;
    return name;
    public void update(Observable o, Object arg)
    if (o instanceof CurrentClient)
    CurrentClient bean = (CurrentClient)o;
    setIdAbonado(bean.getIdAbonado());
    Cheers,
    D.
    P.S. I live in Spain so in Spanish it's foto :-) Sometimes I got crazy coz neither Spanish nor English are my native languages...
    More... in MultipartRequestWrapper you can easy remove
    public Object getAttribute(String name) method. It's my intention to map messages to request properties for easy access (like check if message exists to change style of some textfield in case of error). Do you know the better way???

  • I get a file upload popup when composing an email using Godaddy webmail. How can I prevent this from happening?

    When I try to compose an email from Godaddy's webmail in the Firefox browser. My steps are as follows:
    -Open Firefox.
    -Log in to Godaddy webmail.
    -I hit the compose button.
    -New window pops up. This is the window that I would compose an email in.
    - Right after the compose window loads, I get another window that pops up. This window says "File Upload" in the upper left corner.
    If I exit that window I can then compose my email, and life is good until I want to compose another email. Then the problem repeats. I have contacted Godaddy support and the problem is not on their end. Also the problem DOES NOT happen when using another browser (Internet Explorer).

    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!

  • I am getting this error while file uploading

    Hi!
    I am getting this error while file uploading,I can't find any solution.
    SRVE0026E: [Servlet Error]-[org.apache.commons.fileupload.FileUpload: method setSizeMax(I)V not found]: javax.servlet.ServletException: org.apache.commons.fileupload.FileUpload: method setSizeMax(I)V not found
    at com.honeywell.sdm.base.controller.SDMActionServlet.service(SDMActionServlet.java:75)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
    at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
    at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
    at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
    at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
    at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:983)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:564)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
    at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
    at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
    at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:116)
    at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
    at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
    at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:672)
    Please help me.I have attached the bean,action ,jsp pages
    uploadInfo.jsp
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html:html>
    <HEAD>
    <script>
    function submitting(){
    document.uploadForm.operation.value = "uploadOrgAdj";
    document.uploadForm.action = "/uploadRecAction.do";
    document.uploadForm.submit();
    </script>
    </HEAD>
    <body>
    <html:form action="/uploadRecAction" method="post" enctype="multipart/form-data">
    Select the .xls File to upload data
    <html:file property="fileName"></html:file>
    <html:hidden property="operation" value=""/>
    <html:button property="btn" value="Submit" onclick="submitting()"></html:button>
    </html:form>
    </body>
    </html:html>
    uploadAdjForm :
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.upload.FormFile;
    public class uploadAdjForm extends ActionForm{
    private FormFile fileName;
    * @return
    public FormFile getFileName() {
    System.out.println("getFileName"+fileName);
    return fileName;
    * @param string
    public void setFileName(FormFile string) {
    System.out.println("setileNmame"+string);
    fileName = string;
    Action:
    public class uploadFinancialAdjAction extends DispatchAction{
    public org.apache.struts.action.ActionForward uploadOrgAdj(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception {
    String sForward = "UploadInfo";
    HttpSession session = request.getSession();
    String sStartIndex = null;
    String sEndIndex = null;
    try
    uploadFinancialAdjForm UploadForm=(uploadFinancialAdjForm)form;
    System.out.println(UploadForm.getFileName().getContentType().toString());
    String file=UploadForm.getFileName().toString();
    uploadFinancialAdjManager businessManager = new uploadFinancialAdjManager();
    ArrayList fileName = new ArrayList(); fileName = businessManager.getOrgAdjDetails(file);
    boolean isMultipart = FileUpload.isMultipartContent(request);
    if(isMultipart){
    // Create a new file upload handler
    DiskFileUpload upload = new DiskFileUpload();
    // Parse the request
    List items = upload.parseRequest(request);
    //Process the uploaded items
    Iterator iter = items.iterator();
    while (iter.hasNext()) {
    FileItem item = (FileItem) iter.next();
    if (item.isFormField()) {
    //processFormField(item);
    if(item.getFieldName().equalsIgnoreCase("txtStartIndex")){
    sStartIndex = item.getString();
    else if(item.getFieldName().equalsIgnoreCase("txtEndIndex")){
    sEndIndex = item.getString();
    uploadFinancialAdjForm UploadForm=(uploadFinancialAdjForm)form;
    String file=UploadForm.getFileName().toString();
    uploadFinancialAdjManager businessManager = new uploadFinancialAdjManager();
    ArrayList fileName = new ArrayList();
    fileName = businessManager.getOrgAdjDetails(file);
    }else{
    if(item.getName()!=null && !item.getName().toUpperCase().endsWith(".XLS")){
    throw new Exception("Please browse an excel file and Upload");
    session.setAttribute("fileItem",item);
    }//end of while
    session.setAttribute("startIndex",sStartIndex);
    session.setAttribute("endIndex",sEndIndex);
    request.setAttribute("FileUploadStatus","true");
    else{
    throw new Exception("Error:Form is not multipart");
    catch(Exception e)
    System.out.println(e);
    return mapping.findForward(sForward);
    }

    Plz answer for my question

Maybe you are looking for

  • Using Location: to Redirect PHP on form submit

    Ok, I have this page where the user submits a form using  <form name="form1" method="post"          action="<?php echo $_SERVER['PHP_SELF']; ?> and it runs this code below.  Basically sends and email and writes some files to the database.  I want tha

  • Can't open a CS3 document in CC

    Hi there, A have an old CS3 InDesign document, that I cant open in CC...?

  • Credit for damages

    Hi, When an Item is damaged in transit during vendor delivery, the vendor needs to refund for the damaged item. Hence the item was completely damaged the vendor says dont return the item but will issue the credit. I would like to know how to process

  • How to retain the picture drawn by my mouse?

    i have a label which i would use my mouse to draw on it.. however the screen would refresh after 1 minute or when i move the window, the image that i have drawn would also disappear. how can i retain my picture so that it would always stays there? ar

  • Airdisk won't do Time Machine backup.

    I just upgraged to the new AEBS (dual band). The network is up and running fine. I have attached a USB external hard drive to serve as networked storage and would alsdo like to use it for Time Machine (TM) backups of our various computers. The drive