- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
我有一个处理用户 session 范围数据的 Actor
类
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component(value = "actor")
@Scope(value = "session")
public class Actor{
public Actor() {
System.out.println("Inside void init Actor..........");
System.out.println(JsfUtils.getFacesContext());// This prints Null
}
}
网络.xml
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
</web-app>
applicationContext.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd">
<context:load-time-weaver aspectj-weaving="off" />
<task:scheduler id="taskScheduler"/>
<bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="2" />
<property name="maxPoolSize" value="8" />
<property name="queueCapacity" value="2000" />
</bean>
<task:annotation-driven executor="taskExecutor" scheduler="taskScheduler"/>
<bean class="org.springframework.context.annotation.CommonAnnotationBeanPostProcessor"/>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
<bean id="contextApplicationContextProvider" class="net.main.spring.context.ApplicationContextProvider"></bean>
// <context:component-scan base-package="net.main.x">//</context:component-scan> more goes here
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="Default_Persistence_Unit"/>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
</property>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="MYSQL"/>
<property name="showSql" value="false"/>
</bean>
</property>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>
</property>
</bean>
<bean id="jpaTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<tx:annotation-driven transaction-manager="jpaTransactionManager" proxy-target-class="true"/>
</beans>
在旧项目中运行良好,所以我认为 JSF 的版本是我在 Spring 4.1.4 中使用 2.2.12 版的原因。我尝试降级 JSF 版本或升级 Spring 版本,但没有成功。另一个问题是 Actor
构造函数被多次调用。
那么这里是否有一个隐藏的行为,Spring 应该看到 FacesContext
是真的吗,因为请求是由 JSF servlet 映射的,或者它不能因为 FacesContext
在另一个范围。
我假设 Spring 是在 JSF 之前初始化的,因此它将 FacesContext
视为 null,如果是这样的话,您如何订购初始化容器
提前致谢
将“”转换为“>”的主要目的是避免以下内联脚本: var foo = "alert('bug');"; // the value of foo is generated from server
我有以下想法: 在德语中我们有四个额外的字母(ä、ö、ü、ß),我不知道任何其他语言有这些声音,但我认为有口音的法国人也知道这个问题。我们在 Google Play 商店中有很多适用于城市、公交车站、
#!/bin/bash read nameArg find -name "$nameArg" 使用此代码,当我输入例如 *.txt 时,它将为我提供以 txt 结尾的所有文件,但我只想要名称为 *.t
我在 MySQL 5.7.27 中有一个带有 utf8mb4_unicode_ci 排序规则的用户表。 不幸的是, ı 没有像 i 那样进行线程化,例如,以下查询将找不到 Yılmaz select
我的简单 MySQL 查询: SELECT `word` FROM `nouns` WHERE `word` LIKE 'vandenys' 返回: vandenis 但是“vandenYs
虽然我以前用过这样的代码,而且很明显编译器有足够的信息可以工作,但我真的不明白为什么会这样编译: template auto foo(const T& t, I i) { return st
如何实现一个以 int 开头的函数,并在每次(经历有限数量的可能性)返回 1 的几个(例如,5 个) bool 值之一时从中减去 1。 理想情况下的外观是: function list1 list2
因此,如果我的数据库中有一个包含值的表 1 2 3 4 NULL 我执行了查询 SELECT MAX(col1) FROM 我会得到 4。有什么办法可以改变这个,所以 Null 将被视为最大值而不是
例如:我在数据库中有一条记录:[Example] Attena Illusive - 01 [720p].mkv尝试使用查询进行搜索: SELECT ts_rank_cd(to_tsvector('
我试图创建 2 个简单的盒子,并允许用户从 1 个盒子中选择数据,然后将其复制到第二个盒子。如果第二个框中已经有相同的文本,请在后面附加一些简单的文本。 它基本上在该项目不在第二个框中时起作用。但是,
这个问题已经有答案了: How to read a file from jar in Java? (6 个回答) 已关闭10 年前。 我想从我的 *jar 存档中读取文件。我在互联网上阅读了如何从 z
我在 Javascript 中偶然发现了一个我无法理解的极其奇怪的事件。 这是一个非常简单的 if 语句: let hours = 20; 我在这里设置了一个断点,并在调试器中设置了hours = 0
这两个查询给出了完全相同的结果: select * from topics where name='Harligt'; select * from topics where name='Härligt
我有一个包含数值和 NaN 的表格。求和时,如果所选值包含 NaN,则结果将为 NaN。有没有办法让 postgresql 在求和时将它们视为 0 而不是 NaN?或者我只需要将表中的所有 NaN 转
我有一个正在构建的页面,我希望当我滚动(向上或向下)页面时滚动到下一个 div(每个 div 是窗口高度的 100%)。并在那里“固定”,直到您再次滚动。可以在此处看到我正在努力完成的示例: http
我正在用 Javascript 制作一个小的 HTML 页面。它不需要服务器端,但我需要存储这个人所做的事情,所以我正在使用 localStorage。( list ) 如今,浏览器可以选择不存储 c
这两个查询给了我完全相同的结果: select * from topics where name='Harligt'; select * from topics where name='Härligt
我想向 Lua 公开一些 C++ 类。我可以调用Widget:New()获取带有元表集的返回用户数据到表 WidgetMeta . WidgetMeta包含所有 C++ 函数,它是 __index设置
我正在使用一个大型的旧数据库,现在我尝试使用 hibernate 而不是 SQL 来访问它。更大的问题之一是在外键中无限制地使用“0”和“-1”(意思是“NULL”)。 我生成了很多代码,但我手动添加
我试图将一个数字传递到一个 BYTES 数组中 - 但将该数字视为一个字符数组。这是我的代码: for(int i=1;i<=totalFiles;i++) { BYTE* input = n
我是一名优秀的程序员,十分优秀!