This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes Query regarding xhtml page run in JSF1.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Query regarding xhtml page run in JSF1.2" Watch "Query regarding xhtml page run in JSF1.2" New topic
Author

Query regarding xhtml page run in JSF1.2

ujwwala tem
Ranch Hand

Joined: Feb 10, 2010
Posts: 83
Hello,

I created a simple jsf application ,I am trying to run .xhtml file without bean,
<code>My xtml file is

<?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 lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
<title>Insert title here</title>
</h:head>
<h:body>
<f:view contentType="text/html">
<hutputText value="Hello World"></hutputText>
</f:view>
</h:body>
</html>

</code>

and I want to know what can be the navigation rule for this for the same page and I am trying to run it but its asking do you want to open or save the file,

Please reply
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951
    
  19

There is no navigation rule for that page because you have no form or associated action that would trigger and direct navigation.

If you get a "open or save file" dialog, it usually means that you didn't set up your WEB-INF/web.xml file to direct JSF requests to the FacesServlet OR that you are requesting the View by its Resource path (xxx.xhtml) when you should be requesting the view by its URL (xxx.jsf)

Your code tags didn't work. We handle them by a non-HTML processor and their delimiters are square bracket characters, not the angle brackets that HTML uses.


Customer surveys are for companies who didn't pay proper attention to begin with.
ujwwala tem
Ranch Hand

Joined: Feb 10, 2010
Posts: 83
Thanks for the reply but still its not working,

When I am doing as http://localhost:8080/jsf2/faces/index.xhtml

Now the error is as:Caused by:
java.lang.NullPointerException - context
java.lang.NullPointerException: context
at javax.faces.component.UIComponentBase.getRenderer(UIComponentBase.java:862)
at javax.faces.component.UIComponentBase.getRendersChildren(UIComponentBase.java:350)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:248)

My Index.xhtml is <code>

<?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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html">

<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>FirstJSF2</title>
</h:head>

<h:body>

<h:form>
<hutputLabel for="input" value="Enter your name: " />
<h:inputText id="input" value="#{helloMessageBean.name}" required="true" />
<br />
<br />
<h:commandButton value="Go" action="#{welcomeBean.sayHello}" />
<h:messages />
</h:form>

</h:body>
</html>

</code>

The project works fine with .jsp but not working with .xhml,

Also I wanted to know basically how to create .xhtml pages in eclipse juno, I copied from google sample page and given .xhtml page but there is not showing properties ctrl_space in tags its saying no default propsal,

Please Reply,

Thanks,
Ujwwala
 
 
subject: Query regarding xhtml page run in JSF1.2
 
Similar Threads
Problem achieving masterpage functionality in JSF
JSF and trying to display a resultset
First Cup: Java EE Tutorial
problem with new user
jsf error display