• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic Table  RSS feed

 
nu nin
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Afternoon.

I have a doubt about what i have to do or how i have to it, I have read a lot of things but nothing worked.

Well, I have a list inside of a java class then i want to call that list into the jsp to show the results. That list has results from a query, everything is ok in java class because it shows me just one result in jsp, i read that it can be do with a for or enhanced for but been honest i have try everything and nothing work.

I can asume all the code it's ok, i mean jsp and java class but that part of enhenced for or for, didn't work for me. Could Anyone write a basic example to do it by myself just to have it like a guide.

To import the class i did this.



And the For.



The list is called promos.
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Essentially scriptlets have the same rules for syntax that regular Java code does. I can't tell from your example if you are following those rules or not. The import for example ... is servlet.promotion a package, and you are trying to import all its classes? If so, then it should be import="servlet.promotion.*", not servlet.promotion*. Also, you loop on promos, but where is that coming from? Is it possibly a request attribute? "request" is an implicit object available to scriptlets, but all its attributes are not. If that's the case, then at some point before the loop, you'd need code like:


Similarly, the variable m1 doesn't seem to be defined anywhere.

In a broader sense, scriptlets fell out of fashion something like ten years ago, maybe more. If at all possible, you should be using JSTL for looping (and other stuff too), and Expression Language (EL) to retrieve data.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greg Charles wrote:In a broader sense, scriptlets fell out of fashion something like ten years ago, maybe more. If at all possible, you should be using JSTL for looping (and other stuff too), and Expression Language (EL) to retrieve data.

More like 12. 12 years!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!