javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-2941

server confused if there are more than one ajax-enabled inputFiles in a form

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.2.2
    • Component/s: ajax
    • Labels:
      None
    • Environment:

      glassfish 4.0, mojarra 2.2.1

      Description

      If there are more than one inputFile in a form, all of them ajax-enabled, it is always the first one get updated.

      @ViewScoped
      @Named
      public class FileTest implements Serializable
      {
      
      	
      	public Part getFile()
      	{
      		return null;
      	}
      	public void setFile(Part p)
      	{
      		FacesMessage msg=new FacesMessage("file is saved");
      		msg.setSeverity(FacesMessage.SEVERITY_ERROR);
      		FacesContext.getCurrentInstance().addMessage(null, msg);
      		
      	}
      	
      	public Part getFile1()
      	{
      		return null;
      	}
      	public void setFile1(Part p)
      	{
      		FacesMessage msg=new FacesMessage("file is saved");
      		msg.setSeverity(FacesMessage.SEVERITY_ERROR);
      		FacesContext.getCurrentInstance().addMessage(null, msg);
      		
      	}
      }
      
      
      <!DOCTYPE html>
      <html xmlns="http://www.w3.org/1999/xhtml"
      	xmlns:h="http://xmlns.jcp.org/jsf/html"
      	xmlns:f="http://xmlns.jcp.org/jsf/core"
      	xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
      <h:head>
      </h:head>
      <h:body>
      	
      	<h:form id="f" enctype="multipart/form-data">
      		<h:messages id="msgs"></h:messages>
      		<h:inputFile value="#{fileTest.file}" id="file">
      			<f:ajax execute="@this" render="@this msgs"></f:ajax>
      		</h:inputFile>
      		<h:inputFile value="#{fileTest.file1}" id="file1">
      			<f:ajax execute="@this" render="@this msgs"></f:ajax>
      		</h:inputFile>
      	</h:form>
      </h:body>
      </html>
      

      In this example, setFile(instead of setFile1) is always called.

        Activity

        Hide
        jasonzhang2002gmailcom added a comment -

        Could be issue in jsf.js
        When second file is uploaded by ajax, I saw multiple entries for render, execute and event in post data

        Show
        jasonzhang2002gmailcom added a comment - Could be issue in jsf.js When second file is uploaded by ajax, I saw multiple entries for render, execute and event in post data
        Hide
        jid1 added a comment -

        This seems related to THIS BUG. There are some JS issues when processing/submitting the form.

        Show
        jid1 added a comment - This seems related to THIS BUG . There are some JS issues when processing/submitting the form.
        Hide
        rogerk added a comment -

        Changes.

        I believe this issue is fixed with https://java.net/jira/browse/JAVASERVERFACES-2978

        Show
        rogerk added a comment - Changes. I believe this issue is fixed with https://java.net/jira/browse/JAVASERVERFACES-2978
        Hide
        rogerk added a comment -

        Committed to MOJARRA_2_2X_ROLLING:
        Adding test/web-profile/renderKit/basic/src/main/java/com/sun/faces/test/webprofile/renderKit/basic/Issue2941Bean.java
        Adding test/web-profile/renderKit/basic/src/main/webapp/issue2941.xhtml
        Transmitting file data ..
        Committed revision 12344.

        Show
        rogerk added a comment - Committed to MOJARRA_2_2X_ROLLING: Adding test/web-profile/renderKit/basic/src/main/java/com/sun/faces/test/webprofile/renderKit/basic/Issue2941Bean.java Adding test/web-profile/renderKit/basic/src/main/webapp/issue2941.xhtml Transmitting file data .. Committed revision 12344.

          People

          • Assignee:
            rogerk
            Reporter:
            jasonzhang2002gmailcom
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: