http 404 error report tomcat eclipse - eclipse

I'm really new to web app and this is my first time using tomcat. I keep getting this message when try to run index.jsp.
I'm using eclipse indigo, with tomcat 6.0 (Tomcat v6.0 Server at localhost already started and synchronized). I've already copied ROOT folder to wtpwebapp, checked <Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" /> in server.xml file, but nothing seems work.
Here's the server configuration:
I just started index.jsp with this:
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
Hello World!
</body>
</html>
and this is my 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_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>ChatBot</display-name>
<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>
</web-app>
I wonder what's wrong...Thanks in advance.

First of all i want to know which frame work r u using. If u r working on struts 2 just try replacing ur code in web.xml with this code...
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd">
<display-name>Struts2</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

The following worked for me: Try dragging index.jsp to the WebContent directory. Then, right click index.jsp and click "Run on server".

Related

ICEfaces : No Factories configured for this Application exception

I am trying to run a simple 'Hello World' application using JSF1.2 and ICEfaces 1.8.
I have downloaded all the jars using ICEFaces plugin for Galileo, MyFaces library:
backport-util-concurrent.jar
commons-beanutils-1.7.0.jar
commons-codec-1.3.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
commons-discovery-0.4.jar
commons-fileupload.jar
commons-logging-1.1.1.jar
FastInfoset.jar
icefaces.jar
icefaces-comps.jar
jstl.jar
jxl.jar
krysalis-jCharts-1.0.0-alpha-1.jar
myfaces-api-1.2.9.jar
myfaces-impl-1.2.9.jar
standard.jar
ui.jar
Added them to the lib folder, and build path.
My web.xml file:
<?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_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>HelloWorld(ICE)</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jspx</param-value>
</context-param>
<context-param>
<description>To allow multiple windows for a single application.</description>
<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>Turn on/off application-wide synchronous or asynchronous updates.</description>
<param-name>com.icesoft.faces.synchronousUpdate</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>Google Maps API key is required if gMap component is used. Sign up for an API key from http://code.google.com/apis/maps/signup.html</description>
<param-name>com.icesoft.faces.gmapKey</param-name>
<param-value>ABQIAAAADlu0ZiSTam64EKaCQr9eTRTOTuQNzJNXRlYRLknj4cQ89tFfpxTEqxQnVWL4k55OPICgF5_SOZE06A</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.uploadDirectory</param-name>
<param-value>upload</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.uploadMaxFileSize</param-name>
<param-value>4048576</param-value>
</context-param>
<servlet>
<servlet-name>Persistent Faces Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.iface</url-pattern>
<url-pattern>*.jspx</url-pattern>
<url-pattern>*.jsf</url-pattern>
<url-pattern>/xmlhttp/*</url-pattern>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Blocking Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/block/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>uploadServlet</servlet-name>
<servlet-class>com.icesoft.faces.component.inputfile.FileUploadServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>uploadServlet</servlet-name>
<url-pattern>/uploadHtml</url-pattern>
</servlet-mapping>
<listener>
<listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class>
</listener>
</web-app>
My faces-config.xml file:
<?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_1_2.xsd" version="1.2">
<application>
<view-handler>com.icesoft.faces.facelets.D2DFaceletViewHandler</view-handler>
</application>
</faces-config>
index.jsp:
<%# page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
<%# taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%# taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<jsp:forward page="ICEfacesPage.iface" />
</body>
</html>
ICEfacesPage.jspx:
<?xml version="1.0" encoding="utf-8" ?>
<jsp:root version="1.2" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ice="http://www.icesoft.com/icefaces/component">
<jsp:directive.page contentType="text/html;charset=utf-8" />
<f:view>
<ice:outputDeclaration doctypeRoot="HTML" doctypePublic="-//W3C//DTD HTML 4.01 Transitional//EN" doctypeSystem="http://www.w3.org/TR/html4/loose.dtd" />
<html>
<head>
<title>ICEfaces, Ajax for Java EE</title>
<link rel="stylesheet" type="text/css" href="./xmlhttp/css/rime/rime.css" />
</head>
<body>
<ice:outputText value="Welcome to ICEfaces." />
<ice:form>
<ice:panelGroup draggable="true" style="width:200px;border:1px solidblack;">
<ice:outputText value="Hello World!" />
</ice:panelGroup>
</ice:form>
</body>
</html>
</f:view>
</jsp:root>
Exception:
Servlet.service() for servlet Persistent Faces Servlet threw exception java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all
configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions! If you did that and find nothing, the mistake might
be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml. A typical config looks like this;
<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:106) at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.
<clinit>(ReceiveSendUpdates.java:38) at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.
<init>(MainSessionBoundServlet.java:136) at com.icesoft.faces.webapp.http.servlet.MainServlet$3.newServer(MainServlet.java:87) at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.checkSession(SessionDispatcher.java:86) at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:45)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23) at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:131) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
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 org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:709)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:680) at org.apache.jsp.index_jsp._jspService(index_jsp.java:64) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source)
I don't understand why the faces-initialization is not working. Please help me figure out how to fix the issue.
Thanks a lot for your time.
Figured out the problem.
I just had to add the following mapping to web.xml
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
Source:
https://books.google.co.in/books?id=2rX6SMAIr-QC&pg=PT78&dq=No+Factories+configured+for+this+Application.&hl=en&sa=X&ei=Io_8VMvVM4arOq2WgdAK&ved=0CB0Q6AEwAA#v=onepage&q&f=false

tomcat homepage is opening but 404 on any project that i have made (in eclipse helios)

I have started a project in JSP, I am using eclipse Helios 3.6 and tomcat 6.0 integration with it, the problem is that , when i start the tomcat server from eclipse , it starts normally (Means the hompage is displaying on "localhost:8085"), but when i make a "new dynamic web project" (even very simple project that just display index.html in "web-content" folder) I got a 404 not found error. The directory structure is as follows
I am accessing the project through "localhost:8085/testing", but it shows 404 error like this........
My code for web.xml is also ver simple :-
<?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_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>testing</display-name>
<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>
</web-app>
Include following lines before <display-name> tag in "web.xml" file, then it'll may help you...
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

Error in my First JSF Program with Tomcat and Eclipse

Im a Totally new in Java and JSF. I'm using eclipse Indigo and Tomcat 6.0.3 and JSF 2.0. Iam using the Maven and deploying the wars to server.
I configured the server in the Eclipse and i normally get the apache page in Localhost:8080.
But When i try to access my page like localhost:8080/ContactFormJSF/, I get the Message as
HTTP Status 404 - /ContactFormJSF/
type Status report
message /ContactFormJSF/
description The requested resource (/ContactFormJSF/) is not avilable.
This is code like, what there in Adduser.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!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:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>JSF 2.0 Hello World</title>
</h:head>
<h:body>
<h3>JSF 2.0 Hello World Example - hello.xhtml</h3>
</h:body>
</html>
I Have even configured the "servlet-mapping","welcome-file-list" in the Web.xml
My web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee">
<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>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>AddUser.xhtml</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<session-config>
<session-timeout>15</session-timeout>
</session-config>
</web-app>
Check the following Conditions
Check the required jars inserted under WEB-INF/lib directory(Strongly recommended)
Check the servlet has been mapped in Web.xml
Check your invoking correct URL pattern in browser

Spring MVC + JSF: Form URLs wrong

I try to use Spring MVC with JSF. But I use JSF just as presentation layer. Its not a problem to display a JSF view for my #Controller... but if I use a h:form, the renderer uses a wrong URL (without my dispatcher).
This is the correct URL to get the view (method=GET):
http://localhost:8080/AppName/dispatcher/testController/create
The JSF views form gets rendered with this URL:
http://localhost:8080/AppName/WEB-INF/jsf/testController/create
The correct URL for the form would be (method=POST):
http://localhost:8080/AppName/dispatcher/testController/create
My Controller:
#Controller
#RequestMapping(value = "/testController")
public final class TestController
{
[...]
#RequestMapping(value = "/create", method = RequestMethod.GET)
public void getCreateNew(final Model model)
{
[...]
}
#RequestMapping(value = "/create", method = RequestMethod.POST)
public void postCreateNew(final Model model)
{
[...]
}
}
My View:
<?xml version='1.0' encoding='UTF-8' ?>
<!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:l="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
<h:head>
<title>Create new</title>
</h:head>
<h:body>
<h:messages errorClass="error"/>
<f:view>
<h:form>
<h:panelGrid columns="2" columnClasses="label, value" styleClass="grid">
<h:outputText value="${name}" />
<p:inputText label="Test: ${name}" required="true">
<f:validateLength minimum="3" />
</p:inputText>
</h:panelGrid>
<p:commandButton type="submit" value="${labelSubmit}" action="spring:#testController.doneCreateNew" />
</h:form>
</f:view>
</h:body>
</html>
The web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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">
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.request.RequestContextListener
</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<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>dispatcher</servlet-name>
<url-pattern>/dispatcher/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
</web-app>
The faces-config.xml:
<?xml version='1.0' encoding='UTF-8'?>
<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>
</application>
</faces-config>
The dispatcher-servlet.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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsf/" p:suffix=".jsf" />
</beans>
And the 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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<mvc:annotation-driven />
<context:annotation-config/>
<context:component-scan base-package="com.sommer_engineering"/>
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/>
</beans>
Anybody knows why this does not work? I would be happy for any idea...
see edit below
I'll leave my answer here since I had to work through this same issue myself. Integrating a rewrite rule through a simple pretty-config worked for me.
Add the dependencies for PrettyFaces
(note: If you're not familiar with PrettyFaces, then it's probably not what you think it is)
Add the rewrite rule
if your servlet mapping for the dispatcher looks like:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/dispatcher/*</url-pattern>
</servlet-mapping>
and your view resolver has properties like this:
p:prefix="/WEB-INF/jsf/" p:suffix=".jsf"
then your pretty-config.xml should be something like:
<pretty-config xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">
<url-mapping id="pretty_spring_urls">
<pattern value="/dispatcher/WEB-INF/jsf/{spring}.jsf" />
<view-id value="/dispatcher/{spring}" />
</url-mapping>
</pretty-config>
edit:
Prettyfaces, however, has only worked for me on an embedded glassfish server. Urlrewrite has worked for me on glassfish, tomcat 7 and jboss.
You could try this to imply it to dispatcher-servlet.xml
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="" p:suffix=".jsf" />

Simple primefaces application not working

I am trying to build simple JSF application using primefaces but somehow primefaces components are not getting rendered properly. I dont understand what is going wrong.
I am trying to display following Facelet file :
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:head>
<link type="text/css"
rel="stylesheet"
href="/Themes/primefaces-dot-luv/theme.css" />
</h:head>
<h:body>
<p:spinner value="100" style="height: 10px" />
<br/>
<p:button value="Navigate"></p:button>
</h:body>
</html>
I am using eclipse to run the app on tomcat server. When I run the application and view the page source in browser(firefox) I get following source :
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.prime.com.tr/ui">
<head>
<link type="text/css" rel="stylesheet" href="Themes/primefaces-dot-luv/theme.css" />
</head>
<body>
<p:spinner value="100" style="height: 10px"></p:spinner>
<br />
<p:button value="Navigate"></p:button>
</body>
</html>
I think PrimeFaces components are not getting rendered properly. Other JSF tags like <h:head> and <h:body> are converted correctly to <head> and <body> elements respectively. Only tags starting with <p:> are not converted.
Following is my project structure :
My web.xml looks like this:
<?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_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>HelloJSF</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<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>/faces/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>none</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>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
</web-app>
I am using eclipse , tomcat server. JSF 2 and primefaces 3 library.
Hi, After some close inspection of entire project I found out that
primefaces jar dowlonaded from site did not had any classes. Jar
itself was corrupt. I downloaded same jar thrice then also jar was
getting corrupt. So I downloaded zip file containing source and
binaries and my application started working.
Try changing your web.xml servlet mapping:
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
The way to tell if the Facelets Servlet is processing your xhtml is to look at what the browser receives. If it looks like your xhtml file then you have something mis-configured.
Your need change
xmlns:p="http://primefaces.prime.com.tr/ui"
to
xmlns:p="http://primefaces.org/ui"
You should change your namespace into xmlns:p="http://primefaces.org/ui"
and implement button like this way
<p:commandButton value="Home" process="#this" action="actionMethod()" immediate="true" rendered="true or renderingMethod()" />