Re: Problem when url is pretty and form enctype is multipart/form-data

Splash Forums PrettyFaces Users Problem when url is pretty and form enctype is multipart/form-data Re: Problem when url is pretty and form enctype is multipart/form-data

#20436

sergiu_oltean
Participant

Hi this is my web.xml file. As you can see I’m using spring security.

<?xml version=”1.0″ encoding=”UTF-8″?>

<web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”

xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”

xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd

id=”springsecurity” version=”2.5″>

<listener>

<listener-class>com.sun.faces.config.ConfigureListener</listener-class>

</listener>

<context-param>

<param-name>javax.faces.STATE_SAVING_METHOD</param-name>

<param-value>server</param-value>

</context-param>

<filter>

<filter-name>Pretty Filter</filter-name>

<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>

</filter>

<filter-mapping>

<filter-name>Pretty Filter</filter-name>

<url-pattern>/*</url-pattern>

<dispatcher>FORWARD</dispatcher>

<dispatcher>REQUEST</dispatcher>

<dispatcher>ERROR</dispatcher>

</filter-mapping>

<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>100m</param-value>

</init-param>

<init-param>

<param-name>uploadThresholdSize</param-name>

<param-value>100k</param-value>

</init-param>

<init-param>

<param-name>uploadRepositoryPath</param-name>

<param-value>/temp</param-value>

</init-param>

</filter>

<filter-mapping>

<filter-name>extensionsFilter</filter-name>

<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>

<dispatcher>FORWARD</dispatcher>

<dispatcher>REQUEST</dispatcher>

<dispatcher>ERROR</dispatcher>

</filter-mapping>

<filter-mapping>

<filter-name>extensionsFilter</filter-name>

<url-pattern>*.jsf</url-pattern>

</filter-mapping>

<context-param>

<param-name>facelets.LIBRARIES</param-name>

<param-value>/WEB-INF/tomahawk.taglib.xml</param-value>

</context-param>

<!– Start the Spring listener that loads the application context when the

Web app starts up. It assumes the context is named WEB-INF/applicationContext.xml

unless you set a context param called contextConfigLocation to override it. –>

<listener>

<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

</listener>

<listener>

<listener-class>

org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>

</listener>

<!– Lets the bean definition file specify scopes of request and session. –>

<listener>

<listener-class>

org.springframework.web.context.request.RequestContextListener</listener-class>

</listener>

<filter>

<filter-name>springSecurityFilterChain</filter-name>

<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>

</filter>

<filter-mapping>

<filter-name>springSecurityFilterChain</filter-name>

<url-pattern>/*</url-pattern>

<dispatcher>FORWARD</dispatcher>

<dispatcher>REQUEST</dispatcher>

</filter-mapping>

<context-param>

<param-name>contextConfigLocation</param-name>

<param-value>

/WEB-INF/applicationContext.xml

/WEB-INF/applicationContext-security.xml

/WEB-INF/database-context.xml

</param-value>

</context-param>

<servlet>

<servlet-name>Faces Servlet</servlet-name>

<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

<url-pattern>*.jsf</url-pattern>

</servlet-mapping>

<context-param>

<param-name>javax.faces.PROJECT_STAGE</param-name>

<param-value>Development</param-value>

</context-param>

<context-param>

<param-name>javax.faces.CONFIG_FILES</param-name>

<param-value>/WEB-INF/navigation.xml</param-value>

</context-param>

<welcome-file-list>

<welcome-file>index.jsp</welcome-file>

<welcome-file>index.html</welcome-file>

</welcome-file-list>

</web-app>

My question is…how it should look the pretty faces.xml? This is my mapping in pretty.xml

<url-mapping id=”update-profile”>

<pattern value=”/update-profile/” />

<view-id>/faces/myFacesExtensionResource/pages/protected/update-profile.jsf</view-id>

</url-mapping>

and this is my xhtml:

<ui:composition xmlns=”http://www.w3.org/1999/xhtml”

xmlns:ui=”http://java.sun.com/jsf/facelets”

xmlns:components=”http://java.sun.com/jsf/composite/components”

xmlns:h=”http://java.sun.com/jsf/html”

xmlns:f=”http://java.sun.com/jsf/core”

xmlns:t=”http://myfaces.apache.org/tomahawk”

template=”/page-templates/main-template.xhtml”>

<ui:define name=”content”>

<h:form enctype=”multipart/form-data”>

<t:inputFileUpload id=”fileupload” value=”#{fileUploadController.myFile}”

size=”20″ />

<h:commandButton value=”Update” action=”#{fileUploadController.upload}” style=”float: left;clear: left;background-color:#93BB3A;margin-left: 43%;margin-top: 2%;”/>

</h:form>

</ui:define>

</ui:composition>

There’s a sysout in upload method from fileUploadController. Nothing in printed in the console. I’m using tomcat 7.

Am I missing something? Is the url mapping incorrect?

Thanks