Primefaces ライブラリを 3.1.1 から 3.4.1 にアップグレードしましたが、残念ながら、Bean の FacesContext からリクエスト パラメータ マップからパラメータを取得できません。
以下は私のコードスニペットです。
xhtml ファイル:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:form>
<p:remoteCommand name="setData" actionListener="#{serviceClass.setrealData()}"/>
</h:form>
<script>
$(document).ready(function(){
setData({codes:'J203,J200,J212,J211,J210',fields:'SNAME,SPOT,PERC,POINTS'});
});
</script>
</html>
豆:
@ManagedBean
@SessionScoped
public class ServiceClass {
/** Creates a new instance of ServiceClass */
public ServiceClass() {
}
public void setrealData(){
FacesContext fc = FacesContext.getCurrentInstance();
Map map2 = fc.getExternalContext().getRequestParameterMap();
String newCodes = (String) map2.get("codes");
System.out.println("New codes ::"+newCodes);
}
}