如何在JSF中使用Spring

如何在JSF中使用Spring

本文介绍了如何在JSF中使用Spring Security Facelets标记库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我想使用 Spring Security Facelets标记库在我的 JSF 2 页面中保护我的UI组件

i want to use The Spring Security Facelets tag library to secure my UI componentsin my JSF 2 pages

我对spring security 3.0.5版有以下依赖关系:

i have following dependencies for spring security version 3.0.5:

<dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>${spring-security.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${spring-security.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${spring-security.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>${spring-security.version}</version>
        </dependency>

我配置了 applicationSecurity.xml 以进行Spring安全登录,它可以正常工作使用UserDetailsS​​ervice罚款
,并在尝试添加安全定义时:

i configured applicationSecurity.xml to make spring security login, and it works finewith UserDetailsService, and when tried to add the security definition:

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ice="http://www.icesoft.com/icefaces/component"
    xmlns:pretty="http://ocpsoft.com/prettyfaces"
    xmlns:sec="http://www.springframework.org/security/tags">

当运行应用程序时,我收到以下错误:

and when running the application, i got following error:

Warning: This page calls for XML namespace http://www.springframework.org/security/tags declared with prefix sec but no taglibrary exists for that namespace.

参考:

please建议。

推荐答案

您需要首先添加 springsecurity.taglib.xml
as这里提到:

You will need to add springsecurity.taglib.xml firstas mentioned here:

您应该在类路径中使用 org.springframework.faces jar来使用它。

and you should have the org.springframework.faces jar in your classpath in order to use it.

然后使用安全标签,如下所示:

then use the security tags as follows:

<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:sec="http://www.springframework.org/security/tags">

这篇关于如何在JSF中使用Spring Security Facelets标记库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 01:36