ArrayList to JSP page?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JoeMac3313
    New Member
    • Jul 2007
    • 16

    #1

    ArrayList to JSP page?

    How do I get an arrayList to a jsp page or would it be better to use an array?
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    #2
    same as normal usage,

    but you have to implement a bean(simply class) that contains an ArrayList, not by extending it, have those setters and getters method if you're comfort to use the convention.... then, use it.......

    I have encountered a problem about implementing on it, you may read this thread @ reply #16 to #18, hope it helps

    Comment

    • itsraghz
      New Member
      • Mar 2007
      • 124

      #3
      The simple way to get an object into a JSP page is to use any of the available scopes (page, request, session, application). The most often used scopes are request and session.

      You can use it via the following code snippets.

      Code:
      request.getAttribute("<NameWithWhichYouBoundTheArrayList>");
      How can you set an attribute in the scopes? using the same scope but with the setAttribute() method as follows.

      Code:
      request.setAttribute("<NameToBindTheArrayList>",arrayListObj);
      I believe you are aware of how to deal with (creation and population of) arraylists in the page where you set the attribute in a particular scope!

      Comment

      Working...