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

Undefined attribute name Items compilation error using jstl

 
ashley Jug
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • 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

 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Pie
Posts: 65227
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic