来自表单 select 菜单的数据从 jsf/html 表单作为空值传递
data from form select menu being passed as null from jsf/html form
我目前难以传递当用户 select 一个 select 项目并单击提交按钮时填充的操作变量的值应该写在日志中并且不返回 null
Value passed using FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); is returning as null, when the first xhtml form is submited
the objective is to pass the value of a selected selection menu from XHTML form1 to XHRML form2 using a managed bean method on the click of a submit button on form1
我目前难以传递当用户 select 一个 select 项目并单击提交按钮时填充的操作变量的值应该写在日志中并且不返回 null
// form1 starts here
<h:form>
<select id="inputCategory" data-animate-value="#{quickTellerGetCategoryClientBean.inputCategory}" >
<option value="#{null}" Label="-- select one --"/>
<h:dataTable
value="#{quickTellerGetCategoryClientBean.getCategoryNamesList()}"
var="item" >
<h:column style="text-align: left">
<option value="#{item}" label="#{item}" />
</h:column>
</h:dataTable>
<f:param name="action" value="#{item}" />
</select>
<h:commandButton value="Get All Billers" action="#{quickTellerGetCategoryClientBean.chkMe()}">
</h:commandButton>
<h2><h:outputText id="GetCategoryOutput"
value="#{quickTellerGetCategoryClientBean.getSelectedAction()}"/>
</h2>
</h:form>
// form2 starts here
<p>
<h:outputText
value="#{quickTellerGetCategoryClientBean.getAttrListener()}" />
</p>
<h:form>
//managed bean starts here
String attrListener;
private String inputCategory;
public String chkMe() {
return takeMeToAnotherPage("QuickTeller2");
}
public String takeMeToAnotherPage(String linkToGo) {
return linkToGo + "?faces-redirect=true";
}
public void setAttrListener(String attrListener) {
this.attrListener = attrListener;
}
//action listener event
public String getAttrListener() {
LOGGER.debug("<< inside >attrListener>" );
Map<String, String> params =
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
action = params.get("action");
LOGGER.debug("action is " + action);
if ("".equals(action) || action == null) {
return "";
} else {
return action;
}
}
<h:selectOneMenu
value="#{quickTellerGetCategoryClientBean.inputCategory}"
id="CategorySelected">
<f:selectItem itemLabel="Select..." noSelectionOption="true"/>
<f:selectItems
value="#{quickTellerGetCategoryClientBean.getCategoryNamesList()}"> </f:selectItems>
<f:ajax execute="CategorySelected"/>
</h:selectOneMenu>
我目前难以传递当用户 select 一个 select 项目并单击提交按钮时填充的操作变量的值应该写在日志中并且不返回 null
Value passed using FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); is returning as null, when the first xhtml form is submited
the objective is to pass the value of a selected selection menu from XHTML form1 to XHRML form2 using a managed bean method on the click of a submit button on form1
我目前难以传递当用户 select 一个 select 项目并单击提交按钮时填充的操作变量的值应该写在日志中并且不返回 null
// form1 starts here
<h:form>
<select id="inputCategory" data-animate-value="#{quickTellerGetCategoryClientBean.inputCategory}" >
<option value="#{null}" Label="-- select one --"/>
<h:dataTable
value="#{quickTellerGetCategoryClientBean.getCategoryNamesList()}"
var="item" >
<h:column style="text-align: left">
<option value="#{item}" label="#{item}" />
</h:column>
</h:dataTable>
<f:param name="action" value="#{item}" />
</select>
<h:commandButton value="Get All Billers" action="#{quickTellerGetCategoryClientBean.chkMe()}">
</h:commandButton>
<h2><h:outputText id="GetCategoryOutput"
value="#{quickTellerGetCategoryClientBean.getSelectedAction()}"/>
</h2>
</h:form>
// form2 starts here
<p>
<h:outputText
value="#{quickTellerGetCategoryClientBean.getAttrListener()}" />
</p>
<h:form>
//managed bean starts here
String attrListener;
private String inputCategory;
public String chkMe() {
return takeMeToAnotherPage("QuickTeller2");
}
public String takeMeToAnotherPage(String linkToGo) {
return linkToGo + "?faces-redirect=true";
}
public void setAttrListener(String attrListener) {
this.attrListener = attrListener;
}
//action listener event
public String getAttrListener() {
LOGGER.debug("<< inside >attrListener>" );
Map<String, String> params =
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
action = params.get("action");
LOGGER.debug("action is " + action);
if ("".equals(action) || action == null) {
return "";
} else {
return action;
}
}
<h:selectOneMenu
value="#{quickTellerGetCategoryClientBean.inputCategory}"
id="CategorySelected">
<f:selectItem itemLabel="Select..." noSelectionOption="true"/>
<f:selectItems
value="#{quickTellerGetCategoryClientBean.getCategoryNamesList()}"> </f:selectItems>
<f:ajax execute="CategorySelected"/>
</h:selectOneMenu>