我有具有類似於下面的代碼的Liferay JSF 2.0的portlet:電話ActionResponse.setRenderParam被忽略/無效
private String userId
private String organization
private String registrationToken
...
public String submitLogin() {
ActionResponse actionResponse = (ActionResponse) PortletUtil.getExternalContext().getResponse();
actionResponse.setRenderParameter("userId", this.userId);
actionResponse.setRenderParameter("org", this.organization);
if (StringUtils.hasText(this.registrationToken))
actionResponse.setRenderParameter("token", this.registrationToken);
...
}
所有私有成員變量被映射到輸入表單字段和具有相應的吸氣劑和制定者。
如果我在Eclipse的調試器中跟蹤這段代碼,並檢查ActionResponse實例的_publicRenderParameters HashMap的內容,我發現userId和org params已經設置好了。在接下來的幾行中,我看到registrationToken具有正確提交的隱藏輸入值,並且正在進行最後的setRenderParameter()調用。
這是Bizarro World部分:在最後一次setRenderParameter()調用之後,ActionResponse中的_publicRenderParameters HashMap絕對沒有更新,並且令牌固執地保持在params中未設置。
我試過多種方式,使其工作,從傳送令牌經過我們用於持有其他PARAMS一個會話範圍豆;稍後在代碼流中調用setRenderParameter()(仍然使用相同的ActionResponse引用);在呼叫中使用不同的密鑰名稱(「registrationToken」),以防萬一「標記」是某種保留名稱或某種內容。沒有任何東西獲得最後一次實際更新地圖的呼叫。
我也用谷歌搜索相關的方面,我能想到的每一個組合,但還沒有找到這樣的具體問題任何事情。
有沒有其他人遇到這個問題?爲什麼ActionResponse的param地圖在前兩次調用中會更新,但不是最後一次調用。
=喬=