Meaningless Drivel is fun!*
The moose likes JSF and the fly likes App doesn't work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "App doesn Watch "App doesn New topic
Author

App doesn't work

Sunny Greenhorn
Greenhorn

Joined: Feb 02, 2009
Posts: 6
Not sure why this doesn't work, a basic simple setup thought, trying to have it run on Tomcat6 with JSF 2.0 jars. Any clues please ???

web.xml (under WEB-INF folder)
-------
<?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">
<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>
</web-app>

faces-config.xml (under WEB-INF folder)
-----------------
<?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>
<locale-config>
<default-locale>en</default-locale>
</locale-config>
<resource-bundle>
<base-name>my.messages</base-name>
<var>msgs</var>
</resource-bundle>
</application>
</faces-config>

index.xhtml (under WebContent folder)
------------
<?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>#{msgs.title}</title>
</h:head>
<h:body></h:body>
</html>

messages.properties (under src, my package)
--------------------
title=Hello There!

No deployment errors and no issues with folder structures...
just URL doesn't respond:http://localhost:8080/T2/faces/index.xyz
http://localhost:8080/T2/faces/index.xhtml - gives the XHTML as is dump.

THanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

Welcome to the JavaRanch, Sanath!

There's a "Code" button on the Ranch message editor. You can also use it with XML. It keeps the message formatter from taking liberties with your formatted text.

You need to establish a mapping between "*.xhtml" and JSF in your web.xml file. Something like:


You also probably need to configure Facelets in web.xml as well.

Without that mapping information, the webapp container won't route your URL to the FacesServlet and the FacesServlet won't decode it properly.


Customer surveys are for companies who didn't pay proper attention to begin with.
Sunny Greenhorn
Greenhorn

Joined: Feb 02, 2009
Posts: 6
Thanks, still the same issue, when I run it, I just see #{msgs.title} in the source (as-is xhtml) and empty in browser window.
another issue it seems that if we give same .xhtml extension for URL mapping is eating away stack, not sure how, but I have other app (quiz program demo)
that works fine....so scary ! where am I doing wrong (I hope so :-) )
Sunny Greenhorn
Greenhorn

Joined: Feb 02, 2009
Posts: 6
Directory structure is here



[Thumbnail for DIR_STRU.PNG]

Sunny Greenhorn
Greenhorn

Joined: Feb 02, 2009
Posts: 6
response status is as shown...


[Thumbnail for outputs_scr.PNG]

Sunny Greenhorn
Greenhorn

Joined: Feb 02, 2009
Posts: 6
This is quite similar to the QuizProgram demo that comes with mojarra-2.0.4-FCS, not able to figure out where is the issue.
any thoughts anyone!
Sunny Greenhorn
Greenhorn

Joined: Feb 02, 2009
Posts: 6
Found the thorn atlast ! Issue with faces-config.xml file and the error is in here

where as this is supposed to be


This ofcourse makes huge difference...
if 1.2 is used, resource bundles and beans wont come up and when servlet url mapping and DEFAULT_SUFIX matches, it runs out of stack, like infinite loop.
with 2.0, these are resolved.

Thanks for all, Again, thanks for warm welcome Tim.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: App doesn't work
 
Similar Threads
Error with JBoss and JSF(My Page does not work)
Unable to create managed bean. Hello world app.
No nothing works
Starting a JSF 2.0 project with PrimeFaces 2.2. M1 and Glassfish 3.0
Don't work any jfs scripts