Doesn't make sense to me to use an inputText with a method parameter. What would be set when submitting the form?
If it was an outputText, you could use the Seam framework which has enhanced EL a bit to allow for passing parameters.
Yes u r absolutley right..actually i have given worng example i need it in <h:outputText> and <h:outputLabel> ...actualy the problem is i can send parameter in action event like commandbutton of link click...but i need to show all the labels or text filed value should come from a single method of backing bean which will take a parameter and return a value depending upon the parameter
Sounds like you want this to act like a resource bundle.
Is the returned value dependant on the state of the backing bean?
If it is stateless and a simple mapping from key to a value (and you don't want a resource bundle for this) you could create a Facelets function which is very simple (simpler than integrating Seam).
With resource bundle with key and var i can get the values and my resource in that case is a properties file..actually my problem is my data is comming from xml..so i want to pass the node name from jsf page and in my backing bean method i will return the value of the node..so can u plz help if i there is anyway to do like this???
thnx for replying..
Are you using Facelets?
If you are you can very easily create a Facelets function.
If not I'd suggest you have a look at it, very nice viewhandler with some nice features.
A Facelets function is simply a static method in a Java class, dead simple.
All you need is:
- 1 Java class with the method(s)
- XML file (yourName.taglib.xml), which maps EL function to java method.
- Add the taglib.xml to a context param so it gets loaded.
If you need just action and some parameter inside - just use f:param. So in your action get the param value from request map and use it.