tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Wells <dan_we...@byu.edu>
Subject Major Problem with Tapestry - Please Correct me
Date Fri, 15 Aug 2003 22:54:04 GMT
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. 

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>
<% } %>


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.

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.
-- 
Dan Wells <dan_wells@byu.edu>


Mime
View raw message