File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Undefined attribute name Items compilation error using jstl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Undefined attribute name Items compilation error using jstl" Watch "Undefined attribute name Items compilation error using jstl" New topic
Author

Undefined attribute name Items compilation error using jstl

ashley Jug
Ranch Hand

Joined: Sep 02, 2011
Posts: 60
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
Bartender

Joined: Oct 14, 2005
Posts: 18651
    
    8

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

Joined: Sep 02, 2011
Posts: 60
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

Joined: Jan 10, 2002
Posts: 61415
    
  67

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,


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ashley Jug
Ranch Hand

Joined: Sep 02, 2011
Posts: 60
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

Joined: Jan 10, 2002
Posts: 61415
    
  67

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.
 
Consider Paul's rocket mass heater.
 
subject: Undefined attribute name Items compilation error using jstl