struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dakota Jack <dakota.j...@gmail.com>
Subject Re: ajax proj
Date Mon, 02 May 2005 20:01:18 GMT
I thought I would toss in a couple of philosophical points about the
HTML being created in the action.  As we know, the "technologies" of
Servlets and Taglibs essentially mask the fact that HTML is created
other than on the page.  I won't complete all my thinking on that. 
Just tossing that into the mix.  I do think that we should have an
MVC-like architecture but that it really should be expanded to be
clearly something that is compatible with a web structure.  Ted has
provided some good thinking on this, and his offhand remarks about a
web-MVC in fact is the "author" of most of my thinking about web based
architectrues .  Essentially, the "event' like contacts that you find
in desktop MVC is not sensibly available in HTTP contexts.  So, what
you do is try to make sure that each layer is coupled ONLY to the
prior layer and the next layer.  These layers need not be piled but
can have varying sorts of connections, figure eights, loop-a-loops,
etc.  How to do this with the given persistence scopes (request,
session, etc) and the needs to both persist and to kill data carrying
classes, is the trick for the VIEW layer, I think.

The other aspect that is not discussed above is the removal of the
complexity from the "page".  This is where JSP, Taglibs, etc., come
into the picture.  And, I suspect, you two are talking about a
combination of this problem (keeping the page simple) and the previous
problem (using a reasonable architecture).

My thought, then, is this.  The two distinct architectural differences
are very different and should be treated separately..  The later
issues are for efficiency of the human process. They are less
critical, except for the money, of course.  The prior issues are for
efficience of the computer process, and they are absolutely critical. 
Complications in the former are a pain but in the latter are never
bad, if effective.  Make sense?

On 5/2/05, Frank W. Zammetti <fzlists@omnytex.com> wrote:
> Sure! :)
> 
> Basically view the entire server portion as one piece... at the end of
> whatever it is that it does, it's returning HTML (whether it's a complete
> page, as usual, or just a snippet, like with Ajax techniques usually).
> Whether that HTML is written directly to response in an Action or a JSP
> processes (which is writing out to response essentially remember), it's
> the same thing.
> 
> The fifth example in my webapp from the article shows this, albeit very
> simplistically... the Action just constructs a string from the parameters
> submitted, then shoves that string into a request attribute... the then
> forwards to a JSP, which basically does nothing but outputs the string and
> returns the resultant "page" (the page in this case being nothing but the
> string).
> 
> Imagine what the table sorting example would look like with this
> approach... all the outputting of HTML would be removed, we would instead
> do:
> 
> request.setAttribute("sortedPresidentsList", sortedPresidentsList);
> 
> ...and we'd just do a normal forward to some JSP... in the JSP we might do:
> 
> <% ArrayListhm = (ArrayList)request.getAttribute("sortedPresidentsList"); %>
> <table border="1" align="center" cellpadding="2" cellspacing="0">
> <tr>
> <th onClick="retrieveURL('example2RenderTable.do?sortField=firstName');"
> onMouseOver="style.background='#c0c0c0';"
> onMouseOut="style.background='';">First Name</th>
> <th onClick="retrieveURL('example2RenderTable.do?sortField=middleName');"
> onMouseOver="style.background='#c0c0c0';"
> onMouseOut="style.background='';">Middle Name</th>
> <th onClick="retrieveURL('example2RenderTable.do?sortField=lastName');"
> onMouseOver="style.background='#c0c0c0';"
> onMouseOut="style.background='';">Last Name</th>
> <th
> onClick="retrieveURL('example2RenderTable.do?sortField=firstYearInOffice');"
> onMouseOver="style.background='#c0c0c0';"
> onMouseOut="style.background='';">First Year In Office</th>
> <th
> onClick="retrieveURL('example2RenderTable.do?sortField=lastYearInOffice');"
> onMouseOver="style.background='#c0c0c0';"
> onMouseOut="style.background='';">Last Year In Office</th>
> </tr>
> <%
> for (Iterator it = sortedPresidentsList.iterator(); it.hasNext();) {
>   HashMap hm = (HashMap)it.next();
> %>
>   <tr>
>   <td><%=(String)hm.get("firstName")%></td>
>   <td><%=(String)hm.get("middleName")%></td>
>   <td><%=(String)hm.get("lastName")%></td>
>   <td><%=(String)hm.get("firstYearInOffice")%></td>
>   <td><%=(String)hm.get("lastYearInOffice")%></td>
>   </tr>
> <%
> }
> %>
> </table>
> 
> Most people would tend to do with with taglibs, but you get the picture :)
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Mon, May 2, 2005 3:20 pm, Rick Reumann said:
> > Frank W. Zammetti wrote the following on 5/2/2005 2:53 PM:
> >
> >> I think most people would tell you to forward to a JSP to generate what
> >> really amounts to just a snippet of HTML...
> >
> > I'm confused though, you can do that? In other words you can make an
> > XMLHttpRequest from one JSP that goes to an Action and in the Action you
> > can forward to another JSP to write the response and the original JSP
> > that called the XMLHttpRequest somehow pulls this into the innerHTML?
> >
> > Do you have an example of this?
> >
> > I'm looking at your table sort and I don't want all the complex display
> > and write out of the table to take place in a Java class. I'd like to do
> > this in the JSP but not sure how that fits into the Ajax cycle.
> >
> >
> > --
> > Rick
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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


Mime
View raw message