我跑我的JSF从外部应用2 的tomcat 6从日食 和一切工作正常,但当我尝试使用Maven的Tomcat插件
mvn tomcat:run
Run Code Online (Sandbox Code Playgroud)
我在其中一个页面上遇到以下异常:
java.lang.NoSuchMethodError: javax.el.ELResolver.invoke(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;
at com.sun.el.parser.AstValue.getValue(AstValue.java:111)
at com.sun.el.parser.AstValue.getValue(AstValue.java:163)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
at javax.faces.component.UIData.getValue(UIData.java:731)
at javax.faces.component.UIData.getDataModel(UIData.java:1798)
at javax.faces.component.UIData.setRowIndexWithoutRowStatePreserved(UIData.java:484)
at javax.faces.component.UIData.setRowIndex(UIData.java:473)
at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:81)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
at javax.faces.component.UIData.encodeBegin(UIData.java:1118)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1754)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1759)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:401)
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at com.ocpsoft.pretty.faces.application.PrettyViewHandler.renderView(PrettyViewHandler.java:163)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:110)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) …Run Code Online (Sandbox Code Playgroud) 我正在使用PrettyFaces作为url重写库,如下所示:
@URLMappings(mappings = {
@URLMapping(id = "page1", pattern = "/page1", viewId = "/faces/pages/page1.xhtml"),
@URLMapping(id = "page2", pattern = "/page2", viewId = "/faces/pages/page2.xhtml") })
Run Code Online (Sandbox Code Playgroud)
我可以得到viewId如下:
String viewId = facesContext.getViewRoot().getViewId();
Run Code Online (Sandbox Code Playgroud)
这将返回如下内容:/faces/pages/page1.xhtml
我想知道是否有一种直接的方法来获取视图的模式或id以返回类似page1的东西,或者我必须在上面的代码中使用substring来获取viewId?
我定义h:messages组件如下:
<h:messages id="summary" styleClass="summary" globalOnly="true"/>
Run Code Online (Sandbox Code Playgroud)
但是当我用firebug检查元素时,我注意到id被翻译成类似于: j_idt33:summary
这个前缀是什么,为什么会产生?
我从这里安装了m2e 1.0最新版本
http://download.eclipse.org/technology/m2e/releases
我不得不删除eclipse的旧maven集成,以及eclipse WTP的maven集成
安装这个最新版本,并重新启动eclipse后,我发现maven菜单从右键单击项目消失,所以我虽然我需要m2e附加功能,但我找不到兼容版本,请指教.
我正在尝试使用IE条件注释来声明CSS资源:
<h:outputStylesheet name="common.css" library="css" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="#{resource['css:ie.css']}" />
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
但是,这似乎不起作用.我在生成的HTML输出中看到了这个:
<link type="text/css" rel="stylesheet" href="/context/faces/javax.faces.resource/common.css?ln=css" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="/context/faces/javax.faces.resource/ie.css?ln=css"/>
<![endif]-->
Run Code Online (Sandbox Code Playgroud)
没有条件注释,它工作正常.我没有使用context参数javax.faces.FACELETS_SKIP_COMMENTS.这是怎么造成的,我该如何解决?
我@Transactional在我的service类上使用调用DAO方法,我想知道如何在特定服务方法上使用只读.
我是否必须@Transactional使用readonly=true此服务方法定义额外内容,还是有其他方法?
我正在使用Spring 3.0.5.RELEASE 和今天使用maven构建项目时,我在appicationContext.xml文件中遇到以下错误:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element
'context:component-scan'.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:annotation-
config'.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:annotation-
driven'.
Run Code Online (Sandbox Code Playgroud)
我试图打开架构链接:
但我总是得到禁止的页面!
这是我如何配置applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans …Run Code Online (Sandbox Code Playgroud) 我试图在桌面应用程序中使用spring,但我在我的JPanel的动作方法中面临自动装配的问题.
我在我的main方法中加载applicationContext,如下所示:
public static void main(String[] args) {
new ClassPathXmlApplicationContext(
"classpath:/META-INF/spring/applicationContext.xml");
MainFrame frame = new MainFrame();
Signup signup = new Signup();
frame.add(signup);
frame.setResizable(false);
frame.setTitle("Please input your data");
frame.setBounds(100, 100, 450, 180);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
Run Code Online (Sandbox Code Playgroud)
我可以看到它没有任何问题.
我的面板代码:
@Component
public class Signup extends JPanel {
@Autowired
private UserDao userDao;
public Signup() {
JButton btn_submit = new JButton("Submit");
btn_submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
registerUser();
}
});
}
private void registerUser() {
User newUser = new User();
newUser.setName(username);
newUser.setSalary(salary); …Run Code Online (Sandbox Code Playgroud) 当我试图在会话结束后发送ajax请求时,我正在使用sessionManagementFilter将用户重定向到登录页面.升级到spring security 3.1.2.RELEASE后,sessionManagementFilter无效,我得到异常.
这是sessionManagementFilter的配置:
<custom-filter ref="sessionManagementFilter" before="SESSION_MANAGEMENT_FILTER" />
<beans:bean id="sessionManagementFilter" class="org.springframework.security.web.session.SessionManagementFilter">
<beans:constructor-arg name="securityContextRepository" ref="httpSessionSecurityContextRepository" />
<beans:property name="invalidSessionUrl" value="/login" />
<beans:property name="redirectStrategy" ref="jsfRedirectStrategy" />
</beans:bean>
<beans:bean id="jsfRedirectStrategy" class="com.mysecurity.JsfRedirectStrategy"/>
<beans:bean id="httpSessionSecurityContextRepository" class="org.springframework.security.web.context.HttpSessionSecurityContextRepository"/>
Run Code Online (Sandbox Code Playgroud)
我得到以下例外:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#0': Cannot resolve reference to bean 'sessionManagementFilter' while setting constructor …Run Code Online (Sandbox Code Playgroud) 我想覆盖primefaces的默认密码匹配错误消息,所以这就是我做的:
在src/main/resources下:我创建了一个名为messages.properties的属性文件, 并为其添加了以下键/值:
primefaces.password.INVALID_MATCH = Passwords doesn't match
primefaces.password.INVALID_MATCH_detail = Passwords doesn't match
Run Code Online (Sandbox Code Playgroud)
在faces-config中,我添加了以下内容:
<application>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<message-bundle>
resources.messages
</message-bundle>
Run Code Online (Sandbox Code Playgroud)
但它仍然打印默认消息,请指教.