In JSP, a reference to a component defined later in the page fails
------------------------------------------------------------------

         Key: MYFACES-120
         URL: http://issues.apache.org/jira/browse/MYFACES-120
     Project: MyFaces
        Type: Bug
    Versions: 1.0.8 beta    
    Reporter: Denis Robert


The following code (based on an example from the book JavaServer Faces in 
action):

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsf/html"; prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core"; prefix="f" %>


<html>
        <head>
                <meta http-equiv="Content-Type" content="text/html; 
charset=UTF-8"/>
                <title></title>
        </head>
        <body>           
                <f:view>
                <p>
                        <h:message id="errors" for="helloInput" 
style="color:red" />
                </p>
                <h:form id="welcomeForm">
                        <h:outputText id="welcomeOutput" value="Welcome to 
JavaServer Faces!"
                                style="font-family: Arial, sans-serif; 
font-size: 24; color: green" />
                        
                        <p>
                                <h:outputLabel for="helloInput">
                                        <h:outputText id="helloInputLabel" 
value="Enter number of controls to display: " />
                                </h:outputLabel>
                                <h:inputText id="helloInput" 
value="#{helloBean.numControls}" required="true">
                                        <f:validateLongRange minimum="1" 
maximum="500" />
                                </h:inputText>
                        </p>
                        <p>
                                <h:panelGrid id="controlPanel" 
binding="#{helloBean.controlPanel}" columns="20" border="1" cellspacing="0" />
                        </p>
                        <h:commandButton id="redisplayCommand" type="submit" 
value="Redisplay" 
                                actionListener="#{helloBean.addControls}" />
                        <h:commandButton id="goodbyeCommand" type="submit" 
value="Goodbye"
                                action="#{helloBean.goodbye}" immediate="true" 
/>
                </h:form>               
                </f:view>
        </body>
</html>


causes an error:

javax.servlet.ServletException: Could not render Message. Unable to find 
component 'helloInput' (calling findComponent on component 'errors')
        javax.faces.webapp.FacesServlet.service(FacesServlet.java:125)

Commenting out the <h:message> tag or moving it after the <h:inputText> which 
defines the helloInput component works, though.

In the RI, the code above works flawlessly.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira

Reply via email to