Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 如何在security.xml[spring security]中设置css、primefaces、javascript和jquery模式_Jsf_Jakarta Ee_Spring Security_Primefaces - Fatal编程技术网

Jsf 如何在security.xml[spring security]中设置css、primefaces、javascript和jquery模式

Jsf 如何在security.xml[spring security]中设置css、primefaces、javascript和jquery模式,jsf,jakarta-ee,spring-security,primefaces,Jsf,Jakarta Ee,Spring Security,Primefaces,大家好 在我的jsf页面中,我无法加载任何脚本[javascript、css、jquery和primefaces],我认为我的问题与我设置security.xml的方式有关 我正在使用: primefaces 3.1.1 JSF2.0 spring框架3.0.2 web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javae

大家好
在我的jsf页面中,我无法加载任何脚本[javascript、css、jquery和primefaces],我认为我的问题与我设置security.xml的方式有关

我正在使用:
primefaces 3.1.1
JSF2.0
spring框架3.0.2

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Production</param-value>
</context-param>
<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/app-config.xml</param-value>
</context-param>
<context-param>
    <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
    <param-value>/WEB-INF/springsecurity.taglib.xml</param-value>
</context-param>
<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<servlet>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/app-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
    <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
    <url-pattern>*.htm</url-pattern>
</servlet-mapping>
<welcome-file-list>
    <welcome-file>faces/index.jsp</welcome-file>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

javax.faces.PROJECT_阶段
生产
上下文配置位置
/WEB-INF/app-config.xml
javax.faces.FACELETS\u库
/WEB-INF/springsecurity.taglib.xml
springSecurityFilterChain
org.springframework.web.filter.DelegatingFilterProxy
SpringMVC调度程序Servlet
org.springframework.web.servlet.DispatcherServlet
上下文配置位置
/WEB-INF/app-config.xml
1.
org.springframework.web.context.ContextLoaderListener
Facesservlet
javax.faces.webapp.FacesServlet
1.
springSecurityFilterChain
/*
Facesservlet
*.jsf
SpringMVC调度程序Servlet
*.htm
faces/index.jsp
index.jsp
My security.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<b:beans xmlns="http://www.springframework.org/schema/security"
xmlns:b="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">

<http auto-config="true" use-expressions="true">

    <intercept-url pattern="/assets/previews/**" filters="none"/>
    <intercept-url pattern="/assets/thumbs/**" filters="none"/>
    <intercept-url pattern="/css/**" filters="none" />
    <intercept-url pattern="/design/**" filters="none" />
    <intercept-url pattern="/images/**" filters="none" />
    <intercept-url pattern="/js/**" filters="none" />
    <intercept-url pattern="/pageAllNews/**" filters="none" />
    <intercept-url pattern="/pageLogin/**" filters="none" />
    <intercept-url pattern="/resources/css/**" filters="none" />
    <intercept-url pattern="/resources/skins/**" filters="none" />
    <intercept-url pattern="/templates/**" filters="none" />

    <intercept-url pattern="/userPage/**" filters="none"/>
    <intercept-url pattern="/**" access="hasRole('ROLE_ADMIN')"/>
    <intercept-url pattern="/**" access="hasRole('ROLE_USER')"/>
    <intercept-url pattern="/**" access="hasAnyRole('ROLE_ADMIN','ROLE_USER')"/>

    <form-login login-page="/userPage/home.jsf"/>
    <logout logout-success-url="/userPage/home.jsf"/>
    <remember-me />
</http>

<authentication-manager>
    <authentication-provider>
        <password-encoder hash="md5"/>
        <jdbc-user-service data-source-ref="dataSource" />
    </authentication-provider>
</authentication-manager>

</b:beans>

有人能给我一个关于这个问题的建议吗?
谢谢


agungdmt:D

您需要设置指向静态web资源的
拦截url
标记,以允许匿名用户进行身份验证

<intercept-url pattern="/images/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />

或者通过与web应用程序上下文不同的上下文提供静态web内容,我个人就是这样做的。

可能重复的