Problem with getting an expression from a web bean
Hi,
Im using JSP磗 in an JBoss environment. After I deployed my work, I tried to see my JSP and then I got this error:
Cannot get value for expression '#{EnvioBean.login}}'
The file faces-config.xml is properly configured in the sense that EnvioBean is declared within that file. 緿o anyone knows what else could be happening?
Thanks
[365 byte] By [
JuPaCoFra] at [2007-11-27 4:27:29]

# 2
faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<application>
<locale-config>
<default-locale>es</default-locale>
<supported-locale>en</supported-locale>
<supported-locale>de</supported-locale>
<supported-locale>fr</supported-locale>
</locale-config>
</application>
<navigation-rule>
<description>Navegaci髇 desde p醙ina de login</description>
<from-view-id>/general/login.jsp</from-view-id>
<navigation-case>
<from-outcome>loginAction</from-outcome>
<to-view-id>/consulta/listardestinos.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<description>Reglas de Navegacion del Men?lt;/description>
<from-view-id>*</from-view-id>
<!-- Incluir aca cada uno de los casos de navegaci髇 del men?-->
<navigation-case>
<from-outcome>listarDestinosAction</from-outcome>
<to-view-id>/consulta/listardestinos.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>agregarPaqueteAction</from-outcome>
<to-view-id>/envio/crearcarga.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>crearPaqueteAction</from-outcome>
<to-view-id>/envio/crearpaquete.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>confirmarDespachoAction</from-outcome>
<to-view-id>/envio/confirmardespachocarga.jsp</to-view-id>
</navigation-case>
</navigation-rule >
<!-- Beans -->
<managed-bean>
<description>Este web bean maneja los envios</description>
<managed-bean-name>EnvioBean</managed-bean-name>
<managed-bean-class>despachador.web.bean.EnvioBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<description>Este web bean maneja las consultas</description>
<managed-bean-name>ConsultaBean</managed-bean-name>
<managed-bean-class>despachador.web.bean.ConsultaBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
login.jsp
<%@ page contentType="text/html;charset=iso-8859-1" language="java"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Aplicación Despachador</title>
<link rel="stylesheet" type="text/css" href="../util/style_1.css">
</head>
<body>
<f:view>
<f:loadBundle basename="idioma.ApplicationResources" var="msg" />
<table width="800" height="336" border="0" align="center"
cellpadding="0" cellspacing="0" bordercolor="#FFFFFF"
bgcolor="#FFFFFF">
<tr>
<td height="200">
<div align="center"><img src="../imagenes/titulo.png"
width="800" height="200" align="top" border="0" /></div>
</td>
</tr>
<tr>
<td height="66"><h:panelGrid columns="1" align="center">
<t:messages showDetail="true" showSummary="false" />
</h:panelGrid></td>
</tr>
<tr>
<td>
<table cellpadding="2">
<h:form id="login">
<h:panelGrid columns="2" align="center" width="100"
styleClass="tabla_final" headerClass="tabla_final th">
<f:facet name="header">
<h:outputText value="#{msg.initApp}" styleClass="Estilo2" />
</f:facet>
<h:outputText value="#{msg.login}" styleClass="Estilo2" />
<h:inputText value="#{EnvioBean.login}" required="true"
maxlength="255" size="20" />
</h:panelGrid>
<h:panelGrid align="center" width="50" columns="1"
styleClass="tabla_final" headerClass="tabla_final th">
<h:commandButton id="submit" value="#{msg.send}"
action="loginAction" />
</h:panelGrid>
</h:form>
</table>
</td>
</tr>
</table>
</f:view>
</body>
</html>
If you need to watch more code in order to help me only ask, thanks a lot!
# 3
Everything seems to be fine in your faces-config.xml and your JSF.
Make sure that in your managed bean class "despachador.web.bean.EnvioBean", there exists a variable "login" with getters and setters getLogin() and setLogin(...).
Also I would suggest a small change in your faces-config.xml file:
<managed-bean>
<description>Este web bean maneja los envios</description>
// If possible, never give the exact class name as your managed-bean-name
//<managed-bean-name>EnvioBean</managed-bean-name>
//Instead use envioBean
<managed-bean-name>envioBean</managed-bean-name>
<managed-bean-class>despachador.web.bean.EnvioBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
//If that change is made, then access the variables in JSF using
"#{envioBean.login}"
SirG