Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 563031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:37:01+00:00 2026-05-13T12:37:01+00:00

OK, so I am trying to set up a simple JSF application. I’m using

  • 0

OK, so I am trying to set up a simple JSF application. I’m using NetBeans 6.8, Glassfishv3 and Maven2. I made a JSP document like so:

<?xml version="1.0" encoding="utf-8"?>
<html xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">
<f:view>
    <head>
        <title><h:outputText value="#{Welcome.title}"/></title>
    </head>
    <body>
        <h:outputText value="Welcome"/>
    </body>
</f:view>
</html>

Problem is, if I navigate to this page (http://myHost/myApp/faces/welcome.jspx), it is returned as an XML document, but with the ${Welcome.title} value populated:

<?xml version="1.0" encoding="UTF-8"?>
<html><head><title>Gymix - Welcome</title></head><body>Welcome</body></html>

In Internet Explorer this looks like I would have opened an XML document. In Google Chrome the title is printed next to the text Welcome and instead of the title the URL to the page is printed on the tab.

If I change the JSP document to a plain JSP page (taglibs instead of xmlns and so on) it works and I get a proper page returned. Any ideas on what’s wrong? Thanks!

Edit: sadly none of the quick fixes fixed this, so I’ll look into this more. BTW, my pom.xml has jsf-api and jsf-impl dependencies with the version for both set to 1.2_14

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:37:01+00:00Added an answer on May 13, 2026 at 12:37 pm

    Aside from the fact that you need to set the proper doctype and content type so that the browser knows what to do with the page, you also should get rid of the old fashioned jspx format and use xhtml format to get the most benefit of Java EE 6-shipped JSF 2.0 and Facelets.

    The given code should be changed to:

    <?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>#{welcome.title}</title>
        </h:head>
        <h:body>
            Welcome
        </h:body>
    </html>
    

    Note that the doctype is included and that JSF 2.0 / Facelets will automatically take care about the right content type with help of the <h:head> component. Also note the absence of the <f:view> tag, this isn’t needed anymore in Facelets.

    You probably also need to reconfigure your webapp to make use of the full powers of JSF 2.0 and Facelets. To learn more about JSF 2.0 and Facelets, I strongly recommend to go through the Java EE 6 tutorial part II chapters 4-9.

    Good luck.

    Update: as per the comment of bobince: I would add an important note; it is true that the XML declaration (the first line) would mess the rendering mode of some webbrowsers (also see the site behind the doctype link here above), but that’s certainly not an issue here. Facelets removes the XML declaration during generating the HTML of the page. The XML declaration is simply there because Facelets needs to parse the page using a XML based tool first. We’re talking about a component based MVC framework and XML based templating technology, not about a plain vanilla HTML page 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to set up a simple transaction for my Linq-to-Sql actions against
My objective here is really simple -- I'm trying to set an NSString to
I am trying to create a rather simple effect on a set of images.
Trying to set up caching on our datasets - we're using clr stored procedures
I am trying set up a simple dropdown list but I dont seem to
I'm trying to set a simple cron script to do some database updating, and
I am having a really odd problem trying to set a simple float value
Im trying to set up a simple rewrite rule but I dont seem to
I'm trying to set up a simple horizontal tab structure for a page I'm
I'm trying to set up a simple script to toggle a link from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.