小编ad-*_*inf的帖子

重定向和导航/前进之间有什么区别以及何时使用什么?

JSF中的导航有什么区别

FacesContext context = FacesContext.getCurrentInstance();
context.getApplication().getNavigationHandler().handleNavigation(context, null, url);
Run Code Online (Sandbox Code Playgroud)

和重定向

HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.sendRedirect(url);
Run Code Online (Sandbox Code Playgroud)

以及如何决定何时使用什么?

导航问题是页面URL不会更改,除非faces-redirect=true添加到导航URL的查询字符串中.但是,在我的情况下,faces-redirect=true如果我想重定向到像纯HTML页面这样的非JSF页面,则会附加throws错误.

另一种选择是BalusC在JSF 2.0重定向错误中提出的建议

navigation redirect forward jsf-2

32
推荐指数
1
解决办法
6万
查看次数

Play framework - java.lang.RuntimeException:未检测到主类

我是新手玩框架并尝试运行securesocial,如https://github.com/jaliss/securesocial 使用Play 2.3,Scala 2.10.0

.sbt文件配置为

name := "SecureSocial-parent"

version := Common.version

scalaVersion := Common.scalaVersion

lazy val core =  project.in( file("module-code") ).enablePlugins(PlayScala)

lazy val scalaDemo = project.in( file("samples/scala/demo") ).enablePlugins(PlayScala).dependsOn(core)

lazy val javaDemo = project.in( file("samples/java/demo") ).enablePlugins(PlayJava).dependsOn(core)

lazy val root = project.in( file(".") ).aggregate(core, scalaDemo, javaDemo) .settings(
     aggregate in update := false
   )
Run Code Online (Sandbox Code Playgroud)

但低于错误

~\securesocial-master>activator run
[info] Loading project definition from ~\securesocial-master\project
[info] Set current project to SecureSocial-parent (in build file:~/securesocial-master/)
java.lang.RuntimeException: No main class detected.
        at scala.sys.package$.error(package.scala:27)
[trace] Stack trace …
Run Code Online (Sandbox Code Playgroud)

java playframework securesocial

11
推荐指数
2
解决办法
9882
查看次数

如何通过XML配置仅针对特定的URL模式在Spring Security 4中禁用CSRF?

如何通过XML配置仅针对特定的URL模式在Spring Security 4中禁用CSRF?

弹簧security.xml文件

<security:http auto-config="true" use-expressions="true" pattern="/ext/**">
    <csrf disabled="true" />
</security:http>

<security:http auto-config="true" use-expressions="true" authentication-manager-ref="authenticationManager">
    <security:intercept-url pattern="/auth/**" access="hasAnyRole('ROLE_USER')" />
    <security:form-login login-page="/login" authentication-success-handler-ref="loginSuccessHandler" authentication-failure-url="/login" login-processing-url="/j_spring_security_check" />
    <security:logout invalidate-session="true" logout-url="/logout" success-handler-ref="logoutSuccessHandler" />
</security:http>
Run Code Online (Sandbox Code Playgroud)

如果我只使用一个安全性:http块,我的代码工作正常,但在我添加另一个块后,它会抛出错误,如下所示:

错误

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter gov.in.controller.filter.LoginAdtAuthFailHdlr.usernamePasswordAuthenticationFilter; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter] is defined: expected single matching bean but found 2: org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#1
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
    ... 58 more
Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of …
Run Code Online (Sandbox Code Playgroud)

spring-mvc spring-security

5
推荐指数
2
解决办法
2万
查看次数

禁用oam.Flash.RENDERMAP.TOKEN

我正在使用Apache MyFaces 2.0.我注意到oam.Flash.RENDERMAP.TOKEN为每个视图创建了一个cookie ,即使我没有使用Flash范围而且我已经设置了org.apache.myfaces.DISABLE_FLASH_SCOPE=true.

我该如何删除oam.Flash.RENDERMAP.TOKENcookie?这是WebSphere特定的问题

websphere myfaces jsf-2 flash-scope

4
推荐指数
2
解决办法
3628
查看次数

打开Facelets页面时删除会话属性

我将从servlet过滤器返回到Facelets页面的消息.要将消息从servlet过滤器传输到Facelets页面,我使用的是会话变量.显示消息后,我想删除会话变量.如何实现这一目标?还有另一种方法将数据从servlet传递给Facelets吗?

session-variables jsf-2 servlet-filters

2
推荐指数
1
解决办法
2339
查看次数

属性'for'标签错误

我在WebSphere V8.0上使用MyFaces JSF 2.0 - IBM实现.在系统输出消息中,我仅在用户成功登录后才注意到以下错误.

HtmlLabelRend W   Attribute 'for' of label component with id j_id1610532955_33b1d0aa is not defined
Run Code Online (Sandbox Code Playgroud)

我没有任何名为"id"的字段.解决此问题的任何指针都将非常有用

websphere jsf

1
推荐指数
2
解决办法
6537
查看次数