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.

Reply via email to