Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Do Different JSP Types Exist?  RSS feed

 
Arthur Buliva
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • 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.
 
paritosh ranjan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • 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.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!