Hallo.
Ich habe zwei JSPs und möchte über die faces-config und einen Button die Daten der Bean übergeben. Leider komme ich beim Klick auf den Button wieder nur auf die Startseite und http://localhost:8080/jsf//MyJsf.faces wird in der Adressleiste angezeigt.
Gebe ich die zweite Seite manuell Output.jsp im Browser ein, kommt folgender Fehler:
Hier der Code:
Ich hoffe jemand kann mir weiterhelfen? Vielen Dank schonmal...
Ich habe zwei JSPs und möchte über die faces-config und einen Button die Daten der Bean übergeben. Leider komme ich beim Klick auf den Button wieder nur auf die Startseite und http://localhost:8080/jsf//MyJsf.faces wird in der Adressleiste angezeigt.
Gebe ich die zweite Seite manuell Output.jsp im Browser ein, kommt folgender Fehler:
Code:
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: /Output.jsp(32,2) PWC6038: "#{UserDataBackingBean.firstName" contains invalid expression(s): javax.el.ELException: Error Parsing: #{UserDataBackingBean.firstName
note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1_02 logs.
Hier der Code:
Code:
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSF 'MyJsf.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<f:view>
Enter your first name, last name and email.
<h:form>
<h:inputText value="#{ UserDataBackingBean.firstName }"/>
<h:inputText value="#{UserDataBackingBean.lastName}"/>
<h:inputText value="#{UserDataBackingBean.email}"/>
<h:commandButton action="#{UserDataBackingBean.process}" value="send userdata" />
</h:form>
</f:view>
</body>
</html>
Code:
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>UserData Output</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<f:view>
Here is the data from the Form which is stored in the BackingBean:
<h:outputText value="#{UserDataBackingBean.firstName" />
<h:outputText value="#{UserDataBackingBean.lastName" />
<h:outputText value="#{UserDataBackingBean.email" />
</f:view>
</body>
</html>
Code:
package de.jsf.model.backingbeans;
public class UserDataBackingBean {
private String firstName;
private String lastName;
private String email;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String process() {
// use EJBs to do something...
return "success";
}
}
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">
<navigation-rule>
<from-view-id>/MyJsf.jsp</from-view-id>
<navigation-case>
<from-action>#{UserDataBackingBean.process}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/Output.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>UserDataBackingBean</managed-bean-name>
<managed-bean-class>de.jsf.model.backingbeans.UserDataBackingBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
Ich hoffe jemand kann mir weiterhelfen? Vielen Dank schonmal...