• 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

Undefined attribute name Items compilation error using jstl

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have a jsp page to view a list of data from a table as follows:



However its giving me a compilation error(Undefined attribute name "Items" - isValid ==false) for this line:


I am assuming it is because i don't have the jar for sql in my lib folder?

I tried to get one but none available.

Any suggestion please?

Thanks

 
Marshal
Posts: 28237
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No. The error message says that the "Items" attribute is not defined for that line. So in response to that you should find out why the compiler thinks that "Items" isn't a defined attribute for the <c:forEach> element. First step: go and find the documentation for that element and see what the valid attributes for <c:forEach> are.

The error messages are there to provide you with information about the problem. It's best to read them and try to extract that information before you start making assumptions.
 
ashley Jug
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

thanks for the advice i have resolved the previous issue but now i have the following error message:


Cannot find the rows attribute defined for the tag items from the tld file.

Any advice please?
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is Namelist? (By the way, not following conventions is a poor practice -- variable names should start with a lowercase character)

Does it have a property named rows?

I suspect from its name and the error message that it's a list and therefore has no properties and expects a numeric index.

And please indent your code properly. It's really hard to see the structure with wonky indentation.

Also, if you already have a variable named Namelist in the scope of the JSP, using the same name for the inner var of the loop is guaranteed to cause failures. Guaranteed. Not maybe. Not might,
 
ashley Jug
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My apologies for the indentation. This is my servlet:


This is my resultname.jsp:


This is my method that return the nameList:


So i can name this to a different name?
Sorry for all these questions i am very new to programming.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, so it's a list of strings. Where did the "rows" come from? Why would you just add a gratuitous suffix to the name of the scoped variable?

And if you just copied it from an example you saw, you need to stop copying examples and learn how things work.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic