Seam from scratch

UI Components for JSF
cartesius28
Posts: 10
Joined: 27 Nov 2009, 00:41

27 Nov 2009, 12:21

Hello,
first, your framework looks absolutely great on your site and we'll probably use it in our next business project. But...
I cannot get it to work. All I do is:
1. Create new Seam Web Project in Eclipse (using wizard)
2. Put primefaces-*.jar to the lib directory in jboss/servers/default/lib
3. I edit the web.xml precisely in the way provided on your site
4. when I put to Firefox: http://localhost:8080/aaa/primefaces_re ... /home.seam

we got no response but doGet method of the servlet is fired (added log output)
Sorry, we probably overlook something basic but what is missing in our setup?
(web.xml follows)

Kind regards,
Jakub

<?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>aaa</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>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/primefaces_resources/*</url-pattern>
</servlet-mapping>


<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>*.seam</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>Seam Resource Servlet</servlet-name>
<servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Seam Resource Servlet</servlet-name>
<url-pattern>/seam/resource/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<security-constraint>
<display-name>Restrict raw XHTML Documents</display-name>
<web-resource-collection>
<web-resource-name>XHTML</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint />
</security-constraint>
</web-app>

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Nov 2009, 13:11

Hi Jakub,

Welcome to the forum :)

Which primefaces version are you using?

Also the servlet config should be(url pattern in singular not plural);

Code: Select all

<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>
Do you get a blank page? Are you sure this is PrimeFaces related or seam configuration related?

cartesius28
Posts: 10
Joined: 27 Nov 2009, 00:41

27 Nov 2009, 13:32

Thank your very much for the absolutely prompt answer. I'll try tu provide more detailed information, so:

1. Once again plain Seam 2.2.0 GA project on JBoss 5.1.0 GA (JSF 1.2 provided by JBoss AS)
2. Primefaces 1.0.0-RC jar put to lib/ on JBoss
3. Added correct primefaces servlet definition to web.xml
4. Firefox: http://localhost:8080/aaa/primefaces_resource/home.seam

Now change:
JBoss tells: 12:31:00,448 SEVERE [ResourceServlet] Resource "/META-INF/resourcese.seam" not found
Firefox: HTTP STATUS 404 (not found)

Sorry for bothering you but what's wrong? :-)

Jakub

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Nov 2009, 13:35

Now I see, well primefaces_resource is for internal use only, you never need to refer it when accessing pages. PrimeFaces just uses it internally to load resources like js, css, images.

So please try accessing your page as;

http://localhost:8080/aaa/home.seam

Assuming the context path your app is aaa.

Also we have a sample app on Seam called PhoneBook;

http://97.107.138.40:8080/prime-phonebo ... anager.jsf

cartesius28
Posts: 10
Joined: 27 Nov 2009, 00:41

27 Nov 2009, 14:34

Thanks again so much!
I copied your PhoneBook web.xml + facelet template as well and remove everything in the body tag.

Then I get a html and tag <p:resources /> remains unprocessed :-(
[url: http://localhost:8080/aaa/home.seam]


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.prime.com.tr/ui">
<head>
<link class="component" href="/aaa/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/basic_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_" rel="stylesheet" type="text/css" /><link class="component" href="/aaa/a4j/s/3_3_1.GAorg/richfaces/renderkit/html/css/extended_classes.xcss/DATB/eAELXT5DOhSIAQ!sA18_" media="rich-extended-skinning" rel="stylesheet" type="text/css" /><script type="text/javascript">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script><script src="/aaa/a4j/g/3_3_1.GAorg/richfaces/renderkit/html/scripts/skinning.js" type="text/javascript"></script><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prime - PhoneBook</title>
<link href="resources/style.css" rel="stylesheet" type="text/css" />
<p:resources></p:resources>
</head>

<body>
<h1>Test</h1>
</body>
</html>

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Nov 2009, 15:29

Can you post home.xhtml please? Seems JSF is not triggered at all.

Can you try;

http://localhost:8080/aaa/home.jsf

cartesius28
Posts: 10
Joined: 27 Nov 2009, 00:41

27 Nov 2009, 16:23

Strange is that a Richfaces' Calendar is rendered properly..... but <p:resources></p:resources> remains...

template.xhtml
-------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.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:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.prime.com.tr/ui">
<f:view contentType="text/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prime - PhoneBook</title>
<link href="resources/style.css" rel="stylesheet" type="text/css" />
<p:resources />
<ui:insert name="head"></ui:insert>
</head>
<body>
<h1>Template</h1>
<ui:insert name="body" />
</body>
</f:view>
</html>

home.xhtml
--------------
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"
xmlns:rich="http://richfaces.org/rich" template="layout/template.xhtml">
<ui:define name="body">
<h1>Welcome to Seam!</h1>
<rich:calendar />
</ui:define>
</ui:composition>

web.xml
-----------
<?xml version="1.0" ?>
<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">
<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>.xhtml</param-value>
</context-param>
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
<filter>
<filter-name>Seam Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<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>
<servlet>
<servlet-name>PrimeFaces Resource Servlet</servlet-name>
<servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>PrimeFaces Resource Servlet</servlet-name>
<url-pattern>/primefaces_resource/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Seam Resource Servlet</servlet-name>
<servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Seam Resource Servlet</servlet-name>
<url-pattern>/seam/resource/*</url-pattern>
</servlet-mapping>
</web-app>

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Nov 2009, 16:46

Everything seems ok, weird can you send me your war?

cagatay at apache dot org

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

27 Nov 2009, 17:05

Thanks for the war, had a quick look, can't see the primefaces-1.0.0.RC.jar anywhere?

cartesius28
Posts: 10
Joined: 27 Nov 2009, 00:41

27 Nov 2009, 17:16

It's in the jboss/server/default/lib directory... correctly loaded.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests