I am trying to display buttons that are generating dynamically from a HashMap.
And another requirement is that I need to display two buttons in one row and so on.
I am able to display buttons but these are coming one after another i.e. one row contains one button.
My code is as follows:
So is your problem that you have a varying number of buttons? If you would have a constant number of buttons you would not bother with arraylists of datatable and you would just throw it all to a html table (maybe with JSF but that is just details).
Well, if you have a varying number of buttons then maybe I would put a objects that contain both of the buttons in the list instead of map values. Something like this
But that is just in case you have a varying number of buttons.
Oh, BTW why do you use HashMap? It does not quarantee the order of its contents so you get the buttons in random order.
Joined: Dec 30, 2008
Thanks for your brilliant response.
It's working as per my requirement.
Joined: Apr 15, 2008
You are welcome.
By the way, I would remove the id attribute since it is not allowed to have same id on different elements on same page.
subject: Displaying Two Buttons in one Row from HashMap