You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ken in Nashua <kc...@live.com> on 2012/10/25 05:13:16 UTC

markup question...

Folks,

Ok I implement an if component. And upon condition I render some markup... 

ESCAPE IT...?
CALL JAVA METHOD...?
SPECIFY DIRECT MARKUP ?

i tried each...

                <t:If test="atNewRow">                    
                    </tr><tr>                       <!-- yeilds exception below -->
                </t:If>

or

                <t:If test="atNewRow">                    
                    <\\/tr><tr>                       <!-- yeilds bogus markup &lt;/tr&gt;&lt;tr&gt; -->
                </t:If>


                <t:If test="atNewRow">                    
                    ${newTableRow}                       <!-- yeilds nother exception-->
                </t:If>

If I could have performed this already I would have.

Are there limitations in the framework that are preventing this simple fundamental operation ?

If anyone has a snap dab code snippet solution to this I would love to see it.

Thanks in advance

Ken

---------------- cut here  ---------------- 
org.apache.tapestry5.ioc.internal.OperationExceptionFailure
 parsing template 
classpath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml: 
The element type "t:If" must be terminated by the matching end-tag 
"</t:If>".locationclasspath:org/tynamo/examples/hibernatesecurity/components/Gallery.tml, line 105100-->101						
102					</t:Loop>	<!-- end for loop object-->103					
104				<t:If test="atNewRow">					105					</tr><tr>106				</t:If> 		 	   		  

Re: markup question...

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 25 Oct 2012 01:13:16 -0200, Ken in Nashua <kc...@live.com>  
wrote:

> Folks,

Hi!

> Ok I implement an if component. And upon condition I render some  
> markup...
>
>                 <t:If test="atNewRow">
>                     </tr><tr>                       <!-- yeilds  
> exception below -->
>                 </t:If>

This isn't valid XML, and Tapestry must be valid XML. Why do you need to  
do that? I've never needed to do something like that.

Anyway, your solution is very probably creating a component for doing the  
rendering of the whole table (maybe using another components inside it)  
and render HTML using MarkupWriter instead of templates.

> Are there limitations in the framework that are preventing this simple  
> fundamental operation ?

What you're doing may generate invalid markup, so I don't think it is  
fundamental at al. Tapestry templates are valid XML and generate  
guaranteed XML or HTML (at least regarding to properly opening and closing  
elements).

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: markup question...

Posted by Peter Wendorff <we...@uni-paderborn.de>.
Am 25.10.2012 05:13, schrieb Ken in Nashua:
> Folks,
>
> Ok I implement an if component. And upon condition I render some markup...
>
> ESCAPE IT...?
> CALL JAVA METHOD...?
> SPECIFY DIRECT MARKUP ?
>
> i tried each...
>
>                  <t:If test="atNewRow">
>                      </tr><tr>                       <!-- yeilds exception below -->
>                  </t:If>
This would be correct, if...
Well...
Tapestry is not PHP. It is not assembling text together, but forces to 
maintain correct XML syntax (producing HTML in XML flavor, which is 
correct).
Even Tapestry templates (.tml) are and have to be valid XML.

Your code above is not, and that's why you get, while it's correct not 
to escape markup here, you get the exception.

I'm not sure why you need this "atNewRow" test; you didn't explain what 
you want to do; but to create a table, do it in a corresponding loop and 
keep XML syntax intact.

regards
Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: markup question...

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 25 Oct 2012 01:54:18 -0200, Ken in Nashua <kc...@live.com>  
wrote:

> My table structure should be able to be modeled as such without having  
> to be chased by exceptions that tell me I am failing to terminate.

Yeah, Tapestry is actively preventing preventing you to generate  
improperly nested tags.

-- 
Thiago H. de Paula Figueiredo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: markup question...

Posted by Ken in Nashua <kc...@live.com>.
Thanks Guys...
Helpful advises...
I am just implementing a quarky auto-paging mechanism for my gallery.
I know it might not be religious... but i do want it out of my hair.

I got something going now with the outputraw.,.. and just need to coordinate the counter so the flow of the objects is uniform.

- cheers and thanks

Ken
 		 	   		  

RE: markup question...

Posted by Ken in Nashua <kc...@live.com>.
This is producing better results...

        <table width="100%">
                
            <tr>
            <t:Loop id="foreachrow" source="collection" value="currentObject" index="index"> <!-- begin loop collection -->
                 
                <t:If test="okToRenderItem">
                    
                    <t:Loop id="foreachitem" source="currentObject"> <!-- begin loop object -->
                        <td>
                            <a href="#" model="currentObject">
                                <t:pagelink t:page="Edit" context="editPageContext">     
                                    <t:Any t:id="imageComponentId" id="imageComponentId" >
                                        <img id="transparentTextImageComponentId" 
                                                 model="currentObject"
                                                 src="${photoLink}"
                                                 image="${photoLink}"
                                                 alt="${currentObject}.photo.fileName"
                                                 title="${currentObject}.photo.fileName" 
                                                 width="200" height="160"                         
                                                 
                                                 topLeftText="${currentObject}.transparentText"
                                                 topRightText="topRightText"
                                                 bottomLeftText="bottomleft"
                                                 bottomRightText="bottomright"
                                                 centerText="center"
                                             />
    
                                    </t:Any>
                                </t:pagelink>
                            </a>
                            
                        </td>        
        
                    </t:Loop>    <!-- end for loop object-->
                    
                <t:If test="atNewRow" negate="false">                    
                    <t:OutputRaw value="${newTableRow}"/>
                </t:If>
                
                </t:If>
                    
            </t:Loop>    <!-- end for loop collection-->
                    
            <t:If test="atNewRow" negate="true">                    
                <t:OutputRaw value="${endTableRow}"/>
            </t:If>            
            </tr>
        </table>

but the last <tr> is unwanted and invalid... it dont belong and produces an exception unless I put it there

1 element for first row
3 elements for second row
1 element for second row

so the count is being tripped up

Ok will keep slugging it out....
 		 	   		  

RE: markup question...

Posted by Ken in Nashua <kc...@live.com>.
My table structure should be able to be modeled as such without having to be chased by exceptions that tell me I am failing to terminate.

        <table width="100%">
                
            <tr>
            <t:Loop id="foreachrow" source="collection" value="currentObject" index="index"> <!-- begin loop collection -->
                    
                    <t:Loop id="foreachitem" source="currentObject"> <!-- begin loop object -->
                        <td>
                        </td>        
                        
                    </t:Loop>    <!-- end for loop object-->
                    
                <t:If test="atNewRow" negate="false">                    
                    </tr><tr>
                </t:If>
                    
            </t:Loop>    <!-- end for loop collection-->
                    
            <t:If test="atNewRow" negate="true">                    
                </tr>
            </t:If>            
            
        </table>
 		 	   		  

RE: markup question...

Posted by Ken in Nashua <kc...@live.com>.
If I try to instrument my own markup I get chased down by exceptions stating that I have failed to terminate my tags... and I end up specifying place holder terminator tags to keep the exceptions quiet... while trying to render my own true instrumented tags for the functionality I want to achieve

Does this not defeat the ability to instrument our own markup tags ?
 		 	   		  

RE: markup question...

Posted by Ken in Nashua <kc...@live.com>.
I know folks suggested a format

SUGGESTED INSPIRE FORMAT (but its hardwired to a single column for the whole collection)
<tr>
    looping collection
    <td>
        looping object properties
    </td>
</tr>

and that works fine to render the collection and its objects and properties... for a single column

but I am trying to implement auto-paging... 

a nearby configurable <select> component that specifies number of objects per row... default=3

so I want to iterate 3 objects and 3 <td>

then specify </tr><tr>  a new row

but how can I do this if the markup is hardwired in the above 
SUGGESTED INSPIRE FORMAT format?

so I am left instrumenting the format and counting and outputting the new row at a specific condition and time of the rendering.

and thus far its not apparent how due to the limitations and restrictions...

if I violate the 
SUGGESTED INSPIRE FORMAT the framework is forcing me to keep the tags with exceptions.
if I try to render from the java... well I havent got what I am looking for yet.

I know what I want.

?
 		 	   		  

RE: markup question...

Posted by Ken in Nashua <kc...@live.com>.
Here is whats being rendered in the page source... to give a clue as to the inoperable markup

 <!-- begin loop object -->
    <td colspan="1" rowspan="1">
        <a shape="rect" model="currentObject" href="#">
            <a href="/edit/coach/3">     
                <div id="imageComponentId">
                    <img centerText="center" bottomRightText="bottomright" bottomLeftText="bottomleft" topRightText="topRightText" topLeftText="Person a.transparentText" height="160" width="200" title="Person a.photo.fileName" alt="Person a.photo.fileName" image="/tynamo/blob/person/3/photo" src="/tynamo/blob/person/3/photo" model="currentObject" id="transparentTextImageComponentId"/>

                </div>
            </a>
        </a>
        
    </td>        
    
    <!-- end for loop object-->

                
&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;