This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes EL providing indentation dots Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "EL providing indentation dots" Watch "EL providing indentation dots" New topic
Author

EL providing indentation dots

Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

I need to produce an indented list and wonder if a pure EL structure can make it happen. An example list would look like


Bear
. motorcycle
. . Harley
. . Yamaha
. car
. . Yugo
Pat
. motorcycle
. . Hodaka
. . Yamaha
. car
. . Pontiac
. . Lincoln

I've got a EL variable ${indent} for each record
Is there some way to do something like

for (int i = 0, i < ${indent}; i++ ) {
" . "
}

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

There is no way to loop with just the EL. You'll need the JSTL forEach action for that.

(Or create a custom tag, or EL function, for this specific purpose.)

And, Bear drives a Mazda MX-5.



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

This does the trick

<c:forEach var="i" begin="1" end="${entry.indent}" step="1">

</c:forEach>

Wow, Bar, that's a small car, its almost lighter than your current Yahama
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63195
    
  69

Pat Farrell wrote:This does the trick ...


Wow, Bar, that's a small car, its almost lighter than your current Yahama

I guess it's as close to a motorcycle I could get in a car.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: EL providing indentation dots
 
It's not a secret anymore!