如何通过操作传递参数以在过滤器中访问

时间:2019-05-27 20:51:50

标签: java jsf-1.2

我需要通过操作传递参数,以便可以在过滤器中访问

我在 f:param f:attribute 上没有获得成功。

一些示例代码:

XHTML

<h:commandLink action="#{myBean.downloadFile}">
   <f:param value="#{myBean.fileID}" name="fileID" />
   <f:param value="#{true}" name="test" />
</h:commandLink>

过滤器

public class MyFilter implements Filter {

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

        HttpServletRequest req = (HttpServletRequest) request;

    if (req.getParameter("test") != null) { // it's always null
        //do something
    }

        chain.doFilter(request, response);

    }

}

参数和属性没有“测试”参数...我该如何解决?

0 个答案:

没有答案