You cannot use a valuebinding expression for the id of a JSF
component. Try the <f:param> technique that Keith is suggesting.
sean
On 12/2/05, Keith Lynch <[EMAIL PROTECTED]> wrote:
> As far as I know this is impossible to do. The id's need to be set with
> static data which is embedded in the jsp file.
>
> You can alternatively set them yourself in the jsp, which is cumborsome, or
> alternatively you could use the node id as a parameter to an
> actionListener.
>
> <h:selectBooleancheckbox value="output parameter"
>
> actionListener="#{YourActionListenerClass.doSomething}">
> <f:param name="node-id" value="#{ node.identifier}" />
> </h:selectBooleancheckbox>
>
> In doSomething
>
> public void doSomething(ActionEvent action) {
> String nodeID =
> getParameterFromActionEvent(event,"node-id");
> // .....
> }
>
>
> public static Object
> getParameterFromActionEvent(ActionEvent actionEvent, String
> paramName)
> {
> UIComponent component = actionEvent.getComponent();
> List children = component.getChildren ();
> for (Iterator iter = children.iterator(); iter.hasNext();) {
> UIComponent element = (UIComponent) iter.next();
> if(element.getClass() == UIParameter.class) {
> if( StringUtils.equals(
> ((UIParameter)element).getName(), paramName)) {
> return ((UIParameter)element).getValue();
> }
> }
> }
> return null;
>
> }
>
> On 12/1/05, Anu Padki < [EMAIL PROTECTED]> wrote:
> > Thanks for your response.
> > Here is how it is done.
> > I do set the identifier using node.setIdentfier.
> > What I want is in the facet where I display the node give it a unique id,
> where I define
> > <selectBooleancheckbox id = ......> want to set this id.
> > JSF generates some id, however, it is not meaningful, it is cryptic. I
> would like to have this id same value as that I set in new TreeNodeBase.
> > Please advise.
> > - anu
> >
> >
> >
> >
> > On 12/1/05, Keith Lynch <[EMAIL PROTECTED] > wrote:
> > > I'm not sure if you're setting the node-id in your code. You have to do
> this when you create the tree element.
> > >
> > > TreeNodeBase newNode = new TreeNodeBase("node-type", description
> ,theNodeIdentifier , true);
> > >
> > > You can then use #{node.identifier}
> > >
> > > where node is
> > >
> > > <x:tree2 value="#{Values}"
> > > id="elementTree"
> > > var="node"
> > > binding="#{Binding}">
> > >
> > > Hope this is your problem
> > > Keith
> > >
> > >
> > >
> > > On 12/1/05, Anu Padki < [EMAIL PROTECTED]> wrote:
> > > >
> > > > hi All,
> > > >
> > > > I am working on a checkbox version of the tree2. I have extneded the
> nodebase class and it works fine.
> > > > I want to select some nodes and then display the selected nodes on
> other web pages. To achieve this, I have to use JavaScript. However, in
> order to make it work with the JavaScript, I have to create a unique id for
> the checkbox.
> > > > An Id that identifies with the database. The id created by jsf is of
> no use to track the selected node.
> > > > I use selectBooleanCheckbox on the web page.There is a unique
> identifier set to the node.
> > > > But if I try id ="#{node.identifier} it of courde fails, teied
> ${node.identifier} and <%=nodeidentifier>
> > > > both failed. I also tried to panelGrid binding at the node level.
> Created the panelGrid method in the node class, but that does gives
> "instantiation of bean" problem.
> > > > Any thoughts, really appreciate all help from this user group.
> > > > - Anu
> > >
> > >
> >
> >
>
>