tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Wells <dan_we...@byu.edu>
Subject RE: Major Problem with Tapestry - Please Correct me
Date Mon, 18 Aug 2003 14:20:31 GMT
Thank you Mr. Ship for your help with my questions.  I'm glad you liked
my subject line. If you were being sarcastic then let me apologize for
having offended you somehow - it has not been my intention.  I'll try to
do better in the future.

I now see how to do this, and I agree with your view.  Also, I agree
with Mr. Marco that the logic should go in the java code.  You were
right, I need to think in the right paradigm (objects, etc.).  I'm
coming from an ASP paradigm, so I still have some bad habits I'm trying
to fix.

In response to the thread with subject title "Tapestry Rant and
suggestions, I do believe we should certainly search more ourselves for
our own answers, as I have tried to do - not always with success.  I apologize for having
mentioned my inexperience, but I'm pretty new to web development
alltogether.  I have done a couple of ASP apps, and this last year I
have been learning Java  (the language) and the various J2EE
technologies (JSP, Servlets, EJB, etc.).  Let me say I like it a lot
better than ASP, VB, COBOL, and other technologies I've had to mess
with.

I admit some of my questions, after finding the solution myself, have
been unworthy of posting.  So I don't mind that they were ignored.

Thanks for all,

Dan Wells



On Fri, 2003-08-15 at 18:23, Howard M. Lewis Ship wrote:
> Ooh yeah baby, great subject line, that's the way to get some help.
> 
> 
> > 
> > Tapestry does not render the tags in which you embed your 
> > jwcid attribute.  Tapestry also requires the template be 
> > syntactically correct as far as XML/HTML tags go, BEFORE it 
> > parses and renders. 
> 
> Tapestry HTML templates must be reasonably valid HTML documents.  Its very, very loose,
but requires
> that tags nest validly.
> 
> 
> > 
> > I have some HTML with parts being dynamically altered based 
> > on certain conditions.  To achieve it in JSP, it was super 
> > easy.  To achieve it in Tapestry, it was kind of a pain.  
> > Please correct me if I error.
> > 
> > I have a component with an HTML table.  In the table, there 
> > is a ValidField, which becomes part of a form on a containing 
> > page.  I want the table, with color and other formatting, to 
> > not be rendered if a parameter of this component is set to 
> > false.  If the parameter is true, the table will be rendered. 
> >  There is a good reason for this, but that is a long story.
> > 
> > Here is the simplified code in JSP:
> > 
> > <%
> >    if (...) {
> > %>
> > 
> >        <table ...>
> >          <tr ...>
> >            <th><b>Enter a Title</b></th>
> >          </tr>
> >          <tr ...>
> >            <td ...>
> > <% } %>
> >                 <input type="text" jwcid="title" />
> > <%
> >     if (...){
> > %>
> >                 (Example: Math 110 Sections 2 &amp; 3 Fall 2002)
> > 
> >              </td>
> >            </tr>
> >        </table>
> > <% } %>
> > 
> > 
> 
> My eyes!  My eyes!
> 
> 
> > Here is the code in Tapestry:
> > 
> > <span jwcid="@Conditional" condition="ognl:format">
> > 
> >        <table ...>
> >          <tr...>
> >            <th><b>Enter a Title</b></th>
> >            </tr>
> >            <tr...>
> >              <td ...>
> > 
> >                 <input type="text" jwcid="titleInBody" />
> > 
> >                 (Example: Math 110 Sections 2 &amp; 3 Fall 2002)
> > 
> >              </td>
> >            </tr>
> >        </table>
> >        
> > </span>
> > 
> > <span jwcid="@Conditional" condition="ognl: ! format">
> > 
> >    <input type="text" jwcid="title" />
> > 
> > </span>
> > 
> > 
> > This doesn't seem a BIG deal in this example, but it becomes 
> > a big deal in some of the more advanced presentation logic 
> > I've done.  Especially since I had to create another 
> > component element int the .jwc file because you can't 
> > duplicate your component ids.  I also have another file where 
> > I just want to place bold tags around a phrase based on a 
> > condition.  It seems a little painful to have to write the 
> > phrase twice surrounded with opposing conditions, especially 
> > when that phrase is large, and there are many of them.
> 
> You are thinking too much in terms of text processing, not of objects.
> 
> In terms of wrapping some content in bold .... well, let's rethink that.  How about chosing
between:
> 
> <span class="important"> some content </span>
> 
> and
> 
> <span> some content </span>
> 
> That's easy enough:
> 
> <span jwcid="@Any" class="ognl: important ? 'important' : null"> some content </span>
> 
> In other words, render a <span> tag and set the class based on the important property
of the page.
> 
> If the <span> itself bothers you, you can write a custom component in a few lines.
> 
> Your other problem, where you want to conditionally wrap you TextField inside a table
or not is a
> problem with Tapestry.
> 
> In the page specification, you can use the copy-of attribute on <component> to
copy the type and
> bindings of another component (also defined in the spec).  That makes it pretty easy
to duplicate
> the TextField for your purposes.
> 
> 
> > 
> > I have so far really enjoyed learning Tapestry, but this 
> > seems a problem.  I hope I have just missed something... I 
> > hope there is a better way.  If anyone knows it, please, 
> > please tell me.
> 
> Every framework will have its own set of choices; in Tapestry, the desire to validate
HTML templates
> for consistency outwieghed any desire to support mangled HTML like your JSP example.
> 
> 
> 
> > -- 
> > Dan Wells <dan_wells@byu.edu>
> > 
> > 
> > --
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> > 
> 
> 
> --
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
Dan Wells <dan_wells@byu.edu>


Mime
View raw message