aspose file tools*
The moose likes JSP and the fly likes JSTL jstl.sql.Result Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL jstl.sql.Result" Watch "JSTL jstl.sql.Result" New topic
Author

JSTL jstl.sql.Result

Justin Richardson
Greenhorn

Joined: Nov 04, 2005
Posts: 3
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

Joined: Jan 10, 2002
Posts: 61222
    
  66

"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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61222
    
  66

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

    Joined: Nov 04, 2005
    Posts: 3
    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

    Joined: Jan 10, 2002
    Posts: 61222
        
      66

    Perhaps it's the rows property of that interface that you wish to iterate over?
    Justin Richardson
    Greenhorn

    Joined: Nov 04, 2005
    Posts: 3
    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

    Joined: Oct 16, 2000
    Posts: 360
    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

    Joined: Jul 06, 2005
    Posts: 1018
    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.
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: JSTL jstl.sql.Result