Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Can you tell me the difference of these output streams in Jsp?

 
Ranch Hand
Posts: 89
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
whats the difference in using these different tags or scriptlets when printing Strings in jsp?
ex: String helloWorld = "Hello World";
 
Bartender
Posts: 4109
72
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Difference(or the rule you MUST remember) is that you should not use scriptlets or scriptlet expressions in JSPs at all. Use EL with JSTL instead (as you've done).
 
Alexander Sales
Ranch Hand
Posts: 89
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it really prohibited to use scriptlets? aren't there any times that we have no other choice but to use a scriptlet?
 
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Alexander Sales wrote:Is it really prohibited to use scriptlets? aren't there any times that we have no other choice but to use a scriptlet?


Scriptlets are never necessary, and should never be used in modern JSPs. They have been discredited for almost 10 years now and using them is simply irresponsible at this point.

If there's something that you are doing in your JSP that cannot be done with modern techniques, it's a huge red flag that you are trying to do something that should not be done in a JSP at all, but likely in the page controller.
 
Alexander Sales
Ranch Hand
Posts: 89
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks sir bear, but it is a 'nice to have' in SCWCD right?
 
Bear Bibeault
Sheriff
Posts: 67595
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The SCWCD is not the real world.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic