aspose file tools*
The moose likes JSF and the fly likes How can I show my 2D arrayList using the <ui:repeat> in JSF ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How can I show my 2D arrayList using the <ui:repeat> in JSF ?" Watch "How can I show my 2D arrayList using the <ui:repeat> in JSF ?" New topic
Author

How can I show my 2D arrayList using the <ui:repeat> in JSF ?

michael nik
Greenhorn

Joined: Mar 11, 2012
Posts: 15
I can show the objects of a plain arrayList as a list in jsf.





But if I have

I tried to use nested but it doesn't work. I dont want to use data tables since I want to display them as a list.

E.g I tried to do this but it doesn't work, neither with <ui:repeat>, is it possible what I try to do?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

If you're going to display a 2-dimensional tabular structure in a View, use a construct that's designed to display 2-dimensional tabular structures: the dataTable.

Coding logic on a View is just plain wrong, whether you're using JSTL or Facelets. It breaks the Separation of Concerns contract that is at the heart of the MVC architecture.


Customer surveys are for companies who didn't pay proper attention to begin with.
michael nik
Greenhorn

Joined: Mar 11, 2012
Posts: 15
hmmm, so if I want to display in a View (a 2D ArrayList that I have in my code) using <ul> and <li> tags is completely wrong due to the MVC pattern/separation of concerns?

Always I have to use e.g data tables?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16061
    
  21

There are some HTML bigots that say you shouldn't use the HTML list tags at all anymore.

Of course, there are also some HTML bigots who say the same thing about tables.

Personally, I don't recommend using raw HTML in JSF unless you absolutely have to.

You can achieve the same appearance using CSS, which is where all of this comes from, whether you're using purely HTML or JSF.

It's not that the world will end if you do it a different way, but going by my own experience, apps are simpler, cleaner, and more maintainable using the approaches I've outlined.

Using logic to arrange UI elements is a borderline case, and it's one that ui:repeat is specifically designed to address, and I use it, but not usually for simple element lists. Part of the reason I discourage it is because it's a "gateway drug" to putting business logic on View definitions, which definitely is a violation of the MVC paradigm. And, more importantly (as opposed to theory, academe or ide[ot]ology", it turns the process of software maintenance into an expensive hide-and-seek game where you never know for sure if logic is on the bean, on the view, or splattered in some unoly combination between the two.
michael nik
Greenhorn

Joined: Mar 11, 2012
Posts: 15
clear answer, thank you very much for your advice, it was very useful for me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I show my 2D arrayList using the <ui:repeat> in JSF ?