• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP scriptlets  RSS feed

 
David Spades
Ranch Hand
Posts: 348
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've heard a lot about the infamous scriptlets. Basically scriptlets is used when we want to embed java code inside a JSP. So, if you don't want to use scriptlets, but want to embed java code, then custom tags is the only way to go (assuming what you want to do is not covered by standard directive and EL). is this about right? thanks
 
James Harte
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is it that you are trying to accomplish by not using scriptlets which you feel you can do better with tags? Do you see an issue with the scriptlets, or are you looking to simply have the page look more streamlines on the server side?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally, most code that people feel like putting into JSPs is something that really belongs in the page controller servlet. That eliminates the majority of it. Any control needed within the JSP itself is usually either looping, conditionals or data display. This is covered by the JSTL and the EL. Anything else, and that's usually a really small subset, might be appropriate for custom tags or EL functions.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!