tags:

views:

98

answers:

3

My server is glassfish v3, my browser is firefox 3.6.3 and i am using Netbeans 6.8 My question is why the textfield is not showing up in my browser. I only see the label.

<?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"&gt;
        <html xmlns="http://www.w3.org/1999/xhtml"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:f="http://java.sun.com/jsf/core"&gt;
            <h:head>
                <title>Lookup</title>
            </h:head>
            <h:body>
                <fieldset>
                <legend>Enter Your Customer ID</legend>
                <p>Legal ids are id001, id002, and id003.</p>
                <f:view>
                <h:form>
                    Customer ID:
                    <h:inputText value="#{bankForm.customerId}" />
                    <h:commandButton value="Show Current Balance"
                                     action="#{bankForm.findBalance}" />
                </h:form>
                </f:view>
                </fieldset>
            </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"&gt;
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <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>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>pages/customer-lookup</welcome-file>
    </welcome-file-list>
</web-app>
A: 

could you post the resulting html document?

daniel
this should be a comment
Bozho
The resulting html document looks exactly the same. The site has not compiled or what you should say.
AnAmuser
A: 

Check if you have configured Faces-Servlet on this page

Odelya
Mapping the Faces Servlet is automatically done for you when using a Java EE 6server such as Sun GlassFishTM Enterprise Server v3.
AnAmuser
ok. but what it the post fix of the page? .xhtml? do you URL it as somthing.jsf and set in WEB.xml to map the servlet on *.jsf?
Odelya
It is a xhtml file. and the web.xml file is now in the question
AnAmuser
+1  A: 

You need to make sure that the request URL (as you enter in browser address bar) matches the url-pattern of the FacesServlet. I.e. do not open the page by http://example.com/context/page.xhtml, but open it by http://example.com/context/page.jsf. Otherwise the FacesServlet will not be invoked and your XHTML page with JSF components will not be parsed in any way. You'll only see "plain HTML" tags like <fieldset> and so on in the browser and you will see the JSF source code unchanged in the returned HTML source when you do a View Source in browser.

BalusC
Ok. Now I have changed the welcome file be a jsf file, and it works. As you probably can guess I am a total newbie on this web thing. I am trying to do some tutorials, but it is frustrating when even these easy things won't work:)
AnAmuser
It's a matter of reading the right tutorials the right way. I suggest you to kickoff here: http://www.coreservlets.com/JSF-Tutorial/jsf2/
BalusC
AnAmuser, if you feel this answer is correct, in that it resolved your problem, click the checkbox next to the answer to "accept" it
Brian Leathem