javax.faces.FacesException: Error decode resource data while loading JSF page

半城伤御伤魂 提交于 2019-12-04 04:09:31

The issue is now occuring very prominently on all Firefox upgrades>10.0.. There is some change in the Firefox browser script which does not allow the tree to be read properly.

Please add the following in your project to eliminate all Firefox browser related problems:-

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

public class RichFacesFirefox11Filter implements Filter {

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        chain.doFilter(new HttpServletRequestWrapper((HttpServletRequest) request) {
            @Override
            public String getRequestURI() {
                try {
                    return URLDecoder.decode(super.getRequestURI(), "UTF-8");
                } catch (UnsupportedEncodingException e) {

                    throw new IllegalStateException("Cannot decode request URI.", e);
                }
            }
        }, response);
    }

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        // do nothing
    }

    @Override
    public void destroy() {
        // do nothing
    }

}

And please make the entry of this filter in your web.xml file also.

<filter>
    <filter-name>RichFacesFirefox11Filter</filter-name>
    <filter-class>Packagename.RichFacesFirefox11Filter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>RichFacesFirefox11Filter</filter-name>
    <url-pattern>/a4j/*</url-pattern>
  </filter-mapping>

This will surely eliminate all your problems related to Firefox Browsers and RichFaces components.

I have no doubt AnglesAndDemons answer is correct here, but for some reason I could not get it to work. I'm using Richfaces 3.3.3 Final, and what did work, was downloading the patched richfaces-impl.jar from the JIRA issue https://issues.jboss.org/browse/RF-12062

First, the <rich:tabPanel> that wraps every <rich:tab> must be inside a form (check the note in the documentation), so the form inside the tab is not neccesary. Also, if you want to call a server action when you click in some tab, you should check that switchType with server value.

One more thing, maybe your XHTML code inside the <a4j:outputPanel> contains errors, it would be better if you update your post with full or more of that code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!