• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

get the first element of a ArrayList at a jsp page

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to get the first element of a ArrayList at a jsp page with Struts 1?

e.g.






my.jsp


The given source code does not work:
'weblogic.kernel.Default (self-tuning)' ERROR org.apache.struts.tiles.taglib.InsertTag - ServletException in '/prot/pages/my.jsp': Cannot find bean: "accountList" in any scope
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Albert,
Why just the first element? If you only need one element, you'd just store that in the request. It is more common to iterate through the list using list:iterate.

That said, if you do need the first element, you can use an index.

Step 1 - define the bean as the first element:


Step 2 - write out the desired property


I wrote this from memory so I might have some syntax errors.
 
Bras cause cancer. And tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic