<a4j:region id="treeRegion">
<t:tree2 var="_node" value="...">
<f:facet name="node">
<a4j:commandLink value="#{_node.identifier}"
ajaxSingle="true" reRender="listboxRegion">
<t:updateActionListener
property="#{bean.selectedNodeId}"
value="#{_node.identifier}" />
</a4j:commandLink>
</f:facet>
</t:tree2>
</a4j:region>
<a4j:outputPanel id="listboxRegion">
...
</a4j:outputPanel>
On 6/28/07, Novin <[EMAIL PROTECTED]> wrote:
Hi Andrew,
Thanks a lot for such a fine and comprehensive reply I ever have on any
forum.
Ya you are right with all those points related to Action approach.
Now I have implemented backing bean based approach and also used
<t:saveState value="#{accountTreeBean}"/> its working fine instead of
storing the bean into request session.
Do u have any idea related to this problem:
It is not related to Tree but related to ajax4JSF.
On click of tree node I want to fire some ajax request but I donot want the
same tree to be rerender.
The jsp page is having two regions one for tree & one for ListBox.
Wht I want : on click of the tree 's any node. I want only rerender the
ListBox region and want to fire some action event.
Wht is happening:
But currently when I click on the tree node for the new request (which is
inside tree region )
It load the whole tree from the bean which I need to put the bean into the
session.
<managed-bean>
<managed-bean-name>accountTreeBean</managed-bean-name>
<managed-bean-class>com.ml.ffogo.csin.web.beans.AccountTreeBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
I don't want to rerender the tree region but only want to send the req and
re-render the listbox region.
Novin
Andrew Robinson-5 wrote:
>
> I don't see a problem with the action based, it isn't my style
> however, as I prefer to have my data directly tied to managed bean
> member variables. That way I can really get a controller role for an
> MVC style of development. It also is more "JSF" to me and less
> servlet-JSP style of development.
>
> I use quite a bit of on-load type of functionality, because I can
> ensure that if the user navigates to a page without going through the
> action, I can make sure all the data for a page is loaded. I use
> JBoss-Seam to manage on-load actions, but I have also developed the
> jsf-comp on-load component that works well if you only want that
> functionality without a large 3rd party library.
>
> Also, it is easier to debug a bean than to debug the servlet and
> session scopes.
>
> With that said, either way really should work for you. If you go with
> your action based approach, you have to make sure that the tree
> component is never created and especially rendered unless the action
> fires first, otherwise you will have errors.
>
> If you use a bean, you can make it serve all the needs of you page,
> and not just the tree. Also, with the t:saveState, you can make sure
> the bean's data will be saved request to request. That way, the tree
> model will be still available if you submit another control.
>
> What the problem may be is that you are creating the data model in the
> action, the tree is displayed, and then when you run an action on that
> page the data model is gone since it is only around for one request.
>
> If you want to use the action based method, try using:
>
> <t:saveState value="#{request.attributes['treeData']}" />
>
> Replace the EL with where ever you are sticking the tree model. Also,
> in your initial post, you have the tree pointing at
> #{accountTreeBean.treeData} not #{request.something}.
>
> -Andrew
>
> On 6/28/07, Novin <[EMAIL PROTECTED]> wrote:
>>
>> Hi Andrew,
>>
>> My problem of dispaying the tree is solved.
>>
>> As per your last reply I can adopt two different approach
>>
>> 1) on-load functionality or Managed bean based (when the page will be
>> load)
>> the treetable bean's treedata method will called and treenode will
>> begenerated and displayed.
>>
>> 2) action based : where I am calling an action and setting the treebean
>> into
>> the request and when JSP page is loaded I am just fetching the bean from
>> the
>> request(which is already created in the action.)
>>
>> I have choosen Action based approach bcas I need to display some more
>> data
>> on the same page along with the tree. On change of the listbox I need to
>> fire some method calls.
>>
>> So to make all the logic centralised I choosed action based approach.
>>
>> I am attaching the screenshot of the page.
>>
>> If you have any better idea pls let me know.
>
>
--
View this message in context:
http://www.nabble.com/Problem-in-Tree2%3A-nullpointer-org.apache.myfaces.custom.tree2.UITreeData.encodeEnd-tf3990148.html#a11351385
Sent from the MyFaces - Users mailing list archive at Nabble.com.