• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Do Different JSP Types Exist?

 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,

I have a general JSP question that I fail to understand.

Personally, a typical JSP page is like



Note the direct java code on the page.

However, just yesterday I came across this page:



(Note the $ sign...) which I must say led to other code that looked quite "scary" to the naked eye.

So, if there exists a yes or no answer that is, which of the two versions is appropriate and why?

Thanks and regards.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The jsp file using <%.....%> is just copying the content inside
<% and %> into jsp_service()

The jsp file with a $ sign is using a EL,which is made for web designers so that they don't need to learn java.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The language="java" attribute is the default so it isn't necessary to clutter up your page with it.
When JSP first came about, it was following in the footsteps of Microsoft's ASP which, at the time could be written in either VBScript or in Javascript.
Nobody, to my knowledge, has ever implemented a JSP container that understood any language other than Java for scriptlet code.

In fact, in JSP 2.0, the concept of scriptlets is going away altogether.
If you would like to read more about scriptless JSPs and the features of JSP 2.0, see this article by Bear Bibeault:
http://www.javaranch.com/journal/200603/Journal200603.jsp#a5
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic