Tuesday, 10 September 2013

How to get inputTextArea value into another bean?

How to get inputTextArea value into another bean?

I want to get the value with the getter method, but it doesn't work. I use
SessionScoped into my two managed-beans.
<h:outputLabel for="commentInput" value="Comment:" />
<p:inputTextarea id="commentInput" value="#{dashboardBean.currentComment}"
rows="6" cols="25" label="commentInput" required="true"/>
@ManagedBean
@SessionScoped
public class DashboardBean implements Serializable
{
private String _currentComment = null;
public String getCurrentComment() {
return this._currentComment;
}
public void setCurrentComment(String _currentComment) {
this._currentComment = _currentComment;
}
}
If i call getter in this class, it's works.
But in the other class:
@ManagedBean
@SessionScoped
public class PanelListener extends AjaxBehaviorListenerImpl
{
private DashboardBean _dashDashboardBean = null;
public void editMemo(ActionEvent actionEvent)
{
System.out.println("Statements ==== [ " +
_dashDashboardBean.getCurrentComment() + " ]");
}
}
I have an NullPointerException.

No comments:

Post a Comment