Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ArrayList size using JSTL  RSS feed

 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a arraylist as namlist:

I am using JSTL tags.

I want to know the size of arraylist using c:tag.


But it is not giving the values.

Thanks
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
${namelist.size} is not going to work because as you know, the getter method will be invoked for this property, and collections do not have a getSize() method. You should try JSTL fn:length instead.
 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I have two array list dep list and employeelist



Is this the correct way to dispaly the inner for loop?

Can anyone hlep me
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indent your code. Non-indented code is too hard to read.
 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the code


 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have no way of knowing what's correct since we don't know what you're trying to do.

Right now for every employee you're printing the contents of the depDetails list (in the code provided, this is always the same list).

This might be what you want. I would have guessed the intent was to print each employee's depDetails, which is not what's happening now.

(Oh, and the header row doesn't seem to account for anything other than a depDetails with only a single item in it; this will cause some broken-looking HTML if you haven't planned for it.)
 
anvi kon
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for that.

I want to show the dept details of each employee.

Actually , if i do for loop on the second inner dept details.

It is breaking and showing the values?



Thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then the "items" attribute would need to evaluate something for each employee, which it isn't.

I don't understand how come you're having a difficult time indenting--do you not see that those three lines don't line up in any meaningful way? Do you understand why indentation is important?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!