You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Samuel Cheung <sy...@gmail.com> on 2005/03/14 18:49:56 UTC

tree.jsp example in MyFaces

Hi,

I have 2 questions about the tree.jsp example  in MyFaces. I appreciate 
if anyone can help me out.
* In the tree.jsp example, it has java code in the beginning, where is 
the best place for me to move them? I think it is better not to have 
java code in my jsp page.
<%
   if (pageContext.getAttribute("treeModel", PageContext.SESSION_SCOPE) 
== null) {
  
2. how can I build the tree dynamically? In this example, the tree model 
is built up front (in the init code). Is there a way to built the tree 
model so that everytime user expand a tree branch, it populate the sub-tree?

Thank you.

Sam


Re: tree.jsp example in MyFaces

Posted by Sean Schofield <se...@gmail.com>.
> I have 2 questions about the tree.jsp example  in MyFaces. I appreciate
> if anyone can help me out.
> * In the tree.jsp example, it has java code in the beginning, where is
> the best place for me to move them? I think it is better not to have
> java code in my jsp page.
> <%
>    if (pageContext.getAttribute("treeModel", PageContext.SESSION_SCOPE)
> == null) {

I think the intent was to make a simple example without requiring a
backing bean.  Its just for convenience.  A real page would use a
backing bean.
 
> 2. how can I build the tree dynamically? In this example, the tree model
> is built up front (in the init code). Is there a way to built the tree
> model so that everytime user expand a tree branch, it populate the sub-tree?

I believe this is possible in the tree component you are using.  There
is a new tree component that you may want to check out (tree2).  It
will be in the next release and is in CVS now.  I can help you if you
have questions on that one.

There will be two tree components so you can take your pick on which
one works for you.  I will let Oliver and the tree experts answer
questions about tree.
 
> Sam

sean