Results 1 to 3 of 3
  1. #1
    braindump is offline Member
    Join Date
    Aug 2013
    Posts
    8
    Rep Power
    0

    Default Problem with Webproject

    Hello,

    I used the maven archetype (webapp-javaee7 (codehaus mojo)):
    Problem with Webproject-unbenannt.png
    When go into the browser and use this link: 4) http://localhost:8080/testwebapp/HelloWorld.html everything is fine and looks good
    HelloWorld.html:
    Java Code:
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html">
        <head>
            <title>Start Page</title>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        </head>
        <body>
            <h1>Hello World! Ist das geil</h1>  
            
            <h1>Bean Test</h1>
        	<h:outputText value="HelloBean says: #{helloWorldBean.greeting}" />
        </body>
    </html>
    . Now I want to work with JSF so I created the following files:
    1) xhtml-template: default.xhtml
    2) css-file: default.css
    3) index.xhtml
    ... now I published my Glassfish and open the link http://localhost:8080/testwebapp/index.jsf and get
    Java Code:
    HTTP Status 404 - Not Found
    or when i tried open http://localhost:8080/testwebapp/index.xhtml I get
    Java Code:
    XML-Verarbeitungsfehler: Kein Element gefunden
    Adresse: http://localhost:8080/testwebapp/index.xhtml
    Zeile Nr. 1, Spalte 1:
    index.xhtml:
    Java Code:
    <?xml version="1.0" encoding="UTF-8" ?>
    <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" template="webapp/templates/default.xhtml">
    	<ui:define name="content">
    		<h1>Willkommen auf der Homepage!</h1>
    		
    		<h1>Bean Test</h1>
        	<h:outputText value="HelloBean says: #{helloWorldBean.greeting}" />
    	</ui:define>
    </ui:composition>
    default.xhtml:
    Java Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://java.sun.com/jsf/html" xmlns="http://java.sun.com/jsf/facelets">
    	<h:head>
    		<title>testpage</title>
    		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    		<h:outputStylesheet name="css/default.css" />
    	</h:head>
    	<h:body>
    		<div id="container">
    			<div id="header">
    				<p>
    					Beispielanwendung
    				</p>
    			</div>
    			<div id="content">
    				<ui:insert name="content">
    					<!-- [Template content will be inserted here] -->
    				</ui:insert>
    			</div>
    			<div id="header">
    				<p> (C) 2013 test.de </p>
    			</div>
    		</div>
    	</h:body>
    </html>
    default.css:
    Java Code:
    body {
    	margin: 0;
    	padding: 0; 
    	background-color: #EAECEE;
    	font-family: Verdana, sans-serif;
    	font-size: 0.9em;
    }
    #container {
    	margin: 0 auto;
    	padding: 0 20px 10px 20px;
    	border: 1px solid #666666;
    	width: 865px;
    	padding-top: 10px;
    }
    #header{
    	font-size: 1.3em;
    	border: 1px solid #666666;
    	background: #EAECEE;
    	padding: 0 15px 5px 15px;
    	margin-bottom: 50px;
    }
    #footer{
    	clear: both;
    	text-align: center;
    	color: #666666;
    	font-size: 0.85em;
    	padding: 3em 0 0 0;
    }
    h2 {
    	font-size: 1.2em;
    }
    What ist the problem? Why I get this errors?

    Best regards
    Braindump
    Last edited by braindump; 09-11-2013 at 01:33 PM.

  2. #2
    braindump is offline Member
    Join Date
    Aug 2013
    Posts
    8
    Rep Power
    0

    Default Re: Problem with Webproject

    No ideas? Someone need mor informations?

  3. #3
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,368
    Rep Power
    6

    Default Re: Problem with Webproject

    Probably because the jsf servlet is not mapped to *.jsf but to *.xhtml. That's what I would do at least. The truth is in the web.xml file. And in a decent book on JSF.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Replies: 0
    Last Post: 11-07-2012, 01:44 PM
  2. Small problem with problem with Java, C++ parse program.
    By dragstang86 in forum New To Java
    Replies: 4
    Last Post: 10-30-2011, 04:43 AM
  3. Replies: 9
    Last Post: 09-21-2010, 05:15 PM
  4. MyEclipse can not create webproject
    By Burglar_Cat in forum Eclipse
    Replies: 0
    Last Post: 05-27-2010, 04:27 AM
  5. simple line problem / for loop problem
    By helpisontheway in forum New To Java
    Replies: 1
    Last Post: 11-17-2009, 07:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •