Hashtable to jsp

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Hashtable to jsp

  1. #1
    Join Date
    Mar 2005

    Hashtable to jsp

    Hi there. The problem I'm having is in passing a hashtable to my jsp and reading it's information using core tags. My hashtable contains a series of beans each representing a record. The hashtable itself is contained within another bean, and it is within this that it is passed to the jsp. Urrgh hope this is making sense.

    In my jsp the following code works fine:

    <jsp:useBean id="accbean" class="<container bean>" scope="request"/>
    <c:set var = "myList" value = "${accbean.accList}" />

    <c:forEach var="Record" items="${myList}">
    <c:out value="${Record.key}"/>

    However when I try and read further properties of the record (one property is called "status") like so;

    <c:forEach var="Record" items="${myList}">
    <c:out value="${Record.key}"/>
    <c:out value="${Record.status}"/>

    I get the following error:

    An error occurred while evaluating custom action attribute "value" with value "${Record.status}": Unable to find a value for "status" in object of class "java.util.Hashtable$Entry" using operator "." (null)

    This worked just fine when I was using an ArrayList instead of a hashtable? What am I doing wrong?

    Sorry about the large post! Hope it all makes sense!

  2. #2
    Join Date
    Mar 2005

    Further hashtable stuff

    Tricky one eh?

    What are people's general impressions of this? Has anyone passed a hashtable to a jsp in this manner in the past? Or could it be that it isn't possible to pass information in this way? Any discussion would be welcome!

  3. #3
    Join Date
    Nov 2008

    Hashtable display in JSP

    Hi everyone, I know this thread is quite old but if it can be useful to anyone ... just use ${Record.value} instead of ${Record.status}. This has worked fine for me!

  4. #4
    Join Date
    Apr 2007
    Sterling Heights, Michigan
    Welcome to DevX

    Never too old to be helpful.

    Thanks for posting your tip.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center