【发布时间】:2013-04-15 14:00:58
【问题描述】:
myBean 在request 范围内。
<h:form id="indexFormID">
<a4j:outputPanel ajaxRendered="true" layout="block">
<h:inputText id="inputForHD" value="#{myBean.inputParam}"></h:inputText>
<a4j:commandLink value="Submit" action="#{myBean.myMethod}" reRender="renderSuccess" process="indexFormID:inputForHD"></a4j:commandLink>
</a4j:outputPanel>
<h:panelGroup id="renderSuccess">
<h:panelGroup rendered="#{myBean.someBoolean}">
//Some other JSF components go here
</h:panelGroup>
</h:panelGroup>
</h:form>
MyBean类定义:
private String inputParam;
//Getters and setters are there
public String myMethod()
{
log.debug("~ Value of inputParam" +this.getInputParam()); //This is printing null value for inputParam
//when commandLink is clicked
return null;
}
为什么我的inputParam 没有设置输入参数?
【问题讨论】:
-
mymethod 是否被调用?
-
您在 getter/setter 方法中处理什么?
-
@HimanshuBhardwaj
myMethod被调用。这没有问题。在我写的评论中,我在myMethod内得到initParam的null值@ -
@LuiggiMendoza 在 getter/setter 方法中没有进行额外的处理。他们只是 getter 和 setter。
-
问题是你的组件ID是
formID:outputPanelID:inputTextID,而你只是发送formID:inputTextID这是一个不正确的ID。