• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL or Java Class Processing

 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All;

I have an arraylist. I need to build an html table of these items with 4 cells per row.

I'm torn of whether I should do this on the server in a java class than just write it out on the JSP page, or if I work out a way to do it using a c:ForEach (I have varStatus, begin, end and step at my disposal ~ I feel like this could get messy though).

Anyone have an experience that might suggests one way over the other?

Thanks,

Luke
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only thing I dislike as much as loading a JSP page up with Java code, is formatting a bunch of HTML in Java code. My recommednation is to build the view in the JSP where it belongs.

I've done table building such as this many times and it's never as "messy" as building up HTML in string buffers.
 
Luke Shannon
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Makes sense. I will give it a try in the JSTL. Can you do division in JSTL?

example:

loopVar.count mod 4 == 0

Basically what I am looking for is a syntax that will allow me to close the last table row and open a new one every four items in the list.

Any tips would be appreciated.

Thanks,

Luke
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
an you do division in JSTL?


Yes.

If you are going to be using the JSTL, I'd advise having a copy of the spec on your desk.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!