derdon: [S] ganz einfaches funktionierendes Java(eclipse)/JSP/JSF-Beispi

moin Leute
das [S] steht übrigens für *ich-suche*.

Ich versuche jetzt schon den 3. Tag in folge ein ganz einfaches Hello-world mit der Konfiguration ausm Titel hinzukriegen.

Mit jedem Versuch das zum Laufen zu kriegen, habe ich bisher nur immer wieder einen anderen Fehler erhalten.

hier meine Bean:

package src;  
  
public class SimpleBean {  
  
 String name ="Horst";  
 String age ="3000";  
 public String getName() {  
  return name;  
 }  
 public void setName(String name) {  
  this.name = name;  
 }  
 public String getAge() {  
  return age;  
 }  
 public void setAge(String age) {  
  this.age = age;  
 }  
  
  
}  

hier meine Jsp-File:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"  
 pageEncoding="ISO-8859-1"%>  
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>  
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>  
<%! SimpleBean sb = new SimpleBean(); %>  
  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">  
<%@page import="src.SimpleBean"%>  
<html>  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">  
<title>Insert title here</title>  
</head>  
<body>  
<f:view>  
 <h:dataTable >  
  <h:column>  
   <f:facet name="header">  
    <h:outputText value="#{sb.name}"></h:outputText>  
   </f:facet>  
  </h:column>  
 </h:dataTable>  
</f:view>  
dsfgd  
</body>  
</html>  

hier meine web.xml:

<?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">  
  <display-name>test3</display-name>  
  <welcome-file-list>  
    <welcome-file>index.html</welcome-file>  
    <welcome-file>index.htm</welcome-file>  
    <welcome-file>index.jsp</welcome-file>  
    <welcome-file>default.html</welcome-file>  
    <welcome-file>default.htm</welcome-file>  
    <welcome-file>default.jsp</welcome-file>  
  </welcome-file-list>  
  
<servlet>  
  <servlet-name>SimpleJSF</servlet-name>  
  <jsp-file>/test3/WebContent/simpleJSP.jsp</jsp-file>  
  <load-on-startup>1</load-on-startup>  
</servlet>  
  
  
</web-app>  

************************************************************************
zZ ergibt das Folgendes:
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /simpleJSP.jsp at line 15

12: <title>Insert title here</title>
13: </head>
14: <body>
15: <f:view>
16:  <h:dataTable >
17:   <h:column>
18:    <f:facet name="header">

Stacktrace:
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:417)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find FacesContext
 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
 org.apache.jsp.simpleJSP_jsp._jspService(simpleJSP_jsp.java:95)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

root cause

javax.servlet.jsp.JspException: Cannot find FacesContext
 javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:405)
 com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:105)
 org.apache.jsp.simpleJSP_jsp._jspx_meth_f_005fview_005f0(simpleJSP_jsp.java:110)
 org.apache.jsp.simpleJSP_jsp._jspService(simpleJSP_jsp.java:84)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.

--------------------------------------------------------------------------------

Apache Tomcat/6.0.14

************************************************************************
es gab aber auch schon andere Fehler.
alles Jsp-exceptions und jasper-exceptions
hatte aber keine mitgeschrieben.

[size=20]was mach ich falsch[/size]

  1. hatt sich zum glück erledigt

    Hab nachdem ich hier gefragt habe, nen wirklich gutes Tutorial gefunden.

    Frechheit, dass man immer erst dumme Fragen stellen muss, bevor man Hilfe findet.

    mfg