You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael <mo...@speakeasy.net> on 2002/02/12 04:34:25 UTC

help: <%>.. how do i convince them to learn JSP?

long before server pages or servlets existed i was
writing these C++ template based systems with CGI
so i could do my best to separate content generation from programming
logic...

i'm a consultant and this company made me lead on my first JSP/Servlet based
project,
i was really excited to get involved with JSP tag libraries.

but when i got into the code base IT'S ALL .jsp files with
TONS of Java scriptlets!  it's nasty.  if/else blocks several hundred lines
long.
the developer i took this over from
thinks there is no reason to do it any other way.  tags?  why use tags?

i am asking for input/references on why you want to keep the scriptlets <%>
</%>
out of the JSP files.  every time i try to make a point-- maybe
i'm just not being eloquent enough...

on another note: is it really model 2 if a JSP is processing the request?
i don't think it is, even if your entire JSP is just some java code
wrapped with a scriptlet tag..  (yuk).

thanks for input.
--Michael







--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: help: <%>.. how do i convince them to learn JSP?

Posted by Borislav Iordanov <bo...@kobrix.com>.
Your problem is quite more general than JSP/tags/CGI/etc. - how do you teach a
programmer things like good style and code/design/structure esthetics? It is
incredibly hard, especially when dealing with "just get it working" type of
people. The main benefit from tag libraries and the MVC approach in JSP comes
from the separation of concerns (business logic and UI) which leads to an easier
separation of work among hard core developers and UI/scripting people. Ideally,
people doing the UI shouldn't need to know Java. However, in your case you
probably have the same person assuming all the different roles of business logic
developer, UI developer and WEB designer. So for him/her, that argument is
probably invalid. That's why you will simply have to make them realize that code
is plain ugly. And ugly code is the hardest to read and maintain. Besides the
above mentionned advantage of tag libraries, they are better for example also for
the following reasons:

- they provide a clean and powerful means of abstraction that applies well within
the domain of WEB development
- being XML-based, their syntax fits well with the rest of technologies used in
the WEB. And this is no minor point - syntax in any sort of programming construct
has a huge impact on readability, maintainability, ease of use, learning curve
for newbies etc....
- when well written, tag libraries can provide a kind of mini-declarative
language with powerful, targetted semantics
- at the end, they make code much shorter. They make it possible to say more
concisely and clearly what you want at that particular place of your page, in a
declarative way...

So, even when you are looking at a JSP page purely from a programmer's point of
view, and if you have been thaught a thing or two about programming, the benefits
of building and using tag libraries should be more or less obvious.

As for your "another note", it depends how your whole application is
structured....a JSP is a servlet after all so if your particular JSP, which has
only Java code in it,  is acting as a "controller" in the model 2 architecture,
then yes it's still model 2 ;)

Cheers,
Boris

Michael wrote:

> long before server pages or servlets existed i was
> writing these C++ template based systems with CGI
> so i could do my best to separate content generation from programming
> logic...
>
> i'm a consultant and this company made me lead on my first JSP/Servlet based
> project,
> i was really excited to get involved with JSP tag libraries.
>
> but when i got into the code base IT'S ALL .jsp files with
> TONS of Java scriptlets!  it's nasty.  if/else blocks several hundred lines
> long.
> the developer i took this over from
> thinks there is no reason to do it any other way.  tags?  why use tags?
>
> i am asking for input/references on why you want to keep the scriptlets <%>
> </%>
> out of the JSP files.  every time i try to make a point-- maybe
> i'm just not being eloquent enough...
>
> on another note: is it really model 2 if a JSP is processing the request?
> i don't think it is, even if your entire JSP is just some java code
> wrapped with a scriptlet tag..  (yuk).
>
> thanks for input.
> --Michael
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: help: <%>.. how do i convince them to learn JSP?

Posted by Stephen Pride <mh...@yahoo.com>.
Simple: Code reuse and maintenance.

Why duplicate Java code in multiple places, when all
you need is a tag that has the code written one time?

And maintenance couldn't be easier.  Having to update
x-number of files, when all you need to do is update
one file.

Regards,
Steve

--- Michael <mo...@speakeasy.net> wrote:
> long before server pages or servlets existed i was
> writing these C++ template based systems with CGI
> so i could do my best to separate content generation
> from programming
> logic...
> 
> i'm a consultant and this company made me lead on my
> first JSP/Servlet based
> project,
> i was really excited to get involved with JSP tag
> libraries.
> 
> but when i got into the code base IT'S ALL .jsp
> files with
> TONS of Java scriptlets!  it's nasty.  if/else
> blocks several hundred lines
> long.
> the developer i took this over from
> thinks there is no reason to do it any other way. 
> tags?  why use tags?
> 
> i am asking for input/references on why you want to
> keep the scriptlets <%>
> </%>
> out of the JSP files.  every time i try to make a
> point-- maybe
> i'm just not being eloquent enough...
> 
> on another note: is it really model 2 if a JSP is
> processing the request?
> i don't think it is, even if your entire JSP is just
> some java code
> wrapped with a scriptlet tag..  (yuk).
> 
> thanks for input.
> --Michael
> 
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: help: <%>.. how do i convince them to learn JSP?

Posted by stf <s....@vierundsechzig.de>.
I think it depends on, what you're trying to achieve: If i remember it
corrctly, the tags inside the jsp get inlined when the jsp is compiled: So
the performance problem boils down to a problem of objectcreation
and -deletion, which nowadays is handled quite  good by most modern jvm. If
you want to fetch labels from property-files, then the properties are cached
in a per-jvm manner. If you really run into performance issues, i don't
think they come from using taglibs but from the requirement to mix-in the
labels dynamically (maybe to perform internationaliation or - even worse -
based on user-rights or preferences): So maybe you should try to think of
some sort of pre-processing (generating templates with the right labels in
it and then using a simple template-engine or maybe even simple
bean-tags(<%=..%>) to populate the pages.

And maybe you should have someeone think about the requirement for exposing
ten thousands of users to 50 -100 elements on just one page - has to be a
very special audience...;)
----- Original Message -----
From: "Bob Williams" <rj...@compuserve.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Tuesday, February 12, 2002 4:05 PM
Subject: Re: help: <%>.. how do i convince them to learn JSP?


> I have no problem being convinced that tags should be used for generating
> complex items on a web page.  The one concern I do have, relative to using
> tags, is the extra processing required to generate simple things.  I have
> seen pages in industrial environments where the page may have 50-100
> elements displayed (and no this is not a problem with the design this is a
> real application requirement!).  Using a tag to generate labels and text
> input boxes seems like it would add a significant compute load on a server
> that is servicing 100's of people.  The same situation applies when you
are
> dealing with pages with fewer elements, but are being served up to 1000's
or
> 10,000's of users.
>
> Does anyone have experience about computing resources required by tags in
> these types of scenarios?
>
> bob
> ----- Original Message -----
> From: "Sarah Farrell" <sf...@mindspring.com>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Monday, February 11, 2002 9:48 PM
> Subject: Re: help: <%>.. how do i convince them to learn JSP?
>
>
> >
> > Michael,
> >
> > Here's the best one I could find.
> >
>
http://java.sun.com/blueprints/guidelines/designing_enterprise_applications/
> > web_tier/qanda/index.html
> >
> > There are some other ones on java.sun.com if you search for "JSP
> presentation
> > logic separate".
> >
> > Here's another one:
> > http://java.sun.com/products/jsp/
> >
> >
> >
> > P.S. Please don't cross-post to multiple jakarta lists.
> >
> >
> >
> > At 07:34 PM 2/11/2002 -0800, you wrote:
> > >long before server pages or servlets existed i was
> > >writing these C++ template based systems with CGI
> > >so i could do my best to separate content generation from programming
> > >logic...
> > >
> > >i'm a consultant and this company made me lead on my first JSP/Servlet
> based
> > >project,
> > >i was really excited to get involved with JSP tag libraries.
> > >
> > >but when i got into the code base IT'S ALL .jsp files with
> > >TONS of Java scriptlets!  it's nasty.  if/else blocks several hundred
> lines
> > >long.
> > >the developer i took this over from
> > >thinks there is no reason to do it any other way.  tags?  why use tags?
> > >
> > >i am asking for input/references on why you want to keep the scriptlets
> <%>
> > ></%>
> > >out of the JSP files.  every time i try to make a point-- maybe
> > >i'm just not being eloquent enough...
> > >
> > >on another note: is it really model 2 if a JSP is processing the
request?
> > >i don't think it is, even if your entire JSP is just some java code
> > >wrapped with a scriptlet tag..  (yuk).
> > >
> > >thanks for input.
> > >--Michael
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > >For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: help: <%>.. how do i convince them to learn JSP?

Posted by Arron Bates <ar...@pacific.net.au>.
Just finished rolling a "100 input elements on a page" app. Performance 
is not an issue. Once the JSP is compiled to its class, it just hums 
along very happily.

Arron.

Bob Williams wrote:

>I have no problem being convinced that tags should be used for generating
>complex items on a web page.  The one concern I do have, relative to using
>tags, is the extra processing required to generate simple things.  I have
>seen pages in industrial environments where the page may have 50-100
>elements displayed (and no this is not a problem with the design this is a
>real application requirement!).  Using a tag to generate labels and text
>input boxes seems like it would add a significant compute load on a server
>that is servicing 100's of people.  The same situation applies when you are
>dealing with pages with fewer elements, but are being served up to 1000's or
>10,000's of users.
>
>Does anyone have experience about computing resources required by tags in
>these types of scenarios?
>
>bob
>----- Original Message -----
>From: "Sarah Farrell" <sf...@mindspring.com>
>To: "Struts Users Mailing List" <st...@jakarta.apache.org>
>Sent: Monday, February 11, 2002 9:48 PM
>Subject: Re: help: <%>.. how do i convince them to learn JSP?
>
>
>>Michael,
>>
>>Here's the best one I could find.
>>
>http://java.sun.com/blueprints/guidelines/designing_enterprise_applications/
>
>>web_tier/qanda/index.html
>>
>>There are some other ones on java.sun.com if you search for "JSP
>>
>presentation
>
>>logic separate".
>>
>>Here's another one:
>>http://java.sun.com/products/jsp/
>>
>>
>>
>>P.S. Please don't cross-post to multiple jakarta lists.
>>
>>
>>
>>At 07:34 PM 2/11/2002 -0800, you wrote:
>>
>>>long before server pages or servlets existed i was
>>>writing these C++ template based systems with CGI
>>>so i could do my best to separate content generation from programming
>>>logic...
>>>
>>>i'm a consultant and this company made me lead on my first JSP/Servlet
>>>
>based
>
>>>project,
>>>i was really excited to get involved with JSP tag libraries.
>>>
>>>but when i got into the code base IT'S ALL .jsp files with
>>>TONS of Java scriptlets!  it's nasty.  if/else blocks several hundred
>>>
>lines
>
>>>long.
>>>the developer i took this over from
>>>thinks there is no reason to do it any other way.  tags?  why use tags?
>>>
>>>i am asking for input/references on why you want to keep the scriptlets
>>>
><%>
>
>>></%>
>>>out of the JSP files.  every time i try to make a point-- maybe
>>>i'm just not being eloquent enough...
>>>
>>>on another note: is it really model 2 if a JSP is processing the request?
>>>i don't think it is, even if your entire JSP is just some java code
>>>wrapped with a scriptlet tag..  (yuk).
>>>
>>>thanks for input.
>>>--Michael
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>>
><ma...@jakarta.apache.org>
>
>>>For additional commands, e-mail:
>>>
><ma...@jakarta.apache.org>
>
>>
>>--
>>To unsubscribe, e-mail:
>>
><ma...@jakarta.apache.org>
>
>>For additional commands, e-mail:
>>
><ma...@jakarta.apache.org>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: help: <%>.. how do i convince them to learn JSP?

Posted by Bob Williams <rj...@compuserve.com>.
I have no problem being convinced that tags should be used for generating
complex items on a web page.  The one concern I do have, relative to using
tags, is the extra processing required to generate simple things.  I have
seen pages in industrial environments where the page may have 50-100
elements displayed (and no this is not a problem with the design this is a
real application requirement!).  Using a tag to generate labels and text
input boxes seems like it would add a significant compute load on a server
that is servicing 100's of people.  The same situation applies when you are
dealing with pages with fewer elements, but are being served up to 1000's or
10,000's of users.

Does anyone have experience about computing resources required by tags in
these types of scenarios?

bob
----- Original Message -----
From: "Sarah Farrell" <sf...@mindspring.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, February 11, 2002 9:48 PM
Subject: Re: help: <%>.. how do i convince them to learn JSP?


>
> Michael,
>
> Here's the best one I could find.
>
http://java.sun.com/blueprints/guidelines/designing_enterprise_applications/
> web_tier/qanda/index.html
>
> There are some other ones on java.sun.com if you search for "JSP
presentation
> logic separate".
>
> Here's another one:
> http://java.sun.com/products/jsp/
>
>
>
> P.S. Please don't cross-post to multiple jakarta lists.
>
>
>
> At 07:34 PM 2/11/2002 -0800, you wrote:
> >long before server pages or servlets existed i was
> >writing these C++ template based systems with CGI
> >so i could do my best to separate content generation from programming
> >logic...
> >
> >i'm a consultant and this company made me lead on my first JSP/Servlet
based
> >project,
> >i was really excited to get involved with JSP tag libraries.
> >
> >but when i got into the code base IT'S ALL .jsp files with
> >TONS of Java scriptlets!  it's nasty.  if/else blocks several hundred
lines
> >long.
> >the developer i took this over from
> >thinks there is no reason to do it any other way.  tags?  why use tags?
> >
> >i am asking for input/references on why you want to keep the scriptlets
<%>
> ></%>
> >out of the JSP files.  every time i try to make a point-- maybe
> >i'm just not being eloquent enough...
> >
> >on another note: is it really model 2 if a JSP is processing the request?
> >i don't think it is, even if your entire JSP is just some java code
> >wrapped with a scriptlet tag..  (yuk).
> >
> >thanks for input.
> >--Michael
> >
> >
> >
> >
> >
> >
> >
> >--
> >To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> >For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: help: <%>.. how do i convince them to learn JSP?

Posted by Sarah Farrell <sf...@mindspring.com>.
Michael,

Here's the best one I could find.
http://java.sun.com/blueprints/guidelines/designing_enterprise_applications/
web_tier/qanda/index.html

There are some other ones on java.sun.com if you search for "JSP presentation
logic separate".

Here's another one:
http://java.sun.com/products/jsp/



P.S. Please don't cross-post to multiple jakarta lists.



At 07:34 PM 2/11/2002 -0800, you wrote:
>long before server pages or servlets existed i was
>writing these C++ template based systems with CGI
>so i could do my best to separate content generation from programming
>logic...
>
>i'm a consultant and this company made me lead on my first JSP/Servlet based
>project,
>i was really excited to get involved with JSP tag libraries.
>
>but when i got into the code base IT'S ALL .jsp files with
>TONS of Java scriptlets!  it's nasty.  if/else blocks several hundred lines
>long.
>the developer i took this over from
>thinks there is no reason to do it any other way.  tags?  why use tags?
>
>i am asking for input/references on why you want to keep the scriptlets <%>
></%>
>out of the JSP files.  every time i try to make a point-- maybe
>i'm just not being eloquent enough...
>
>on another note: is it really model 2 if a JSP is processing the request?
>i don't think it is, even if your entire JSP is just some java code
>wrapped with a scriptlet tag..  (yuk).
>
>thanks for input.
>--Michael
>
>
>
>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>