Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

taglib to scriptlet attempt  RSS feed

 
Ed Gretson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a taglib here that works great.


Now I would like to eliminate the taglibs and do it with scriptlet:


Please advise because it keeps giving me variable errors on my jsp after I try the scriplet attempt.
[ July 26, 2006: Message edited by: Ed Gretson ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is 'customers' in this line?

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ed Gretson:

Now I would like to eliminate the taglibs and do it with scriptlet:


Umm, isn't that heading in the wrong direction?
 
Stefan Evans
Bartender
Posts: 1834
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to show how ugly it can be in scriptlet code:



Thats as nice as I can make it.
I assumed that you were iterating over a list of Customer objects.
It means you have to import both the java.util and your Customer objects into the page.
If its an array, then cast it to an array (Customer[] I guess), and use standard loop for an array.

Replaced the forEach tag with a for loop using an Iterator.
Replaced ${expr} with <%= expr %>

All in all, the JSTL looks so much nicer don't you think?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!