Visit http://www.mscindiauserconference.com/index.html
Early bird registration has closed. If you still have not registered, hurry up!!!
Visit http://www.mscindiauserconference.com/index.html
Early bird registration has closed. If you still have not registered, hurry up!!!
<rich:dropdownmenu binding="#{bean.menuComponent}" value="File">
private HtmlDropDownMenu menuComponent;
public HtmlDropDownMenu getMenuComponent() {
FacesContext ctx = FacesContext.getCurrentInstance();
Application app = ctx.getApplication();
if(null == menuComponent)
menuComponent = (HtmlDropDownMenu)app.createComponent(HtmlDropDownMenu.COMPONENT_TYPE);
for(String key: map.keySet()) {
HtmlMenuItem item = (HtmlMenuItem)app.createComponent(HtmlMenuItem.COMPONENT_TYPE);
item.setValue(key);
item.setId(key);
Class[] params = {};
MethodExpression actionExpression = app.getExpressionFactory()
.createMethodExpression(ctx.getELContext(),
"#{bean.menuAction}",
String.class, params);
item.setActionExpression(actionExpression);
String onSelect = "open(this,'"+map.get(key).toString()+"')";
item.setOnselect(onSelect);
menuComponent.getChildren().add(item);
}
return menuComponent;
}
function open(el, paramValue) {
var frm = A4J.findForm(el);
if(frm == null) {
alert("open: no form found.");
return;
}
//add hidden parameter
var hidden = document.createElement('input');
hidden.setAttribute('name', 'PARAM_NAME');
hidden.setAttribute('type', 'hidden');
hidden.setAttribute('value', paramValue);
frm.appendChild(hidden);
frm.submit();
}
public void menuAction (){
FacesContext facesContext = FacesContext.getCurrentInstance();
Application app = facesContext.getApplication();
Map reqMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String param = reqMap.get(name).toString();
}