我已经集成:
<p:selectOneMenu value="#{orderListBean.currentItem.displayType}"
effect="fade" required="true">
<f:selectItem itemLabel="Select Item" itemValue="" />
<f:selectItem itemLabel="test1" itemValue="1" />
<f:selectItem itemLabel="test" itemValue="1" />
</p:selectOneMenu>
<h:form>
.....
</h:form>
我有一个form
我的代码。test1
如果我的 OneList 菜单上的项目被选中,我只想显示表单。请给我一个关于如何实现这个的提示?
更新
我的后端代码:
@Component
@Scope("session")
public class OrderListBean implements Serializable {
/**
* UUID
*/
private static final long serialVersionUID = -1780048479982517846L;
/**
* log4j
*/
private static Logger log = LogManager.getLogger(OrderListBean.class);
/**
* items list
*/
private List<TemplateItems> itemList;
/**
* the Name of our Product Specialization form
*/
private String formName;
/**
* the current Item
*/
private TemplateItems currentItem;
/**
* Template Service
*/
private ITemplateService tempService;
/**
* our current Template
*/
private Template currentTemplate;
/**
* key: valueType
* value: displayType
*/
private static final Map<Integer, Integer> displayItemValueMap;
/**
* maps our Template Items
*/
static {
displayItemValueMap = new HashMap<Integer, Integer>();
//String Input Text
displayItemValueMap.put(1, 1);
//Drag and Drop
displayItemValueMap.put(2, 1);
//Text Field
displayItemValueMap.put(3, 1);
//Color Picker
displayItemValueMap.put(4, 1);
//Date Picker
displayItemValueMap.put(5, 4);
//Integer Input Text
displayItemValueMap.put(6, 2);
//Double Input Text
displayItemValueMap.put(7, 3);
}
/**
* Constructor
*/
public OrderListBean() {
currentItem = new TemplateItems();
tempService = new TemplateService();
currentTemplate = new Template();
formName = "Untitled Form";
//Strings
itemList = new ArrayList<TemplateItems>();
// itemList.add(currentItem);
}
/**
* @return the item
*/
public List<TemplateItems> getItem() {
return itemList;
}
/**
* @param item the item to set
*/
public void setItem(List<TemplateItems> item) {
this.itemList = item;
}
/**
* adds a TemplateItem to our item List
* @param item
*/
public void addItem() {
log.info("enter add item method...");
this.itemList.add(currentItem);
currentItem.setValueType(displayItemValueMap.get(currentItem.getDisplayType()));
currentItem = new TemplateItems();
log.info(currentItem.toString());
}
public void deleteItem(TemplateItems item) {
if(item != null) {
itemList.remove(item);
}
}
/**
* @return the currentItem
*/
public TemplateItems getCurrentItem() {
return currentItem;
}
/**
* @param currentItem the currentItem to set
*/
public void setCurrentItem(TemplateItems currentItem) {
this.currentItem = currentItem;
}
/**
* @return the itemList
*/
public List<TemplateItems> getItemList() {
return itemList;
}
/**
* @param itemList the itemList to set
*/
public void setItemList(List<TemplateItems> itemList) {
this.itemList = itemList;
}
/**
* @return the formName
*/
public String getFormName() {
return formName;
}
/**
* @param formName the formName to set
*/
public void setFormName(String formName) {
this.formName = formName;
}