Dear Jakob,
Thanks for your reply !
After investigation, my problematic pages where only pages with an
inputFileUpload components.
For these pages I added an exception for my filter in the web.xml :
<filter>
<filter-name>localLanguageFilter</filter-name>
<init-param>
<param-name>EXCEPTION_URL_0</param-name>
<param-value>/shortcuts/contacts.faces</param-value>
</init-param>
<filter-class>
ec.ep.eo.eoweb.filter.LocalLanguageFilter
</filter-class>
</filter>
And then in my filter I get this exception and user filterChan.doFilter
For all other pages I use request.getRequestDispatcher(uri).forward(request,
response)
I found some interesting help also here :
http://www.developpez.net/forums/d287090/java/developpement-web-java/frameworks/jsf/utiliser-filtre/
Regards,
Marc
>-----Original Message-----
>From: [email protected]
>[mailto:[email protected]] On Behalf Of Jakob Korherr
>Sent: 01 December 2010 17:11
>To: MyFaces Discussion
>Subject: Re: problem with Input text fields and Filter
>
>Hi Marc,
>
>I guess the problem may come from the fact that you're using
>
>request.getRequestDispatcher(uri).forward(request, response);
>
>in the Filter instead of filterChain.doFilter(...);
>
>And this is somehow causing your values not to be submitted
>which means process-validations will fail and thus your action
>method isn't called. However I don't really know why this happens.
>
>Try to download the source of your MyFaces version and debug
>through a whole request. Then you'll see what really happens
>and where the problem is!
>
>Regards,
>Jakob
>
>
>2010/12/1 AMIR-TAHMASSEB Marc Kamran
><[email protected]>
>>
>> Dear all,
>>
>> Since I added a custom filter to deal with the local
>language, I have
>> some problems with some of my forms :-(
>>
>> I user myfaces 1.1.8 + Tomcat 1.1.10 + jsf-faceletes 1.1.14 on a
>> Tomcat 6 server with JDK 1.5 and j2ee-1.4
>>
>> Here is my problem :
>> I have a contact form and when I submit my form the page is
>refreshed but nothing happens and the action is not done.
>> Every thing worked well until I added a new filter
>(LocalLanguageFilter) to deal with the language of navigation.
>> Before my links where like this :
>> http://www.ombudsman.europa.eu/shortcuts/contacts.faces
>> With the filter they will be like this :
>> (http://www.ombudsman.europa.eu/en/shortcuts/contacts.faces)
>> The filter seems to work fine with anything but the Input
>Text fields
>> :-(
>>
>> In my form I have something like that :
>>
>> <h:commandLink id="sendButton" action="#{contactForm.send}"
>> title="#{session.messages.shortcuts_contactform_send}">
>> #{session.messages.shortcuts_contactform_send}
>> </h:commandLink>
>>
>> In my web.xml I have this filter :
>>
>> <filter>
>> <filter-name>localLanguageFilter</filter-name>
>> <filter-class>
>> ec.ep.eo.eoweb.filter.LocalLanguageFilter
>> </filter-class>
>> </filter>
>>
>> <filter-mapping>
>> <filter-name>localLanguageFilter</filter-name>
>> <url-pattern>*.faces</url-pattern>
>> </filter-mapping>
>>
>> In my faces-config :
>>
>> <managed-bean>
>> <managed-bean-name>contactForm</managed-bean-name>
>>
>>
><managed-bean-class>ec.ep.eo.eoweb.presentation.bean.form.ContactForm<
>> /managed-bean-class>
>> <managed-bean-scope>session</managed-bean-scope>
>> <managed-property>
>> <property-name>services</property-name>
>> <value>#{EOWebServicesImpl}</value>
>> </managed-property>
>> </managed-bean>
>>
>> <navigation-rule>
>> <from-view-id>*</from-view-id>
>> <navigation-case>
>> <from-outcome>go_contacts</from-outcome>
>> <to-view-id>/shortcuts/contacts.xhtml</to-view-id>
>> <redirect />
>> </navigation-case>
>> </navigation-rule>
>>
>> In my ContactForm, I have a send() method that is never reched :-( :
>>
>> public
>>
>> synchronized String send() {
>> (some action to send an email....) }
>>
>> And finaly, here is my LocalLanguageFilter :
>>
>> public class LocalLanguageFilter implements Filter {
>>
>> ...
>>
>> public void
>>
>> doFilter(ServletRequest servletRequest, ServletResponse
>> servletResponse, FilterChain filterChain) throws IOException,
>> ServletException {
>>
>> HttpServletRequest request = (HttpServletRequest) servletRequest;
>> HttpServletResponse response = (HttpServletResponse)
>servletResponse;
>> String originalUri = request.getRequestURI().toLowerCase();
>> String uri = originalUri;
>> String contextPath = request.getContextPath().toLowerCase();
>> if (uri.startsWith(contextPath)) {
>> uri = uri.substring(contextPath.length());
>> }
>> String[] parts = uri.split(Constants.PATTERN_SLASH);
>> if (parts.length>0 && parts[1].length()==2) {
>> String languageCode=parts[1];
>> uri = uri.substring(3);
>> ILanguage language =
>> getServices().findLanguageByBusinessKey(languageCode);
>> if (language==null) {
>> language=Constants.ENGLISH;
>> }
>> request.getSession().setAttribute(Constants.SYSTEM_LANGUAGE,
>> language); }
>>
>> request.getRequestDispatcher(uri).forward(request, response);
>>
>> }
>>
>> ...
>>
>> }
>>
>> Thanks in advance for you help
>>
>> Marc
>>
>>
>>
>>
>> Médiateur européen
>>
>> Marc Kamran Amir-Tahmasseb
>>
>> Unité Communication - Développeur web
>>
>> T. +33 (0)3 88 17 44 10
>>
>> [email protected]
>>
>> 1 avenue du Président Robert Schuman
>>
>> CS 30403
>>
>> F - 67001 Strasbourg Cedex
>>
>> T. + 33 (0)3 88 17 23 13
>>
>> F. + 33 (0)3 88 17 90 62
>>
>> www.ombudsman.europa.eu
>>
>>
>>
>>
>>
>>
>
>
>--
>Jakob Korherr
>
>blog: http://www.jakobk.com
>twitter: http://twitter.com/jakobkorherr
>work: http://www.irian.at
>