Hallo,
ich versuche mich gerade in JSF, mehr schlecht als recht. Ich habe jetzt mal dieses Tutorial durchgearbeitet. Nur leider funktioniert die Seite nicht. Ich habe exact die Anweisungen im Tutorial durchgearbeitet.
Im Tomcat ich bekomme folgenden fehler:
login.jsp
web.xml
faces-config.xml
Vielen dank im Voraus
ich versuche mich gerade in JSF, mehr schlecht als recht. Ich habe jetzt mal dieses Tutorial durchgearbeitet. Nur leider funktioniert die Seite nicht. Ich habe exact die Anweisungen im Tutorial durchgearbeitet.
Im Tomcat ich bekomme folgenden fehler:
Code:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: /login.jsp(17,2) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
root cause
javax.faces.FacesException: /login.jsp(17,2) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:340)
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:254)
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
root cause
org.apache.jasper.JasperException: /login.jsp(17,2) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1172)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:819)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2388)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:838)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2388)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:838)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2388)
org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:838)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1507)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2388)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2394)
org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338)
org.apache.jasper.compiler.Validator.validate(Validator.java:1737)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:178)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
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)
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:334)
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:254)
org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
--------------------------------------------------------------------------------
Apache Tomcat/6.0.14
login.jsp
Code:
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:form>
<h:panelGrid border="1" columns="2" >
<h:outputText value="Name"></h:outputText>
<h:inputText value="#{loginBean.name}."></h:inputText>
<h:outputText value="Password"></h:outputText>
<h:inputSecret value="#{loginBean.password}">
<f:validator validatorId="com.tutorial.validatePassword"></f:validator >
</h:inputSecret>
</h:panelGrid>
<h:commandButton value="Login" action="login"></h:commandButton>
</h:form>
</f:view>
</body>
</html>
web.xml
Code:
<?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>JSFTutorial</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>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>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
faces-config.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
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-facesconfig_1_2.xsd"
version="1.2">
<managed-bean>
<managed-bean-name>
loginBean</managed-bean-name>
<managed-bean-class>
com.tutorial.LoginBean</managed-bean-class>
<managed-bean-scope>
session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<display-name>
login</display-name>
<from-view-id>
/login.jsp</from-view-id>
<navigation-case>
<from-outcome>
login</from-outcome>
<to-view-id>
/welcome.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<validator>
<display-name>
Validate Password</display-name>
<validator-id>
com.tutorial.validatePassword</validator-id>
<validator-class>
com.tutorial.validatePassword</validator-class>
</validator>
</faces-config>
Vielen dank im Voraus