Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL jstl.sql.Result

 
Justin Richardson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having trouble getting up to speed with JSTL. I'm trying to create a javax.servlet.jsp.jstl.sql.Result object in a bean, and then access it from a jsp page. It sounds simple enough, but I've yet to make it work. Here's what I'm doing. Here is the method in my class:



Here is how I'm trying to access it in my page:



When I run it, this is the error I get:

Don't know how to iterate over supplied "items" in <forEach>

What am I doing wrong?

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Betty Crocker",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The forEach items attribute value is expected to be one of:

  • an array
  • an implementation of java.util.Collection
  • an implementation of java.util.Iterator
  • an implementation of java.util.Enumeration
  • an implementation of java.util.Map
  • a String


  • The interface javax.servlet.jsp.jstl.sql.Result is none of these things.
     
    Justin Richardson
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    My apologies to all who were offended by Betty Crocker.

    It was my understanding that the javax.servlet.jsp.jstl.sql.Result object was intended to wrap a ResultSet object to simplify its use in JSTL. Am I incorrect? Does this tag only relate to use with the <sql:*> library?

    Thanks
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 65220
    95
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Perhaps it's the rows property of that interface that you wish to iterate over?
     
    Justin Richardson
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Oh, maybe that's it. I'm stuck in the mentality of refering to the field names contained in a ResultSet. However, those methods don't exist in a Result. Thanks for setting me straight.
     
    Dilip kumar
    Ranch Hand
    Posts: 360
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi All -

    Which version of J2EE I need to install to import
    javax.servlet.jsp.jstl.sql.ResultSupport and javax.servlet.jsp.jstl.sql.Result
    in my java class ?

    Thanks
     
    Stefan Evans
    Bartender
    Posts: 1784
    10
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The classes you mention are included with JSTL, in jstl.jar.
    They are not part of the standard J2EE API at this point in time.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic