更新时
我遇到了一些奇怪的异常
java.lang.NullPointerException
com.ocpsoft.pretty.faces.application.PrettyNavigationHandler.processFacesNavigation(PrettyNavigationHandler.java:58)
com.ocpsoft.pretty.faces.application.PrettyNavigationHandler.handleNavigation(PrettyNavigationHandler.java:44)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
javax.faces.component.UICommand.broadcast(UICommand.java:315)
javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
ua.com.winforce.online.site.http.filter.LocaleFilter.doFilter(LocaleFilter.java:65)
在login.jspx页面上提交简单表单后出现
<h:form>
<div class="form-group">
<label for="rLogin"><h:outputText value="#{localeController.locale.registr.email}" escape="false"/></label>
<h:inputText id="rLogin" value="#{playerRegistration.login}" />
</div>
<div class="form-group">
<label for="rPassword"><h:outputText value="#{localeController.locale.registr.password}" escape="false"/></label>
<h:inputSecret value="#{playerRegistration.password}"/>
</div>
<h:commandButton value="#{localeController.locale.mainMsg.registration}" action="#{playerRegistration.doRegistration}" />
LocaleFilter照常工作。
更新后我离开.jspx页面格式。
我认为配置有问题,但找不到原因。
main pom.xml:
<properties>
<targetJdk>1.6</targetJdk>
<spring.version>4.0.5.RELEASE</spring.version>
<spring.security.version>3.2.4.RELEASE</spring.security.version>
<hibernate.version>4.2.16.Final</hibernate.version>
<richfaces.version>4.3.7.Final</richfaces.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Utils -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.7</version>
</dependency>
<!-- Servlets / JSP / JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- RichFaces libraries -->
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${richfaces.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
</dependencies>
的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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"
version="3.0">
<mime-mapping>
<extension>jspx</extension>
<mime-type>application/xml</mime-type>
</mime-mapping>
<context-param>
<param-name>javax.faces.application.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jspx</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_SUFFIX</param-name>
<param-value>.jspx</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.jspx</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext-site-dao.xml
/WEB-INF/applicationContext-site-security.xml
</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.sendPoweredByHeader</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</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>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
faces-config.xml标题:
<faces-config version="2.1" 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-facesconfig_2_1.xsd">
<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
<locale-config>
<default-locale>ru</default-locale>
<supported-locale>ru</supported-locale>
<supported-locale>en</supported-locale>
</locale-config>
以下是项目中使用的库:
我准备添加任何额外信息以找出这种情况的原因。我希望有人可以帮我找到解决这个问题的方法,因为Google并不知道这个问题。任何帮助都会有用。
答案 0 :(得分:0)
将prettyfaces更改为JSF 2兼容版本(例如prettyfaces-jsf2-3.3.3.jar)
prettyfaces-jsf12 ... 适用于JSF 1.2, prettyfaces-jsf2 ... 适用于JSF 2.x(来自OCPSoft doc)
,检查项目中是否正确定义。另外,您可以在 web.xml 中添加以下过滤器:
<filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
答案 1 :(得分:0)
问题出现在以下依赖
中Product.findOne({number: fields.number[0]}, function (err, product) {
product.category = fields.category ? fields.category[0] : product.category;
product.name = fields.name[0];
product.save(function (err) {
if(err) {
console.error('ERROR!');
}
});
});
当我用
替换它时com/ocpsoft/prettyfaces-jsf12/3.3.3/prettyfaces-jsf12-3.3.3.jar
对于JSF的第二个版本,问题已经消失