Jsf 在bean中获取HTML输入的内容,而不使用passthrough atts

Jsf 在bean中获取HTML输入的内容,而不使用passthrough atts,jsf,jsf-2.2,Jsf,Jsf 2.2,我正在使用一个javascript来在编辑器中转换文本区域(primefaces编辑器的开销不够大) 所以我有以下代码: <textarea name="editor1" id="editor1" rows="10" cols="80" > </textarea> <script> CKEDITOR.replace( 'editor1'); </script> 但它将是null 编辑: 我的xhtml命名空间: &

我正在使用一个javascript来在编辑器中转换文本区域(primefaces编辑器的开销不够大)

所以我有以下代码:

<textarea name="editor1" id="editor1"  rows="10" cols="80" >
</textarea>  

    <script>
    CKEDITOR.replace( 'editor1');
    </script>
但它将是
null

编辑: 我的xhtml命名空间:

<html xmlns="http://www.w3.org/1999/xhtml" 
xmlns:ui="http://java.sun.com/jsf/facelets" 
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"  
xmlns:p="http://primefaces.org/ui">

那么如何获取文本区的内容呢?

由于id错误,脚本无法工作。我只需要给表单一个id:

<h:form id="form">
    <p:inputTextarea value="#{newThread.title}" cols="98" rows="1">
        <f:passThroughAttribute name="placeholder" value="#{miscellaneous.Title}"/>
    </p:inputTextarea>

    <p:inputTextarea id="sup"></p:inputTextarea>   
        <script>

        CKEDITOR.replace( 'form:sup');
        </script>



    <p:commandButton value="#{miscellaneous.Submit}" action="#{newThread.sendNewThread}">
    </p:commandButton>
</h:form>


由于id错误,脚本无法运行。我只需要给表单一个id:

<h:form id="form">
    <p:inputTextarea value="#{newThread.title}" cols="98" rows="1">
        <f:passThroughAttribute name="placeholder" value="#{miscellaneous.Title}"/>
    </p:inputTextarea>

    <p:inputTextarea id="sup"></p:inputTextarea>   
        <script>

        CKEDITOR.replace( 'form:sup');
        </script>



    <p:commandButton value="#{miscellaneous.Submit}" action="#{newThread.sendNewThread}">
    </p:commandButton>
</h:form>


否。该值为空。Nvm我计算出来了。版本:Luna Service Release 1(4.4.1)。顺便问一下,我的html文件中的名称空间是否正确?根据这一点:新名称空间应以:。至于信息,我让它工作了(见下面的答案),但我不能得到textarea的值。我可能需要制作自己的自定义编辑器。我看看,不。该值为null。Nvm我计算出来了。版本:Luna Service Release 1(4.4.1)。顺便问一下,我的html文件中的名称空间是否正确?根据这一点:新名称空间应以:。至于信息,我让它工作了(见下面的答案),但我不能得到textarea的值。我可能需要制作自己的自定义编辑器。我看看,不。该值为null。Nvm我计算出来了。版本:Luna Service Release 1(4.4.1)。顺便问一下,我的html文件中的名称空间是否正确?根据这一点:新名称空间应以:。至于信息,我让它工作了(见下面的答案),但我不能得到textarea的值。我可能需要制作自己的自定义编辑器。我看看。
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
    version="2.2">

</faces-config>
Initializing Mojarra 2.2.9 (-SNAPSHOT 20141218-0939 https://svn.java.net/svn/mojarra~svn/tags/2.2.9@14083) for context 
<h:form id="form">
    <p:inputTextarea value="#{newThread.title}" cols="98" rows="1">
        <f:passThroughAttribute name="placeholder" value="#{miscellaneous.Title}"/>
    </p:inputTextarea>

    <p:inputTextarea id="sup"></p:inputTextarea>   
        <script>

        CKEDITOR.replace( 'form:sup');
        </script>



    <p:commandButton value="#{miscellaneous.Submit}" action="#{newThread.sendNewThread}">
    </p:commandButton>
</h:form>
<dependency>
    <groupId>org.primefaces.extensions</groupId>
    <artifactId>primefaces-extensions</artifactId>
    <version>3.1.0</version>
</dependency>
<dependency>
    <groupId>org.primefaces.extensions</groupId>
    <artifactId>resources-ckeditor</artifactId>
    <version>3.1.0</version>
</dependency>
xmlns:pe="http://primefaces.org/ui/extensions"