मैं अपने वेबपृष्ठ पर जेएसएफ <h:commandButtons>
गतिशील रूप से जोड़ने की कोशिश कर रहा हूं, और अब तक मैं उन्हें प्रदर्शित कर रहा हूं, लेकिन मैं पैरामीटर के साथ कार्रवाई सेट नहीं कर सकता, जैसे कि मैं स्थिर में पृष्ठ:
action="#{bean.function(parameter)}"
। (यह निश्चित रूप से ईएल-2.2 का उपयोग कर रहा है)
आसपास देखकर मुझे लगता है कि मुझे MethodExpression
बनाना है, लेकिन यह मेरे लिए अस्पष्ट है और मैं इस पर अधिक जानकारी नहीं पा रहा हूं। अगर कोई धुंध के माध्यम से एक प्रकाश चमक सकता है और समझा सकता है कि यह कैसे किया जा सकता है, तो इसकी सराहना की जाएगी।डायनेमिक जेएसएफ (2.0) कमांडबटन - तर्क के साथ कार्रवाई सेट करें
संपादित करें: तो अब मैं इस
public void displayNode(String childName){
//lots of messy code instantiating JSF components
if(activeEmployee.getParent() != null){
HtmlCommandButton parent = new HtmlCommandButton();
HtmlOutputText parentLabel = new HtmlOutputText();
parentLabel.setId("label" + count++); //I really hate having to use count
parentLabel.setValue("Parent: ");
parent.setId("Parent" + count++);
String parentName = activeEmployee.getParent().getName();
parent.setValue(parentName);
MethodExpression expression = createMethodExpression("#{tree.displayNode('" + parentName + "')}",
null, String.class);
parent.setActionExpression(expression);
newDiv.getChildren().add(parentLabel);
newDiv.getChildren().add(parent);
}
क्या आप कमांड बटन दिखाने/छुपाने के लिए प्रस्तुत संपत्ति का उपयोग नहीं कर सकते? – RajV
नहीं मैं गतिशील रूप से अन्य संबंधित नोड्स प्रदर्शित करने के लिए बटन के साथ पेड़ नोड्स बना रहा हूं –