Uploaded image for project: 'MyFaces Tobago'
  1. MyFaces Tobago
  2. TOBAGO-2178

An action is not executed if tc:file is on page (spring-boot)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 5.3.0
    • 5.4.0
    • Core
    • None

    Description

      This issue effects only spring-boot.

      <tc:in label="Name" value="#{helloSpring.name}" required="true">
        <f:facet name="after">
          <tc:button label="Submit" defaultCommand="true" action="#{helloSpring.sayHello}"/>
        </f:facet>
      </tc:in>
      <tc:file/>
      
      public String sayHello() {
        LOG.info("Action was called, name is '{}'", name);
        return "/result.xhtml";
      }
      

      Solution:
      put this code in the Application.java

        @Bean
        public ServletContextInitializer multipartServletContextInitializer(MultipartConfigElement multipartConfigElement) {
          return servletContext -> {
            ServletRegistration servletRegistration = servletContext.getServletRegistration(FACES_SERVLET_NAME);
            if (servletRegistration instanceof ServletRegistration.Dynamic) {
              ((ServletRegistration.Dynamic) servletRegistration).setMultipartConfig(multipartConfigElement);
            }
          };
        }
      

      The FacesServlet needs to support <multipart-config> usually set in the web.xml.

      (its now as example in the sping-boot demo)

      Attachments

        Activity

          People

            lofwyr Udo Schnurpfeil
            hnoeth Henning Nöth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: