Why are JSP tags considered as being less logic than scriplets

Discussion in 'Java' started by ReplyToNewsgroup_NoSpamWanted@bahnhofbredband.se, Nov 25, 2003.

  1. Guest

    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_3-fcs/doc/JSPIntro2.html
    And this similar page written with JSP standard tags:
    http://java.sun.com/webservices/docs/1.3/tutorial/examples/web/date/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 ?
     
    , Nov 25, 2003
    #1
    1. Advertising

  2. Anton Spaans Guest

    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.


    <> wrote in message
    news:...
    > 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_3-fcs/doc/JSPIntro2.html
    > And this similar page written with JSP standard tags:
    >

    http://java.sun.com/webservices/docs/1.3/tutorial/examples/web/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 ?
     
    Anton Spaans, Nov 25, 2003
    #2
    1. Advertising

  3. Sudsy Guest

    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
     
    Sudsy, Nov 25, 2003
    #3
  4. Guest

    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.
     
    , Nov 26, 2003
    #4
  5. Ajay Patil Guest

    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 **
     
    Ajay Patil, Nov 26, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oleg
    Replies:
    3
    Views:
    552
    Ralf Hildebrandt
    Mar 5, 2004
  2. fake ID
    Replies:
    1
    Views:
    14,556
  3. fake ID
    Replies:
    0
    Views:
    598
    fake ID
    Feb 10, 2006
  4. Hiren
    Replies:
    2
    Views:
    1,869
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,076
    Smokey Grindel
    Dec 2, 2006
Loading...

Share This Page