views:

51

answers:

2

I am using textarea to capture book description but textarea doesn't have attribute "value", How to pass the value to bean.

But the following mechanism to capture value doesn't seem to work

<textarea cols="80" rows="3" spellcheck="false">#{_book.description}</textarea>
+2  A: 

did you try h:inputTextarea

 <h:inputTextarea value="#{bean.text}" cols="35"/>

link

EDIT:

 <div spellcheck="false">
    <h:inputTextarea value="#{user.test}" cols="80" rows="25"/>
    </div>

This seems to disable spell check for the given text area even though you enable it in firefox . I have tested in firefox only though.

daedlus
yes, I tried with h:inputTextarea its working but it doesn't take the attribute spellcheck="false".
Kalpana
shouldn't you leave spell checking to the browser?
daedlus
A: 

If the h:inputTextArea is really no option for some reason, then just give it a name and grab it as request parameter the usual way as you would do when not using JSF at all.

E.g.

<textarea name="foo">#{bean.foo}</textarea>

with

@ManagedProperty(value="#{param.foo}")
private String foo;

or if you aren't on JSF 2.0 yet:

<managed-property>
     <property-name>foo</property>
     <value>#{param.foo}</value>
</managed-property>

or if you'd like to do it manually:

public Bean() {
    this.foo = FacesContext.getCurrentInstance().getExternalContext()
        .getRequestParameterMap().get("foo");
}
BalusC