Am I the only one who questions JSTL, Struts Tags, XSL Tags?

G

Greg Smith

I guess it comes down to how you design the application. I'm not trying
to dodge anything here, merely noting that if you have complex logic to
execute then it properly belongs in the servlet, not the JSP.
As I mentioned previously, JSP is all about presentation. About the only
logic I generally incorporate involves checking for roles or errors and
displaying accordingly.
Remember that the servlet has the choice as to which page to forward to;
don't try to make a single page suffice for all situations when you can
instead have multiple processing paths. Such an approach would obviate
the need for complex logic processing at the page level, don't you think?

i hear you... it does seem to me that we're forgetting the lessons
learned over the last 30 years of software engineering. to make
multiple pages when one (plus a little logic) will do, increases the
cost of maintenance. and maintenance is the most expensive phase of
the life cycle. but that may be a different thread.

thanks for your help.
 
S

Sudsy

Greg Smith wrote:
i hear you... it does seem to me that we're forgetting the lessons
learned over the last 30 years of software engineering. to make
multiple pages when one (plus a little logic) will do, increases the
cost of maintenance. and maintenance is the most expensive phase of
the life cycle. but that may be a different thread.

thanks for your help.

Ah, but that's why we have Tiles! Seriously, your observation is entirely
valid. A template framework such as Tiles addresses such issues. You use
the same template and only the contained elements need to change. Since
included elements can be defined as optional, you can program your servlet
to include those optional elements only in exceptional circumstances. So
you're back to one display page.
But now you've added another technology to the mix, increasing the
complexity on the development side. Maintenance gets a bit easier,
though.
It gets complicated, doesn't it?

ps. Tiles can be a very powerful addition to your tool kit. Templates can
provide a consistent "look and feel" across an entire website, similar
to what CSS can do for HTML pages.
 
F

Frank

Greg said:
i hear you... it does seem to me that we're forgetting the lessons
learned over the last 30 years of software engineering. to make
multiple pages when one (plus a little logic) will do, increases the
cost of maintenance. and maintenance is the most expensive phase of
the life cycle. but that may be a different thread.

Usually possible to express that logic in your model, though.
Even if it's just setting a simple flag, like the locical OR in that
example upthread?

-Frank
 
S

Steve Sobol

John said:
Or, if your server understands them, a good old "include" directive.

I can't stand include directives. At least not as applied to site templating.
The concept is just simply *broken.*
 
J

John Harlow

Steve said:
I can't stand include directives. At least not as applied to site
templating. The concept is just simply *broken.*

Interesting, why do you say that? It works perfectly for me.
 
S

Sudsy

Greg Smith wrote:
i hear you... it does seem to me that we're forgetting the lessons
learned over the last 30 years of software engineering. to make
multiple pages when one (plus a little logic) will do, increases the
cost of maintenance. and maintenance is the most expensive phase of
the life cycle. but that may be a different thread.

thanks for your help.

Greg,
Based on the number of replies, it may indeed justify a new thread.
Seems that the concept is widespread, albeit with different implementations.
Which, in itself, suggests that there is some merit to the approach...
 
S

Steve Sobol

John said:
Interesting, why do you say that? It works perfectly for me.

Works perfectly for me, too, but it's a kluge, and heaven forbid you should
want to do something other than "include top of page, use jsp to generate
content, include bottom of page".
 
J

John Harlow

I can't stand include directives. At least not as applied to site
Works perfectly for me, too, but it's a kluge, and heaven forbid you
should want to do something other than "include top of page, use jsp
to generate content, include bottom of page".

*shrug* Ok, but not sure why you say it's a "kludge" . It does what it's
intended to do in a very straightforward and intuitive way.

Perhaps I'm biased as the web server I wrote supports constructs like:

<!--includeif "functionReturningABoolean"-->
....some html or an include directive...
<!--else-->
....alternate html...
<!--endincludeif-->
 
B

Ben_

ben,
this is a most reasoned and level response, which i appreciate. surely
thx :)
not all the responses i've received on this topic (mostly outside this
group) have been so. i have posted other responses extending my
position. as i have said elsewhere, i'm not against tags, just the use
of control structures in tags.
I understand this position about 'low' level flow control tags (not sure
it's a correct wording...). As you showed, using conditional taglibs does
not always makes page as nice as one expect. But what if the spec had not
addressed this need and had taken your position ? You'd see dozen of
conditional/iterative taglib implementations here and there. This is what
happened, before JSTL. Hopefully, now, developers I know don't use much of
these outside Struts and JSTL.
alternatively, if JSTL could be defined in such a way that we'd never
see another set of control structures in taglibs, i'd be happy.
It's the purpose of JSTL of federating all taglib efforts in one direction.
So it is likely to evolve, but hopefully to offer much higher level taglibs
than 'if' and 'for' in the flow control area.
although it might be more cumbersome than programming in Java, it
would at least be the last time i would have to relearn control
structures in JSP.
You can see it as a waste of time, or a means to teach your brain by the
examples to refrain from always reinventing the wheel... :)
 
S

Steve Sobol

John said:
*shrug* Ok, but not sure why you say it's a "kludge" . It does what it's
intended to do in a very straightforward and intuitive way.

I guess it's just not transparent enough for me. I like Sitemesh *so* much
better and Sitemesh (since it runs as a filter) can decorate static pages OR
JSPs. It'll apply templates to HTML pages without me having to do anything.
 
D

Darryl L. Pierce

Greg Smith wrote:

<snip about logic tags being in each taglib>

Ummm, I only see it in the logic taglib. Where else do you see it?
Essentially, a taglib is an extension to HTML.

And, as such, lets someone responsible for the HTML part of the project
focus solely on HTML and extensions. They can focus on their area of
expertise.
I feel that having
multiple IF statements weakens the programming environment. Why not
just use Java's IF.

Because you then start muddying the HTML with a *different* language.
Imagine writing C or C++ code and having inline assembler all over the
code. Rather than sticking to one pure system you're now comingling two
separate and disparate languages and have increased the level of complexity
tremendously.

What you're talking about is using scriplets to handle iteration, code flow,
etc. but you're not saying why it's *better*. I'm actually suggesting it's
worse and is one of the reasons why my old signature used to read "Friends
don't let friends use scriplets".
Extending HTML to allow control structures
attempts to make HTML a programming language - which it is not. It is
a markup language.

And those logic tags are also markup language elements.
And a pretty decent one at that. But HTML does
not lend itself well to describing programming constructs, in
particular flow control.

Am I alone in this?

IMO, yes. Mixing Java with HTML is bad mojo. Keep the webpages purely as
markup. I'm not thrilled with having Javascript in, but realize it's a
necessary evil sometimes.

--
/**
* @author Darryl L. Pierce <[email protected]>
* @see The Infobahn Offramp <http://mcpierce.multiply.com>
* @quote "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk
*/
 
D

Darryl L. Pierce

Greg said:
i hear you... it does seem to me that we're forgetting the lessons
learned over the last 30 years of software engineering. to make
multiple pages when one (plus a little logic) will do, increases the
cost of maintenance. and maintenance is the most expensive phase of
the life cycle. but that may be a different thread.

And that's where Tiles comes into the picture. The pages are modularized and
the logic for including the specific piece is in the tiling. Your above
approach would have a very complex algorithm for making one page do
multiply outputs, while Tiles lets you have specific tiles with simpler
logic.

--
/**
* @author Darryl L. Pierce <[email protected]>
* @see The Infobahn Offramp <http://mcpierce.multiply.com>
* @quote "Lobby, lobby, lobby, lobby, lobby, lobby..." - Adrian Monk
*/
 
A

Alex Kay

Greg Smith said:
in our office i recently vented about the constant reintroduction of
the IF/WHILE/FOR/FOREACH tags in <c:> and <x:> and other taglibs.
IMHO, it is a terrible affront to the Java language. We already have
If/While/For/Foreach in Java, adding it to every taglib dilutes the
language.

Essentially, a taglib is an extension to HTML. I feel that having
multiple IF statements weakens the programming environment. Why not
just use Java's IF. Extending HTML to allow control structures
attempts to make HTML a programming language - which it is not. It is
a markup language. And a pretty decent one at that. But HTML does
not lend itself well to describing programming constructs, in
particular flow control.

Am I alone in this?

Hi,

No you're not alone. I also prefer Java for programming and
HTML/CSS/WYSIWYGs for presentation. Let each do what it's best at.

When the world's collide I found it's easier to handle presentation stuff
within Java (after all it's a full-blown language) rather than trying to
smuggle more and more programmatic abilities into a graphics world.

Mind you I do use JSP/JSTL/EL for prototypes and quick and dirty hacks.

Regards.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top