Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: Components/Renderers
    • Labels:
      None
    • Environment:

      glassfish 4.0, Firefox

      Description

      When I select file at browser or not, I always have a part at server side. If no file is selected, the Part.size is zero.

        Issue Links

          Activity

          Hide
          Manfred Riem added a comment -

          Can you please supply an example that reproduces the problem?

          Show
          Manfred Riem added a comment - Can you please supply an example that reproduces the problem?
          Hide
          jasonzhang2002gmailcom added a comment -

          This can be reproduced easily.

          
          @RequestScoped
          @Named
          public class Test
          {
          	Part file;
          	String str;
          	public String getStr()
          	{
          		return str;
          	}
          	public void setStr(String str)
          	{
          		this.str = str;
          	}
          	public Part getFile()
          	{
          		return file;
          	}
          	public void setFile(Part file)
          	{
          		this.file = file;
          	}
          	public String save()
          	{
          		System.out.println("save is called");
          		return null;
          	}
          }
          
          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <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:c="http://xmlns.jcp.org/jsp/jstl/core"
          	xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
          	
          <h:body>
          	<h:messages>
          	</h:messages>
          	<h:form enctype="multipart/form-data">
          		<h:inputFile value="#{test.file}" id="file" required="true"></h:inputFile>
          		<h:inputText value="#{test.str}" id="string" required="true"></h:inputText>
          		<h:commandButton value="submit" action="#{test.save}">
          		</h:commandButton>
          	</h:form>
          </h:body>
          </html>
          
          Show
          jasonzhang2002gmailcom added a comment - This can be reproduced easily. @RequestScoped @Named public class Test { Part file; String str; public String getStr() { return str; } public void setStr( String str) { this .str = str; } public Part getFile() { return file; } public void setFile(Part file) { this .file = file; } public String save() { System .out.println( "save is called" ); return null ; } } <!DOCTYPE html PUBLIC "- //W3C//DTD XHTML 1.0 Transitional//EN" "http: //www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <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:c= "http: //xmlns.jcp.org/jsp/jstl/core" xmlns:ui= "http: //xmlns.jcp.org/jsf/facelets" > <h:body> <h:messages> </h:messages> <h:form enctype= "multipart/form-data" > <h:inputFile value= "#{test.file}" id= "file" required= " true " ></h:inputFile> <h:inputText value= "#{test.str}" id= "string" required= " true " ></h:inputText> <h:commandButton value= "submit" action= "#{test.save}" > </h:commandButton> </h:form> </h:body> </html>
          Hide
          Ed Burns added a comment -

          Manfred and I investigated this and determined that UIInput.isEmpty() doesn't correctly handle this case when there is a Part that is empty.

          UIInput.isEmpty() was added in support of JAVASERVERFACES_SPEC_PUBLIC-426.

          Show
          Ed Burns added a comment - Manfred and I investigated this and determined that UIInput.isEmpty() doesn't correctly handle this case when there is a Part that is empty. UIInput.isEmpty() was added in support of JAVASERVERFACES_SPEC_PUBLIC-426 .
          Hide
          Ed Burns added a comment -

          Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

          Show
          Ed Burns added a comment - Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

            People

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

              Dates

              • Created:
                Updated: