Chris Harris created MYFACES-3947:
-------------------------------------

             Summary: Passthrough Element textarea doesn't work
                 Key: MYFACES-3947
                 URL: https://issues.apache.org/jira/browse/MYFACES-3947
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-344
    Affects Versions: 2.2.6
         Environment: TomEE 1.6.0-SNAPSHOT through TomEE 1.7.x using MyFaces 
2.2.x as substitute for Java EE 6 MyFaces versions.  CDI is managing the bean 
lifecycles.
            Reporter: Chris Harris
            Priority: Blocker


<textarea> used as a passthrough element cannot be rendered.

Use the following facelet:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:f="http://xmlns.jcp.org/jsf/core";
      xmlns:h="http://xmlns.jcp.org/jsf/html";
      xmlns:pt="http://xmlns.jcp.org/jsf/passthrough";      
      xmlns:jsf="http://xmlns.jcp.org/jsf";>
    <head jsf:id="head">
        <title>Email Test</title>
    </head>
    <body jsf:id="body">
        <form jsf:id="form">
            <input type="text" jsf:id="name"
                placeholder="Enter name"
                jsf:value="#{contactUs.fromName}"/>
            <br/>
            <br/>
            <input type="text" jsf:id="email-address"
                placeholder="Enter email address"
                jsf:value="#{contactUs.fromEmail}"/>
            <br/>
            <br/>
            <textarea jsf:id="contact-message" 
                      name="comments" 
                      placeholder="I wanna talk about..."
                      jsf:value="#{contactUs.message}"/>
            <br/>
            <br/>
            <button type="submit" jsf:action="#{contactUs.submit}">Send 
Email</button>
        </form>
    </body>
</html>

You'll see an error similar to the following:
/email-test.xhtml at line 25 and column 64 <textarea> Tag Library supports 
namespace: http://xmlns.jcp.org/jsf/html, but no tag was defined for name: 
inputTextArea

viewId=/email-test.xhtml
location=/path/to/file
phaseId=RENDER_RESPONSE(6)

Caused by:
javax.faces.view.facelets.TagException - /email-test.xhtml at line 25 and 
column 64 <textarea> Tag Library supports namespace: 
http://xmlns.jcp.org/jsf/html, but no tag was defined for name: inputTextArea
at 
org.apache.myfaces.view.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:300)


Replace MyFaces with Mojarra 2.2.9+ and the facelet will render.


You may also want to check if the textarea's value will be passed to a backing 
bean.  The message field's value is never set in the backing bean for Mojarra.  
I have to use h:inputTextarea for the backing bean's value for that field to be 
set.


In case you need it for convenience's sake, here's the backing bean:
import java.io.Serializable;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

/**
 *
 * @author Chris Harris
 */
@Named
@RequestScoped
public class ContactUs implements Serializable {
    private static final long serialVersionUID = -1L;
    
    private String fromName, fromEmail, message;
    
    public void setFromName(String fromName) {
        this.fromName = fromName;
    }
    public String getFromName() {
        return this.fromName;
    }
    public void setFromEmail(String fromEmail) {
        this.fromEmail = fromEmail;
    }
    public String getFromEmail() {
        return this.fromEmail;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public String getMessage() {
        return this.message;
    }

    public void submit() {
        System.out.println("Here's the data...");
        System.out.println("fromName: " + fromName);
        System.out.println("fromEmail: " + fromEmail);
        System.out.println("message: " + message);
    }
}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to