Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Why are JSP tags considered as being less logic than scriplets

Reply
Thread Tools

Why are JSP tags considered as being less logic than scriplets

 
 
ReplyToNewsgroup_NoSpamWanted@bahnhofbredband.se
Guest
Posts: n/a
 
      11-25-2003
Most of you have probably heard/read that it's better to use JSP tags
instead of scriptlets for the reason that you should not "mix
presentation and logic" (for example that's what the JSP chapter of
the Java Web Services Tutorial claims) but can someone explain why
"the logic" is considered to be less mixed just because you change the
logic from normal java syntax to xml syntax?

For example have a look at this page with scriptlets:
http://java.sun.com/j2ee/tutorial/1_...JSPIntro2.html
And this similar page written with JSP standard tags:
http://java.sun.com/webservices/docs.../web/index.txt

Does anyone really think that the XML syntax (jsp tags) is easier to
read or that you are using less logic just because the syntax for the
logic is XML instead of java ?
 
Reply With Quote
 
 
 
 
Anton Spaans
Guest
Posts: n/a
 
      11-25-2003
The separation between presentation and business-logic is an old and still
very current idea that promotes the maintainability of (large) software
projects. A change in your business logic has a lesser chance to require a
change in your presentation logic and vice versa.

Also, coding JSP tags doesn't have a steep learning curve as Java coding
does. Its easier to teach people to code JSP tags (or even let graphical
design tools generate them instead) than to teach (generate) Java code. All
the hard-core business logic is then coded into the implementation of the
JSP tags (proprietary business logic can be coded into JSP
taglib-extensions).
It also shields the gui coder (JSP tag coders) from business logic code..
they don't need to deal with it.

These are just a couple of reasons.
-- Anton.


<(E-Mail Removed) e> wrote in message
news:(E-Mail Removed)...
> Most of you have probably heard/read that it's better to use JSP tags
> instead of scriptlets for the reason that you should not "mix
> presentation and logic" (for example that's what the JSP chapter of
> the Java Web Services Tutorial claims) but can someone explain why
> "the logic" is considered to be less mixed just because you change the
> logic from normal java syntax to xml syntax?
>
> For example have a look at this page with scriptlets:
> http://java.sun.com/j2ee/tutorial/1_...JSPIntro2.html
> And this similar page written with JSP standard tags:
>

http://java.sun.com/webservices/docs.../date/web/inde
x.txt
>
> Does anyone really think that the XML syntax (jsp tags) is easier to
> read or that you are using less logic just because the syntax for the
> logic is XML instead of java ?



 
Reply With Quote
 
 
 
 
Sudsy
Guest
Posts: n/a
 
      11-25-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
<snip>
> Does anyone really think that the XML syntax (jsp tags) is easier to
> read or that you are using less logic just because the syntax for the
> logic is XML instead of java ?


The idea was to separate java code from HTML. Tags look just like any
other HTML tag. They might have different attributes but they're still
just tags. Scriptlets introduce java source code into the HTML page.
This is considered to be a "bad thing". Theoretically, you could work
in a large enough shop where the HTML people are graphic artists who
know nothing about java. Do you really want to run the risk of them
"accidentally" altering your carefully crafted code? With tags they
shouldn't have access to the source, only the functionality provided.
Besides which, IMHO scriptlets just plain look messy! YMMV

 
Reply With Quote
 
brougham5@yahoo.com
Guest
Posts: n/a
 
      11-26-2003
(E-Mail Removed) wrote:

>can someone explain why
>"the logic" is considered to be less mixed just because you change the
>logic from normal java syntax to xml syntax?


It's not.

Doesn't matter what kind of tags you use, if they're doing anything other
than presentation logic, they don't belong in a JSP.
 
Reply With Quote
 
Ajay Patil
Guest
Posts: n/a
 
      11-26-2003
It is a very popular and trendy opinion that
"Scriptlets just look plain messy !"

I agree tags look better and are also easier to auto-generate
tags than Java code.

At the same time, how many applications are really there in which the
JSPs are not coded by Java programmers ?

Is Java coding really more difficult to learn than the tag libraries ?
In fact it is quite hard to wire/bind the tags with the back-end model
beans and debugging is hard with zilch error messages.

If the HTML people are graphic artists who nothing of Java, then tag libraries
are certainly the way to go. But if this is not the case, we must
certainly reconsider "Scriplets just look plain messy" and also give
a thought of the additional complexity we are creating.

** Just letting off some steam after being frusturated with these new
taglib frameworks **
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
different asp.net server tags (less than Percentage symbol hash or equals) fake ID ASP .Net 1 09-29-2009 08:13 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
different asp.net server tags (less than Percentage symbol hash or equals) fake ID ASP .Net 0 02-10-2006 03:02 AM
Why more area occupation for less logic usage ???? Oleg VHDL 3 03-05-2004 09:58 PM
how to avoid scriplets in jsp ? Hiren Java 2 08-20-2003 06:36 PM



Advertisments