tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Parsons Technical Services" <parsonstechni...@earthlink.net>
Subject Re: What is it mean that "Java code does not belong in well designed JSP pages"?
Date Sun, 23 Jan 2005 19:32:11 GMT
Don't ask to see my code. All I know is it works....  most of the time.

Really, I think it is a matter of circumstance. Each case is different and 
allows for sway from one extreme to the other.

One word of caution to people just learning, is that as you move from 
company to company expect to see a wide variety of philosophy about how 
something is done. So it is wise to understand each approach and it's pros 
and cons. I work for myself and I am still trying to understand the approach 
here.

So what you will most likely find is that people will take the most direct 
path that the environment and knowledge will allow. Of course there are 
always the exceptions.

Dola don't get too tied up in "proper" approaches as much as understanding 
the whys and why not to do it that way. As you code things you will always 
see a different or better way after you are almost done.

Doug


----- Original Message ----- 
From: "Frank W. Zammetti" <fzlists@omnytex.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Sunday, January 23, 2005 1:22 PM
Subject: Re: What is it mean that "Java code does not belong in well 
designed JSP pages"?


> That's a good point Tim... I have to admit I've only used methods a couple 
> of times in JSPs, generally preferring all the code be inline (except 
> where there would be a lot of duplication, then I tend to make utility 
> classes).  You make a good point though, I may start getting into that 
> habit myself :)
>
> -- 
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
>
> Tim Funk wrote:
>> Essentially you have written a servlet but packaged it as a JSP. Anytime 
>> it becomes a trivial effort to hand transform a JSP into a servlet 
>> usually means some refactoring is in order.
>>
>> Personally I do not mind java code in JSP's but only if its structured. I 
>> try not to rely on in-line java code - but I try to use methods or inner 
>> classes for most java coding in a JSP. By doing that - it becomes easier 
>> to rip the methods and inner classes from the JPS page and into an 
>> independent object. By doing this - I get rapid turnaround - but don't 
>> code myself in a hole for when new functionality might be needed that 
>> might overlap existing pages.
>>
>> -Tim
>>
>> 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
>>
>>
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message