You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Johnson <d_...@cox-internet.com> on 2005/01/23 16:56:13 UTC

Re: What is it mean that "Java code does not belong in well designed JSP pages"?

The intent of JSP is that it is primarily HTML with just enough Java to
make things work.  Ideally, you can hand a JSP to a web designer who is
not a programmer and they can make a pretty web page that works.  In
some shops this works.  As a productivity booster, this works in some
shops.  But in others it is a miserable failure.

With that being said, my _personal_ experience is that programming in
HTML tags is a pain in the <%taglib/>.

I don't have a problem learning another language to do a job - I
regularly use COBOL, Pascal, Java, and SQL in any single project. 
Adding a JSP front end adds JavaScript, a couple of XML namespaces, and
HTML to the mix.

Using taglibs instead of code adds a level of obfuscation that, IMHO, 
makes it difficult to get work done.  I always end up taking the servlet
that was generated from the JSP and rewriting it so it works correctly,
performs adequately, and generates no side effects.

This is a battle that will never be resolved because both sides are
right, depending on the circumstances.

JSP purists will shoot me, but I'll take plain old Java code over HTML
taglibs any day.  Write JSP's in accordance with your shop's standards
and make them work in the time allotted to the task.  Ultimately, your
company pays the bills, so whatever gives your shop the best
productivity is the "right" choice.

On Sun, 2005-01-23 at 09:07, Dola Woolfe wrote:
> 
> I just read this thread and didn't quite understand
> it. If it means what it seems to mean on the surface,
> I'm doing everything wrong.
> 
> Schematically, my typical JSP page looks like the
> following (basically 100% code). Is this what Craig is
> advising against?
> 
> <%@ page errorPage="ErrorPage.jsp" import="html.*"%>
> <%@include file="InitializePage.jsp"%>
> <%
>     Table table = new Table()
>     .pAddH("#").pAddH("Action").pLN()
>     .pAddC("1").pAddL(new Anchor("HelloPage.jsp", "Say
> hello to my friend.")).pLN()
>     .pAddC("2").pAddL(new Anchor("GoodByePage.jsp",
> "Say good bye to my friend")).pLN()
> ;
> 
>     MyTemplate template = new MyTemplate ("Main
> Actions", table);
>     Page pAgE = new Page(new MyHead("Data Tools"), new
> Body(template));
> %>
> 
> <%= pAgE %>
> 
> 
> 		
> __________________________________ 
> Do you Yahoo!? 
> Read only the mail you want - Yahoo! Mail SpamGuard. 
> http://promotions.yahoo.com/new_mail 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: What is it mean that "Java code does not belong in well designed JSP pages"?

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
David Johnson wrote:
> Using taglibs instead of code adds a level of obfuscation that, IMHO, 
> makes it difficult to get work done.  I always end up taking the servlet
> that was generated from the JSP and rewriting it so it works correctly,
> performs adequately, and generates no side effects.

This has always been my biggest problems with taglibs too, that and the 
fact that it's yet something else a new developer coming on to a project 
has to learn before they can be effective (or at least optimally 
effective).  I prefer all the code being right there in front of me, not 
having to go hunt down source somewhere.

Additionally, I don't like having to recompile a class to make a change 
and then redeploy the class (or worse yet, the whole app).  If it's just 
in a JSP, I can update the app on-the-fly (assuming JSP compilation is 
still active).

That being said, I actually like the idea of Tag Files.  It's not quite 
as bad, it's no worse than a JSP include, although the point about more 
to learn still stands.  But, then it's just usual JSP code, which they 
would already know, so it's still not quite as bad in that regard 
either.  It's kind of amazing that a lot of people don't even know about 
that capability.

Like you said though, what works in one environment may not work in 
another, and taking a hard stand either way is a bad idea.  Heck, I've 
used taglibs on plenty of occasions and it's worked out beautifully. 
Right tool for the job and all that jazz, right?!?

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org