Irritating bugs in file upload component !!

Bug 1
During a postback operation the text (file path name) in the file upload component is cleared ! When a resubmit of a form is required, the user has to re-browse the file again.
Bug 2
The processValueChandge() method is never called when the value in the file upload component is changed (and the mouse is clicked outside the component).
Any suggestions or workarounds are very much appreciated.
Thanks.

I can't answer to Bug 1. That is, I don't have any solutions. If you want to submit this, go to http://developers.sun.com/prodtech/javatools/jscreator/support/index.html and look at the section titled Bug Report /Feature Request
Bug 2
The processValueChandge() method is never called when
the value in the file upload component is changed
(and the mouse is clicked outside the component).This is not a bug.
processValueChange methods are server side methods and do not get called until the page is submitted to the server. Clicking outside the component will not cause the page to get submitted. If you want a client-side action (such as when focus is lost) then you can add some JavaScript.
The file upload does not have a process value change method, it is an action method and thus has a uploadFileButton_action method. This method gets called when the upload button is clicked.

Similar Messages

  • File upload component and text area issue

    Hi guys,
    I have static text, text area and button on the same page. Text area binded to session bean value and all works fine (I can input text into text area and press button to save changes).
    After adding file upload component to the same page I have got a problem - now after page refreshing the non english characters inside text gets trashed.
    Other non english characters - inside static text components remains the same - the problem relates only to text area.
    It looks like file upload component code has an encoding related bug. Is that a known issue?
    And may be somebody have a workaround?
    Thanks.

    Hi Rom@n,
    I did some checking and this issue is currently logged as: 6442528. It is scheduled to be available in the next patch release. I'm sorry I don't have a time frame for the patch since it is still waiting for other fixes.
    Sorry for the inconvience.
    Lark
    Creator Team

  • Hot to call processValueChange() method of the file upload component?

    When the value changes (when I choose a new file to upload) in the file upload component the processValueChange() method is not called.
    I am planing to show the preview of the image to be uploaded using the processValueChange().
    Thanks.

    Is there a bug connected with this issue?
    Thanks.

  • How to use file upload component inside a portlet

    Hi
    Thank you for reading my post.
    does file upload works inside portlets ?
    can some one help me with a sample code , does it need some tricks ?
    Thank you

    any help is welcomeLegolas,
    You could try your own implementation. Someone was able to implement a file upload with Creator 2004Q4 and the O'Reilly Servlet. See http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=50186.
    You will have to configure O'Reilly Servlet's "MultiPart Filter" in your application. Creator 2 uses a same approach (a filter) to accomplish this. Given that the file upload component is not supported on portlets, this leads me to the following: I don't know anything about portlets and portlet containers, but I'd check first for some architechtural restriction in the portlet subsystem that avoids the use of a filter for a file upload. If think this could be the only thing that will restrict you to implement your own file upload.
    Hope this helps.
    Antonio

  • Screen hangs when user types in some text in file upload component

    Dear All
    I am using file upload component in webdynpro java in a custom application and added some validation logic on the file
    selected. This is being used to upload jpeg files to KM repository. Now the issue is if user types some text in the file
    upload input field and click on upload button the screen hangs and it goes to infinite loop. It seems that the framework is not able to accept and check the arbitrary value entered by user.
    Can anyone tell me how this can be sorted out?
    Thanks
    Sudip

    Hello Sudeep,
    I have also faced the same issue and to me it seems an issue with the UI element itself. Please follow the following threads for more information:
    [http://help.sap.com/saphelp_nw04s/helpdata/en/b3/be7941601b1d09e10000000a155106/frameset.htm]
    and
    [File Upload UI Element going in Infinite loop;
    [upload UI element;
    Hope this may be of some use.
    Regards,
    Gaurav

  • Validator for file upload component is not working !!

    This validator method for a file upload component is throwing a java.lang.NullPointerException.
    public void fileUpload1_validate(FacesContext context, UIComponent component, Object value) {
    long size= fileUpload1.getUploadedFile().getSize();
    if (size>65535){
    throw new ValidatorException(new FacesMessage("Your image is too big!"));
    Any help to solve this problem is very much appreciated.
    Thanks.

    Hi i have a fileUpload in a pop-up and the methods are :
    public void fileUpload1_validate(FacesContext context, UIComponent component, Object value) {
    try {
    com.sun.rave.web.ui.model.UploadedFile uploadedFile = ((Upload)component).getUploadedFile();
    long l_filesize = uploadedFile.getSize();
    if ( l_filesize > 1000000)
    throw new ValidatorException(new FacesMessage("File Size should be less than 1000000 bytes! It is" + l_filesize));
    else {
    String tipo = uploadedFile.getContentType();
    if ( tipo.compareTo("application/word") == -1 )
    if ( tipo.compareTo("application/rtf") == -1 )
    if ( tipo.compareTo("application/pdf") == -1 )
    throw new ValidatorException(new FacesMessage("Error : los tipos de archivo aceptados son PDF, WORD y RTF"));
    } catch (Exception ex) {
    this.mauvaisFichier = true;
    error(ex.getMessage());
    public String botonValidar_action() {
    if ( !this.mauvaisFichier )
    if ( this.fileUpload1.getUploadedFile() != null )
    if ( this.fileUpload1.getUploadedFile().getSize() > 0 )
    try {
    this.getSessionBean1().getComunicacion().setArchivo( new javax.sql.rowset.serial.SerialBlob(this.fileUpload1.getUploadedFile().getBytes() ) );
    this.getSessionBean1().getComunicacion().setTipoArchivo( this.fileUpload1.getUploadedFile().getOriginalName().substring(this.fileUpload1.getUploadedFile().getOriginalName().length() - 3 ) );
    } catch(Exception e){
    e.getMessage();
    return null;
    I have to put a boolean value because the first time, validation code doesn't function ( the method botonValidar_action() is called ) correctly. The error message appears but empty.
    If I try next time then it's ok.
    Thx for any issue.

  • Htmlb table - File upload component

    Hi all,
    Is it possible to use the file upload component in a table view (htmlb for java) column?
    Rgds,
    Subu

    Hi,
    Here is one thought, there is onCellClick event for the Tableview, use that for the required column and add the file upload component as the event handler method in the onCellClick method.
    Link on table view events:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/eb/220a415a47f06fe10000000a1550b0/content.htm">Table view attributes and events</a>
    Link on OnCellClick:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/37/3d8b41b4b3b25fe10000000a1550b0/content.htm">onCellClick</a>
    Check the following link:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/63/9c0e41a346ef6fe10000000a1550b0/frameset.htm">File upload</a>
    Hope it helps.
    Regards,
    Vivekanadan
    Message was edited by: Vivekanandan

  • File Upload Component

    I can not find a function in the Upload class that will allow me to access the browse button
    child component nor can I see any mention of the file upload component in the
    master stylesheet of the defaulttheme jar.
    what am i missing here guys?

    Dear Manjunath Jayaram,
    You don't think it is a problem that one can not access the child of a
    composite component ???
    I am sorry if you don't appreciate the problem but I can not state it any more plainly.
    "I can not find a function in the Upload class that will allow me to access the browse button
    child component nor can I see any mention of the file upload component in the
    master stylesheet of the defaulttheme jar".

  • File upload component in JStudio Enterprise

    Dear all,
    I am not sure that File Upload Component is supported in JStudio Enterprise 8.1 or not. I see that Netbeans has one: http://www.netbeans.org/kb/55/vwp-about_components.html.
    So I thought JStudio Enterprise may have one similar. If so, can anyone tell me how to do that please?
    Regards,
    Kai

    FileUpload component is not supported in Java Studio Enterprise. The FileUpload is a component that conforms to the spec recognized by Java Studio Creator line of products (which is now Visual Web Pack) and will not work in JSE.
    You can use NetBeans 5.5 and install Visual web pack (for javafaces support), enterprise pack (which provides all capabilities of JSE) and uml on top of it. It would give you a single install with all add-ons.

  • Myfaces's file upload component

    I used the myfaces's file upload component in my web application. But this component needs to set the form's enctype attribute to "multipart/form-data". But after I have set this attribute, my other components in the form seemed doesn't work anymore. Is there any way to solve this problem? Thank you

    Some people seem to be running into this. Doing these steps should fix the problem:
    Right click the component library node "Basic" and choose "Manage Component Libraries". That opens the Component Library Manager window. Verify that the "On Palette" property is checked for "File Upload".
    Hope it helps,
    Lark

  • Implementing File Upload component + Java Mail

    Guys,
    Brief Intro : I have a form with some input fields. Upon submission of the form all the necessary information is submitted ro R/3 system and a mail is send to lets say administrators. I have Java Mail program for sending emails.
    My requirement : I want the users to give the FileUpload option in the form so that they can select the file and that file should be attached to email whcih I am sending upon form submission.
    Questions:
    1) How to check the path of the file where it gets uploaded.
    2) Does it get uploaded on the Server where I deploy my application.
    3) Any Solution/suggestion on how to implement the requirement stated above.
    Regards,
    <b>Chintan Virani.</b>

    Hi Chintan...
    File Uplaod UI Element is just to get the file path of the file from the client or presentation server i.e. our pc. Rest code to store the data is done in action of the upload button (not the browse button). So no file is formed automatically.
    Unless you write the code to read the file from the path selected, you cannot get the data bytes and unless you mention the path no file is made in the server.
    Better would be that you keep a file template in the mimes folder and at runtime you write to this file.
    The path of the file in the mimes folder is
    temp
    webdynpro
    web
    local
    <ProjectName>
    Components
    <Component Package>
    <File Name>
    This file can be attached to your mail as an attachement.
    Further reference...
    Re: how to create a file i mimes/ components folder
    Regards,
    Mahesh K.

  • File upload component problem

    hi,
    When i use fileupload component in my page, Turkish characters is not renderind and i see them as question mark. Changing page encoding is not working and solving my problem, too.
    any suggestion would be appreciated.
    Regards...

    I got exact the same problem, but with Chinese characters display. Does that means we can only use upload with English characters? Any solutions in the future?
    Thanks,

  • How to store and retriew .pdf or .doc using file uploader component

    hi,
    I want to store a .pdf / .doc file in the database and retiew it. I am using
    sun studio enterprise for EJB developing(sun application server as the container) , Oracel as DBMS and sun studio creator for frontend.
    kaushalya

    public String saveButton_action ()
            // TODO: Process the button click action. Return value is a navigation
            // case name where null will return to the same page.
            tagsDataProvider1.cursorLast ();
            //UploadedFile f = fileUpload1.getUploadedFile ();
            if (fileUpload1.getUploadedFile ()!=null)
                tagsDataProvider1.setValue ("attachment",fileUpload1.getUploadedFile().getBytes ());
                tagsDataProvider1.setValue ("attachmentfilename",fileUpload1.getUploadedFile().getOriginalName ());
                tagsDataProvider1.setValue ("attachmentcontenttype",fileUpload1.getUploadedFile().getContentType ());
            tagsDataProvider1.commitChanges ();
            return "home";
        }This servlet returns the data to the user unadulterated:
    * FileView.java
    * Created on October 6, 2005, 4:50 PM
    * To change this template, choose Tools | Options and locate the template under
    * the Source Creation and Management node. Right-click the template and choose
    * Open. You can then make changes to the template in the Source Editor.
    package docman;
    * @author USER
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.Statement;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletOutputStream;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.sql.DataSource;
    public class FileView  extends HttpServlet {
    String ct;
    String type;
        /** Creates a new instance of DisplayPicture */
        public FileView() {
        public void init(ServletConfig config) throws ServletException {
            super.init(config);
        public void destroy() {
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            String id=request.getParameter("id");
            type=request.getParameter("type");
            //String ct=request.getParameter("contenttype");
            //if ((ct==null)||(ct.equals(""))) {
                //ct="image/x-jpeg";
                //ct="image/bmp";
            System.out.println("FileView 1.0");
            System.out.println("requested file with ID: "+id+" content: "+ct+" Doctype:"+type);
            try {
                ServletOutputStream out = response.getOutputStream();
                byte[] f=this.getImage(id);
                response.setContentType(ct);
                out.write(f);
            } catch (Exception e) {
                System.out.println(e.getMessage());
                e.printStackTrace();
        /** Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        /** Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        /** Returns a short description of the servlet.
        public String getServletInfo() {
            return "Displays a picture from the database identified by a parameter IMAGEID";
        private byte[] getImage(String id) throws IOException {
            Statement sta=null;
            Connection con=null;
            ResultSet rs=null;
            byte[] result=null;
            try {
                Context initContext = new InitialContext();
                Context envCtx = (Context) initContext.lookup("java:comp/env");
                DataSource ds = null;
                try{
                     ds = (DataSource)envCtx.lookup("jdbc/xxxxx");
                }catch ( javax.naming.NameNotFoundException ex){
                    log("No context found for jdbc/xxxxx in java:comp/env Attempting to look it up in initial context");
                    ds = (DataSource)initContext.lookup("jdbc/xxxxx");
                Connection conn = ds.getConnection();
                sta = conn.createStatement();
                if(type==null){rs=sta.executeQuery("SELECT * FROM tags where tagid="+id);}
                else if (type.toLowerCase ().equals("tag")){rs=sta.executeQuery("SELECT * FROM tags where tagid="+id);}
                else if (type.toLowerCase ().equals("crewdoc")){rs=sta.executeQuery("SELECT * FROM crewdocumentation where docid="+id);}
                if (rs.next()) {
                    result=rs.getBytes("attachment");
                    ct=rs.getString ("attachmentcontenttype");
                    System.out.println("bytes returned : "+result.length);
                } else {
                    System.out.println("Could find image with the ID specified or there is a problem with the database connection");
                rs.close();
                sta.close();
                conn.close();
            } catch (Exception e) {
                log(e.getMessage());
                e.printStackTrace();
           // ByteArrayOutputStream output = new ByteArrayOutputStream();
            //output.write(result, 78, result.length-78);
            //output.flush();
            //output.close();
            //return output.toByteArray();
            return result;
    }I pinched both from examples i found on this forum using the search facility...
    And this hyperlink retreives the file:
    <ui:hyperlink binding="#{TagView.tagHyperlink}" id="tagHyperlink"
                                        text="#{TagView.tagsDataProvider.value['tags.attachmentfilename']}" url="/servlet/FileView/?id=%23%7BTagView.tagsDataProvider.value%5B'tags.tagid'%5D%7D+"&"+#{TagView.tagsDataProvider.value['tags.attachmentfilename']}"/>

  • Calendar & File Upload Components - Threadinar6

    Hi All,
    This is the sixth in the "Threadinar" series , please see Threadinar5 at
    http://swforum.sun.com/jive/thread.jspa?threadID=99473 for details
    In this Threadinar we will focus on the
    "Calendar" and "File Upload" Components
    Let us begin our discussion with the Calendar Component.
    Calendar Component
    You can drag the Calendar component "calendar component icon" from the Palette's Basic category to a page open in the Visual Designer to create an entry field with an integrated calendar pop-up to help the user pick dates for the field.
    You can also drop the calendar on a container component, like a table cell or group box.
    After dragging the component to the Visual Designer, you can work with the following useful properties of the Calendar Component:-
    General
    * id. Type: String
    The name of the Calendar component in the page bean and the JSP file.
    Appearance
    * columns. Type: int
    The number of character columns used to render the component. The default value is 20.
    * dateFormatPattern. Type: String
    The format of the date to be entered by the user. It is not usually necessary to set this property because a pattern is chosen automatically based on the locale.
    If you prefer to specify a date format, click the ellipsis button (...) to the right of the property and select a predefined date format from the property editor's list. You can also add your own formats. If you add a format, the values you can enter are limited to some combination of yyyy for the year, MM for the month, and dd for the day separated by separator characters. Typical separator characters are / (slash), . (period), and - (dash). For example, the following date formats are acceptable:
    o MM/dd/yyyy
    o yyyy.MM.dd
    o MM-dd-yyyy
    * dateFormatPatternHelp. Type: text
    Text that appears below the date entry field and shows the format pattern that the date entry field accepts. If you have not set the dateFormatPattern property, the help text is chosen automatically for you. If you have set the dateFormatPattern property, you should bind the dateFormatPatternHelp property to a localized string that matches the setting for each locale you want to support.
    * label. Type: String
    A label that appears next to the text entry field, typically describing what the user is supposed to enter.
    o Note: The label property is not as flexible as the Label component. You can use the Label component if you want more control over the label's appearance, such as positioning of the label relative to the component.
    * labelLevel. Type: int
    A number that affects the appearance of the label. 1 (Strong) is larger and bold. 2 (Medium), the default, is smaller and bold. 3 (Weak) is smaller and normal (not bold). This property takes effect only if the label property is set.
    * style. Type: String
    Cascading Style Sheet rules (CSS level 2) to be applied to the component. For example:
    position: absolute; left: 288px; top: 312px
    You can enter values directly or click the ellipsis (...) button to use the Style Editor.
    o Note: This property overrides any settings in the theme or the project CSS file for this component. If a style specified in this property does not appear to take effect, it is because an area of the component is obscured by a child component that has different style settings.
    For a list of CSS2 style attributes, see the web page at
    http://www.w3.org/TR/REC-CSS2/propidx.html
    * styleClass. Type: String
    A space-separated list of CSS2 style classes to be applied when the component is rendered. The style classes must be defined in the project's style sheet or in the theme's CSS file. If you click the ellipsis button (...), you see a list of all styles you can add to this property. For information on adding CSS classes and rules to the project's cascading style sheet, see CSS Editor.
    o Note: See the note above under the style property description for an explanation of why a class added to this property might appear to have no effect on the component.
    o Note: If you add a CSS style class from the current theme to your project CSS file and you redefine the style class, the change affects all components that use this style class. However, you can add your own style classes to the project CSS file that redefine the default style classes, and then when you add them to this property, the changes affect only this instance of this component.
    For the defaulttheme.jar CSS style classes for this component, see Calendar Component CSS Classes.
    Data
    * maxDate. Type: java.util.Date
    The last date that the user can select. The default value is four years from the date set in the minDate property, for a total span of five years.
    * minDate. Type: java.util.Date
    The earliest date that the user can select. The default value is the value of the selectedDate property, which defaults to the current date if that property is not set.
    * required. Type: boolean
    If selected, the user must enter a value for the calendar before the page can be submitted. If you add a Message component to the page and link its for property to this component, an error message will be displayed if the user tries to submit the page without entering a value.
    * selectedDate. Type: Date
    A java.util.Date object representing the calendar date selected by the user. If you right-click the component and choose Bind to Data, you can bind this property to a data provider or object that can process the user entered value on the server.
    When the component displays initially, if this property is not set, its value defaults to the current date. If you provide values for minDate and maxDate, you can also provide a value for this property that initially displays a date in that range.
    * validator. Type: MethodBinding
    Indicates the JavaServer Faces validator that is called when the value is submitted. A validator ensures that the correct value is entered by a user. Choose a validator from the drop-down list. If you choose (null), no validator is called. If you choose a validator, also select the required property to ensure that the validator is used. For descriptions of JavaServer Faces validators, see the list of topics at List of Validators.
    o Note: If you define your own validate method, for example, by right-clicking the component and choosing Edit Event Handler > validate, any value you might have set in this property is overridden.
    File Upload Component
    You can drag the File Upload component "file upload component icon" from the Palette's Basic category to the Visual Designer to create an entry field and a browse button that opens a file chooser dialog on the local system, enabling the user either to select a file or to type a file name into the entry field. When the page is submitted, a copy of the file's contents is sent to the web application.
    The component is similar to an HTML <input type="file"> element.
    * Note: This component is neither supported by nor available in portlet projects due to security reasons.
    * Note: The size of the component in the Visual Designer might not match the size of the component when it is rendered in a web browser, making the component appear to line up correctly in the Visual Designer, but not when the page is rendered in the user's web browser. Also, the rendering of this component can differ depending on the web browser. Be sure to test the component in the web browsers that you expect your users to use. For example, if you add a width setting to the style property that is smaller than the setting in the columns property, Internet Explorer observes only the width setting, while the Mozilla browser ignores it and sets the width according to the number of characters in the columns property.
    The File upload component uses a filter, a com.sun.rave.web.ui.util.UploadFilter object that is configured for you in the web application's deployment descriptor. The UploadFilter uses the Apache commons fileupload package. You might need to change these settings in the following two cases:
    * The server holds the uploaded file in memory unless it exceeds 4096 bytes; otherwise, the server holds the file contents in a temporary file. You can change this threshold by modifying the sizeThreshold parameter for the UploadFilter filter entry in the web application's web.xml file.
    * By default, the File Upload component can handle files up to one megabyte in size. You can change the maximum file size by modifying the maxSize parameter for the UploadFilter filter entry in the application's web.xml file.
    o
    A negative value for the maxSize parameter indicates that there is no file size limit. Setting the parameter to a negative value is not recommended for security reasons. For example, if you allow unlimited file sizes, a malicious user could mount a denial of service attack on your site by using extremely large files
    * To change the settings for the UploadFilter object in the web.xml file:
    1. In the Files window, expand project-name > web > WEB-INF.
    2. Double-click the web.xml node to open the file in the XML editor.
    3. Click the Filters toolbar button.
    4. In the UploadFilter section under Initialization Parameters, you can change the values for the maxSize and sizeThreshold parameters.
    The contents of the uploaded file, together with some information about it, are stored in an instance of com.sun.rave.web.ui.model.UploadedFile. By using this object, you can get the content of the file as a String or write the contents to disk, as well as get properties such as the name and the size of the file. In the interest of conserving memory, the contents and file data are only available during the HTTP request in which the file was uploaded. To access the contents of the uploaded file, bind the uploadedFile property to a bean property of type com.sun.rave.web.ui.model.UploadedFile. Have the setter or an action method process the file.
    The UploadedFile interface has methods for getting the name and size of the file, determining the file's MIME type (such as text/plain or image/jpeg), getting the file's contents as bytes or as a String, and writing the contents to disk. To learn more, in the Java editor, right-click on UploadedFile in a declaration statement and choose Show JavaDoc from the pop-up menu.
    * To set the component's properties, select the component and edit its properties in the File Upload Properties Window.
    * Right-click the component and choose one of the following pop-up menu items:
    o Edit validate Event Handler. Opens the Java Editor with the cursor positioned in the component's validate method so you can insert code to validate the value of the component.
    o Set Initial Focus. Gives this component focus when the user opens the page.
    o Auto-submit on Change. Causes the form to be automatically submitted if the value of the component changes. Sets the component's JavaScript onclick property to common_timeoutSubmitForm(this.form, 'component-id');. At runtime, this code causes the form to be automatically submitted if the user changes the component value. Once the form is submitted, conversion and validation occur on the server and any value change listener methods execute, and then the page is redisplayed.
    A component configured to Auto-submit on Change can use virtual forms to limit the input fields that are processed when the form is submitted. If the auto-submit component is defined to submit a virtual form, only the participants in that virtual form will be processed when the auto-submit occurs.
    o Bind to Data. Bind the component's text property to an object or to a data provider. For more information, see Bind to Data Dialog Box.
    o Property Bindings. Bind any of the component's properties to an object or data provider, such as the uploadedFile property to a bean property of type com.sun.rave.web.ui.model.UploadedFile.
    o Configure Virtual Forms. Enables you to add the component to a virtual form.
    For more details on using the "File Upload Component" Please see this tutorial
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/file_upload.html
    Please share your comments, experiences, additional information, questions, feedback, etc. on these components.
    ------------------------------------------------------------------------------- --------------------

    Of interest relating to file upload component to users : "Saving Uploaded Files Uploaded by the File Upload Component " Check the blog:
    http://blogs.sun.com/roller/page/divas

  • Problem using File upload in portlets

    hello there
    I'm trying to use file upload component in one of my portlets. I searched a lot about a working component to be used in portlets since the standard one that comes with JSC doesn't work in portlets. I managed to get commons file upload and tomahawk to run in my portlet, but when I choose a file and try to get selected file's details it throughs a NullPointerException reporting that the file object is null.
    so please can anyone guide me to a working portlet example, I tried to find one but I couldn't. if that's hard to find, what should I do ?
    thank you in advance

    I added file upload component in JSF from portlets in Sun Java Portal server.
    Take a look...
    portlet.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
    version="1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
    <portlet>
    <description>SFTB Anonymous Mail Portlet</description>
    <portlet-name>SFTBAnonymousMailPortlet</portlet-name>
    <display-name>SFTBAnonymousMailPortlet</display-name>
    <portlet-class>org.apache.portals.bridges.portletfilter.FilterPortlet</portlet-class>
    <init-param>
    <name>portlet-class</name>
    <value>com.sun.faces.portlet.FacesPortlet</value>
    </init-param>
    <!-- Filter for MyFaces Tomahawk extension. -->
    <init-param>
    <name>portlet-filters</name>
    <value>jp.sf.pal.tomahawk.filter.ExtensionsPortletFilter</value>
    </init-param>
    <init-param>
    <description>Portlet init page</description>
    <name>com.sun.faces.portlet.INIT_VIEW</name>
    <value>/jsp/index.jsp</value>
    </init-param>
    <supports>
    <mime-type>text/html</mime-type>
    <portlet-mode>VIEW</portlet-mode>
    <portlet-mode>EDIT</portlet-mode>
    <portlet-mode>HELP</portlet-mode>
    </supports>
    <portlet-info>
    <title>&#1054;&#1090;&#1087;&#1088;&#1072;&#1074;&#1082;&#1072; &#1087;&#1088;&#1077;&#1076;&#1083;&#1086;&#1078;&#1077;&#1085;&#1080;&#1081;</title>
    <short-title>&#1054;&#1090;&#1087;&#1088;&#1072;&#1074;&#1082;&#1072; &#1087;&#1088;&#1077;&#1076;&#1083;&#1086;&#1078;&#1077;&#1085;&#1080;&#1081;</short-title>
    </portlet-info>
    </portlet>
    </portlet-app>
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>SFTBAnonymousMailComment</display-name>
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
    </context-param>
    <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
    <!--
    Extensions filter from Apache MyFaces Tomahawk used for uploads files.
    -->
    <filter>
    <filter-name>ExtensionsFilter</filter-name>
    <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
    <init-param>
    <param-name>uploadMaxFileSize</param-name>
    <param-value>10m</param-value>
    <description>Set the size limit for uploaded files.
    Format: 10 - 10 bytes
    10k - 10 KB
    10m - 10 MB
    1g - 1 GB
    </description>
    </init-param>
    <init-param>
    <param-name>uploadThresholdSize</param-name>
    <param-value>100k</param-value>
    <description>Set the threshold size - files
    below this limit are stored in memory, files above
    this limit are stored on disk.
    Format: 10 - 10 bytes
    10k - 10 KB
    10m - 10 MB
    1g - 1 GB
    </description>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>ExtensionsFilter</filter-name>
    <servlet-name>FacesServlet</servlet-name>
    </filter-mapping>
    <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>FacesServlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    </web-app>
    Files in WEB-INF/lib
    commons-beanutils-1.7.0.jar
    commons-collections-3.2.jar
    commons-digester-1.8.jar
    commons-fileupload-1.2.1.jar
    commons-io-1.2.jar
    commons-logging-1.1.1.jar
    faces-response-filter-0.2.jar
    jsf-api-1.1_02.jar
    jsf-impl-1.1_02.jar
    jsf-portlet-1.1.5.jar
    jstl-1.1.0-D13.jar
    log4j-1.2.9.jar
    portals-bridges-portletfilter-1.0.jar
    standard-1.1.0-D13.jar
    tomahawk-1.1.6.jar
    tomahawk-bridge-0.9.1.jar
    Files tomahawk-bridge-0.9.1.jar, faces-response-filter-0.2.jar may be found there http://sourceforge.jp/projects/pal/
    In JSF beans I'm using org.apache.myfaces.custom.fileupload.UploadedFile
    Hope this helps.
    Bests,
    Alex Magdenko

Maybe you are looking for

  • SSRS Parameter values in Dropdown not Labels?

    I'm fairly new to SSRS and I am trying to set up a report with parameters in VS2010 against SQL Server 2012. I've come across two distinct problems, the first appears to be a bug. When I create a parameter I set the values to the key and the Label to

  • Possible bug in GDM with new user

    Hi, I created a user in the system settings app in gnome and I set the password to be set at first login, but now logging out of the current user and trying to login to the new user without the password on gdm I just get nothing where 'create new UNI

  • Cross-forest access to public folders Exchange 2013-2007

    Dear. We have an Exchange 2007 org in one forest and an Exchange 2013 org in another forest. User accounts remain in the 2007 AD, mailbox moved to Exchange 2013 in the other forest, so a linked mailbox. What do I need to do in the Exchange 2007 publi

  • House bank for respective payment method.

    Hi Gurus, I would like to consider house bank for payment method wise.  Please give proper answer. reg.

  • Java Logigng, Custom FileHandler level problem.

    Dears, I would like to use java builin logigng facility, but the problem is that it is not providing the facility of daily file rolling in FIleHandler as log4J is providing the facility in DailyRollingFileAppender I found the custom File handler form