This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes need help choosing best tag for this Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "need help choosing best tag for this" Watch "need help choosing best tag for this" New topic

need help choosing best tag for this

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

I have a list that holds values, and I just need to display those values one after another on a page.

Then give the users the ability to click on each one and it will take them to the next page, depending on which one they click on.

Im not sure what to use here, still new to so many of the jsf tags
in additon to c and h tags I am using


so any of those or the h: tag that would be most appropriate is fine

True wisdom is in knowing you know nothing - Socrates
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

I think a simple JSF solution, with a listener on the various values in the select list, is all you need.

-Cameron McKenzie
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

can you elaborate please?

Ive been messing with this all day, and so far the best I have gotten is using h: outputText, and since this is a list it is printing out I just get this as the output:

[APosttest, three, Moved Tese, Matt Test Two, space Test, project name, matt, three, space remove, two, tash2, spaces2, WSN Pond Measurements, tash, Single Test, spaces, Test01, MDN, exampleProject1, DoubleTest, spaces2]

I need a way to remove the [] and put those into a list going vertically down the page.

Maybe I need to change it out of a list, Im not sure?

edit - well i stumbled across one temporary solution that gives the look I am going for but no functionality...I just use another recursiveTreeNodeAdaptor and set showLines="false"
it looks like a list at least....
but I have the same problem Im having with the actual tree when I do that.
How do you make it where clicking on one of the nodes will do something, like send the user to another page?
I looked at the recursiveTreeNodeAdaptor javadoc and there is really nothing there to handle this.
I know the rich tree has to do more than just display the tree, there has to be some way to control what clicking on a node does right?

If you can answer either of these questions for me it should solvemy problem
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950

Maybe you should look at this:

There are 4 articles in this series, BTW, and I think it's one of the best quick-start intros to JSF around.

Customer surveys are for companies who didn't pay proper attention to begin with.
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

Yeah I read those when I first got started and I just re read the one you linked. But I still cant get this to work.

From what I can see he uses just the String CD to bind to a dataList. I tried this with my last bt its just blank.

The only reason I keep trying to use this list is because it loads itself up with all the values.

If I just try to use the projectName String from the project class, it returns nothing becuase that value has not yet been loaded with any data. The only reason I keep trying to use this list is because by some miracle I got it to load the values into the list from the web service before my jsf pages try to use them.

I know this doesnt make much sense since there are so many things left out.

Im just tired and dont feel like doing this but I dont have any time left
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

Yeah Im trying to follow this rich's example.

I just don't see how he is doing something.

He is using cd to populate his dataTable.

cd is from the StoreController class and it is of type CD cd;

So I made a ProjectControl class, and made MeasurementProject project; with setter and getter.

But this is still giving me blank space.

So he has to be doing something that is loading values into CD cd, but I dont see where he is doing this
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

As always talking through it here seems to be getting me closer....

maybe someone can give me the final nudge here?

So in my controller class I have my MeasurementProject measurementProjectCollection (this is the same as Cd cd in rich's example). With setter and getter. Plus a String project

Then I perform an action on both of these to change their values. The action being performed here is taking the data froma web service and binding it to these values:

Im not totally sure what is being bound to measurementProjectCollection, but it seems to be what i want, because when I print out the value of project it comes out as the very first project from the data service. ANd when I bind project to my managed bean and use that as an output on my page it does display this very first project. The problem is, there are multiple projects. So I mean Icould so String project1; project2, project3, etc etc and then use that for loop over and over to bind the different values, and then on my jsf page just have a lot of hutputText tags for each project1 - projectx. But this isnt very feasible, especially since the amount of projects will be changing. I could just do project1 - project100m because it is very unlikely there will be more than that per user, but you can see the trouble here.

So, in that for loop I can just bind the value returned over each iteration to a list, which is what I am doing for my tree. But this gets e back to square one.
If I just bind the list to my jsf page, the output is [project1, project2,projectx, etc etc]

So any idea what I should do here?

edit - I guess it comes down to teh fact that I need something to hold the multiple values for project, and be able to bind that to my jsf page, but make it come out in a nice list instead of just every value jumbled together between brackets
Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

There has to be just an easy to use tag that takes the values of the list and sorts them in a column!
That is exactly what the rich:tree does, there has to be somethign else too I would think
I agree. Here's the link:
subject: need help choosing best tag for this
Similar Threads
Can't set invisible border for Table inside P:dataTable.
I am unable to find error in this program.
Help ...Dynamic Drop Down list
Why can't I access the value of this Map in JSF?
Retaining checkbox values across pages using struts