我遇到的问题是没有解析jsf标签,所以我没有在页面中看到richfaces组件。我正在使用richfaces 4,tomcat 7和jsf 2.0
这是我的faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
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_0.xsd"
version="2.0">
</faces-config>
的web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>bisis-please-work</display-name>
<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>*.jsf</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<description>
This parameter tells MyFaces if javascript code should be allowed in
the rendered HTML output.
If javascript is allowed, command_link anchors will have javascript code
that submits the corresponding form.
If javascript is not allowed, the state saving info and nested parameters
will be added as url parameters.
Default is 'true'</description>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>
If true, rendered HTML code will be formatted, so that it is 'human-readable'
i.e. additional line separators and whitespace will be written, that do not
influence the HTML code.
Default is 'true'</description>
<param-name>org.apache.myfaces.PRETTY_HTML</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>
If true, a javascript function will be rendered that is able to restore the
former vertical scroll on every request. Convenient feature if you have pages
with long lists and you do not want the browser page to always jump to the top
if you trigger a link or button action that stays on the same page.
Default is 'false'
</description>
<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
</web-app>
这就是我在启动Tomcat 7时所得到的。
Nov 7, 2011 1:33:45 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Java\jdk1.6.0_25\bin;D:\svn\My\GAE\_sdk_python\;C:\Users\Brankica\Desktop\eclipse;;.
Nov 7, 2011 1:33:46 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:bisis-please-work' did not find a matching property.
Nov 7, 2011 1:33:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Nov 7, 2011 1:33:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Nov 7, 2011 1:33:46 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1896 ms
Nov 7, 2011 1:33:46 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 7, 2011 1:33:46 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.22
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsf/core is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsf/html is already defined
Nov 7, 2011 1:33:58 AM org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "org.apache.myfaces.webapp.StartupServletContextListener" is already configured for this context. The duplicate definition has been ignored.
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS' found, using default value true
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_VIEWSTATE_ID' found, using default value true
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.STRICT_XHTML_LINKS' found, using default value true
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.RENDER_FORM_SUBMIT_SCRIPT_INLINE' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getLongInitParameter
INFO: No context init parameter 'org.apache.myfaces.CONFIG_REFRESH_PERIOD' found, using default value 2
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.VIEWSTATE_JAVASCRIPT' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getStringInitParameter
INFO: No context init parameter 'org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS' found, using default value auto
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.VALIDATE_XML' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG' found, using default value true
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig getBooleanInitParameter
INFO: No context init parameter 'org.apache.myfaces.DEBUG_PHASE_LISTENER' found, using default value false
Nov 7, 2011 1:33:58 AM org.apache.myfaces.shared.config.MyfacesConfig createAndInitializeMyFacesConfig
INFO: Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.
Nov 7, 2011 1:33:58 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getStandardFacesConfig
INFO: Reading standard config META-INF/standard-faces-config.xml
Nov 7, 2011 1:33:58 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getWebAppFacesConfig
INFO: Reading config /WEB-INF/faces-config.xml
Nov 7, 2011 1:33:58 AM org.apache.myfaces.config.annotation.DefaultAnnotationProvider webClasses
WARNING: AnnotationConfigurator does not found classes for annotations in /WEB-INF/classes/ . This could happen because maven jetty plugin is used (goal jetty:run). Try configure org.apache.myfaces.annotation.SCAN_PACKAGES init parameter or use jetty:run-exploded instead.
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getClassloaderFacesConfig
INFO: Reading config : jar:file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/richfaces-components-ui-4.0.0.Final.jar!/META-INF/faces-config.xml
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getClassloaderFacesConfig
INFO: Reading config : jar:file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/richfaces-core-impl-4.0.0.Final.jar!/META-INF/faces-config.xml
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-api' was found in version '2.1.3' from path 'file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/myfaces-api-2.1.3.jar'
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-bundle' was found in version '2.1.3' from path 'file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/myfaces-bundle-2.1.3.jar'
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.LogMetaInfUtils logArtifact
INFO: Artifact 'myfaces-impl' was found in version '2.1.3' from path 'file:/D:/informaticki%20projekat/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/bisis-please-work/WEB-INF/lib/myfaces-impl-2.1.3.jar'
Nov 7, 2011 1:34:00 AM org.apache.myfaces.util.ExternalSpecifications isBeanValidationAvailable
INFO: MyFaces Bean Validation support disabled
Nov 7, 2011 1:34:00 AM org.apache.myfaces.application.ApplicationImpl getProjectStage
INFO: Couldn't discover the current project stage, using Production
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.FacesConfigurator handleSerialFactory
INFO: Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
Nov 7, 2011 1:34:00 AM org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory getLifecycleProvider
INFO: Using LifecycleProvider org.apache.myfaces.config.annotation.Tomcat7AnnotationLifecycleProvider
Nov 7, 2011 1:34:01 AM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
INFO: ServletContext 'D:\informaticki projekat\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\bisis-please-work\' initialized.
Nov 7, 2011 1:34:01 AM org.richfaces.javascript.ClientServiceConfigParser parse
WARNING: Found JavaScript function definition for class org.hibernate.validator.constraints.NotEmpty, but that class is not presented
Nov 7, 2011 1:34:01 AM org.richfaces.cache.CacheManager getCacheFactory
INFO: Selected fallback cache factory
Nov 7, 2011 1:34:01 AM org.richfaces.cache.lru.LRUMapCacheFactory createCache
INFO: Creating LRUMap cache instance using parameters: {org.apache.myfaces.DETECT_JAVASCRIPT=false, org.apache.myfaces.PRETTY_HTML=true, org.apache.myfaces.AUTO_SCROLL=true, org.apache.myfaces.ALLOW_JAVASCRIPT=true, javax.servlet.jsp.jstl.fmt.localizationContext=resources.application, javax.faces.STATE_SAVING_METHOD=client}
Nov 7, 2011 1:34:01 AM org.richfaces.cache.lru.LRUMapCacheFactory createCache
INFO: Creating LRUMap cache instance of 512 items capacity
Nov 7, 2011 1:34:01 AM org.richfaces.application.InitializationListener onStart
INFO: RichFaces Core Implementation by JBoss, a division of Red Hat, Inc., version v.4.0.0.Final SVN r.22269
Nov 7, 2011 1:34:01 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 7, 2011 1:34:02 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Nov 7, 2011 1:34:02 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 15218 ms
我用于测试的示例(我从浏览器获得的源代码是相同的):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:rich="http://richfaces.org/rich">
<f:view contentType="text/html">
<h:head>
<title>Calendar</title>
</h:head>
<h:body>
<rich:calendar datePattern="dd/MM/yyyy hh:mm:ss" />
</h:body>
如果有人有任何建议,请写信..提前致谢
答案 0 :(得分:3)
我从浏览器获得的源代码是相同的
换句话说,FacesServlet
未被调用,因此无法完成其工作。这只能表示请求网址与FacesServlet
中定义的web.xml
的网址格式不匹配。也许您按http://localhost:8080/bisis-please-work/somepage.xhtml打开了该页面,而不是http://localhost:8080/bisis-please-work/somepage.jsf,而<url-pattern>*.jsf</url-pattern>
与web.xml
中的*.jsf
相匹配。
或者,您也可以将*.xhtml
替换为FacesServlet
,这样您就不需要再使用URL,也无需担心客户端能够看到原始JSF源代码。唯一的缺点是,如果不调用.html
,您将无法提供“普通的”XHTML文件,但这无关紧要,无论如何,这些文件应该具有{{1}}扩展名。
答案 1 :(得分:0)
我有同样的问题,但有不同的根本原因。对我来说,richfaces组件,特别是rich:tabPanel,没有渲染,因为页面中有简单的html标签。
<head>...</head>
而不是
<h:head>...</h:head>
导致rich:tabPanel根本不显示。
使用普通的html body标签导致标签呈现,但不可点击。