You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dirk Storck <Di...@cms.tecmath.de> on 2002/03/07 11:52:13 UTC

problems with doing a Titles Invoice example

Hi,

I try to do a example like the tiles invoice example by my own

My first page looks like the following snippet:

<pg:pager maxPageItems="<%= 5 %>">
    <pg:param name="pagerRequest" value="true"/>
    <table cellpadding="0" cellspacing="0" border="0">
        <tr><td>&nbsp;</td></tr>
        <logic:iterate id="article" name="articleListBean"
property="articles">
        <pg:item>
            <tiles:insert page="productShortView.jsp" >
	    <tiles:put name="article" beanName="article"/>
	  </tiles:insert>
        </pg:item>
        </logic:iterate>
    </table>

  <pg:index>
.
.
.

The productShortView.jsp looks like the next snippet:

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>

<tiles:importAttribute name="article" />
<tr>
            <td>
                <table width="100%" border="0" cellspacing="1"
cellpadding="0"><!--Tabelle Suchergebniss-->
                    <tr>
                        <td width="100" align="left">
                            <logic:present name="article" property="content"
>
                                <bean:define name="article"
property="content" id="content"
type="com.tecmath.cms.mt.valueobjects.ContentVO"/>
                                <logic:notEqual name="content"
property="previewFile" value="">
                                    <html:link page='<%=
"/essence/"+content.getPreviewFile() %>'>
                                        <logic:notEqual name="content"
property="thumbnailFile" value="">
                                            <html:img page='<%=
"/essence/"+content.getThumbnailFile() %>' width="88" border="0"
alt="keyframe" />
                                        </logic:notEqual>
                                    </html:link>
                                </logic:notEqual>
                           </logic:present>
                        </td>
                        <td width="80"  align="left" class="smallbtext"
valign="top">
                            <bean:message key="article.title" />:<br />
                            <bean:message key="search.term.department"
/>:<br />
                            <bean:message key="search.term.length" />:<br />
                            <bean:message key="search.term.date" />:<br />
                        </td>
                        <td width="500" align="left" class="smalltext"
valign="top">
                            <html:link page="/ArticleDetails.jsp"
                                paramId="articleId"
                                paramName="article"
                                paramProperty="id">
                                <bean:write name="article"
property="title"/>
                            </html:link><br />
                            <bean:write name="article"
property="department"/>
                            <br />
                            <bean:write name="article"
property="length"/>&nbsp;<bean:message key="search.term.clip" />: 00:00:00 -
00:00:28<br />
                            <bean:write name="article"
property="dateOfPublication"/>
                        </td>
                        <%--
                        <td class="smallbtext" valign="top">
                         <bean:message key="cart.price" />:
                        </td>
                        <td align="left" class="smalltext" valign="top">
                            <logic:empty name="article"
property="targetPrice" >
                                <bean:write name="article"
property="currency" />
                            </logic:empty>
                            <logic:notEmpty  name="article"
property="targetPrice">
                                <bean:write name="article"
property="currency" /><br /><bean:write name="article"
property="targetCurrency" />
                            </logic:notEmpty>
                        </td>
                        <td align="right" class="smalltext" valign="top">
                            <logic:empty name="article"
property="targetPrice" >
                                <bean:write name="article" property="price"
/>
                            </logic:empty>
                            <logic:notEmpty  name="article"
property="targetPrice">
                                <bean:write name="article" property="price"
/><br /><bean:write name="article" property="targetPrice" />
                            </logic:notEmpty>
                        </td>
                        --%>
                        <td width="15" valign="top" align="right"
rowspan="3">&nbsp;</td>
                        <td width="32" valign="top" align="right"
rowspan="3">

                            <html:link page="/ArticleDetails.jsp"
                            paramId="articleId"
                            paramName="article"
                            paramProperty="id">
                            <img alt="Detailansicht"
SRC="/iwf/graphics/detailsmall.gif" border="0" />
                            </html:link>
                            <br />&nbsp;<br />

                    	    <html:link page="/addToCart.do" paramId="articleId"
paramName="article" paramProperty="id">
                                <img name="tocart6" alt="<bean:message
key="cart.add" />" SRC="/iwf/graphics/cart.gif" border="0">
                    	    </html:link>

                            <br />&nbsp;<br />
                            <%--
                            <a href="#"><img alt="Zu Favoriten"
SRC="/iwf/graphics/favourite.gif" border="0" /></a>
--%>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3" class="smalltext">
                            <br />
                        </td>
                        <td colspan="2" align="left" class="smallbtext"
valign="top"> <bean:message key="search.lizenzampel" />: </td>
                        <td valign="top"><img src="/iwf/graphics/ampel.gif"
alt="Lizenzampel" /></td>
                    </tr>
                    <tr>
                        <td colspan="3" class="smallbtext">
                            <br /><bean:message key="search.averagerating"
/>:
                            <img src="/iwf/graphics/sterne_4_5.gif" alt="4,5
Sterne" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <html:link page="/ShowArticleRating.jsp"
                                paramId="articleID"
                                paramName="article"
                                paramProperty="id">
                                <bean:message key="article.rating" />
                            </html:link>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

                            <html:link page="/ArticleDetails.jsp"
                            paramId="articleId"
                            paramName="article"
                            paramProperty="id">
                            <bean:message key="search.phrase.details" />
                            </html:link>
                        </td>
                        <td colspan="3" class="smallbtext" valign="bottom">

                            <logic:present name="article" property="content"
>
                                <bean:define name="article"
property="content" id="content"
type="com.tecmath.cms.mt.valueobjects.ContentVO"/>
                                <logic:notEqual name="content"
property="previewFile" value="">
                                    <bean:message key="search.term.preview"
/> in: <br />
                                    <html:link page='<%=
"/essence/"+content.getPreviewFile() %>'>
                                        <logic:notEqual name="content"
property="thumbnailFile" value="">
                                            <img
src="/iwf/graphics/real_16x16.gif" alt="RealPlayer" border="0" />
                                        </logic:notEqual>
                                    </html:link>
                                </logic:notEqual>
                            </logic:present>
                        </td>
                    </tr>
                    <tr><td colspan="8"><hr class="hline"></td></tr>
                </table><!--Tabelle Suchergebniss Ende-->
            </td>
        </tr>


IF I execute my first page I get the following error :
Can't insert page 'productShortView.jsp' : Illegal to flush within a custom
tag

CAN someone please tell me what I am doing wrong ?

MANY thanks any any suggestions are welcome !



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problems with doing a Titles Invoice example

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  Hello,

  It is a problem with custom tags implementing "BodyTag" interface in jsp 1.1 : it
is not possible to do a flush inside such tag.
  In your example, <logic:iterate ...> (or <pg:item> ?) implement BodyTag, and
<tiles:insert ...> do an include which automatically do a flush (even if you
specify flush="false").

  Your construct should be possible with jsp1.2 (try with Tomcat4), but I think
that <logic:iterate > need to be reimplemented to use new Tag support.
  A workaround is to write the iterate loop as a scriptlet ;-(

    Cedric


Dirk Storck wrote:

> Hi,
>
> I try to do a example like the tiles invoice example by my own
>
> My first page looks like the following snippet:
>
> <pg:pager maxPageItems="<%= 5 %>">
>     <pg:param name="pagerRequest" value="true"/>
>     <table cellpadding="0" cellspacing="0" border="0">
>         <tr><td>&nbsp;</td></tr>
>         <logic:iterate id="article" name="articleListBean"
> property="articles">
>         <pg:item>
>             <tiles:insert page="productShortView.jsp" >
>             <tiles:put name="article" beanName="article"/>
>           </tiles:insert>
>         </pg:item>
>         </logic:iterate>
>     </table>
>
>   <pg:index>
> .
> .
> .
>
> The productShortView.jsp looks like the next snippet:
>
> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
>
> <tiles:importAttribute name="article" />
> <tr>
>             <td>
>                 <table width="100%" border="0" cellspacing="1"
> cellpadding="0"><!--Tabelle Suchergebniss-->
>                     <tr>
>                         <td width="100" align="left">
>                             <logic:present name="article" property="content"
> >
>                                 <bean:define name="article"
> property="content" id="content"
> type="com.tecmath.cms.mt.valueobjects.ContentVO"/>
>                                 <logic:notEqual name="content"
> property="previewFile" value="">
>                                     <html:link page='<%=
> "/essence/"+content.getPreviewFile() %>'>
>                                         <logic:notEqual name="content"
> property="thumbnailFile" value="">
>                                             <html:img page='<%=
> "/essence/"+content.getThumbnailFile() %>' width="88" border="0"
> alt="keyframe" />
>                                         </logic:notEqual>
>                                     </html:link>
>                                 </logic:notEqual>
>                            </logic:present>
>                         </td>
>                         <td width="80"  align="left" class="smallbtext"
> valign="top">
>                             <bean:message key="article.title" />:<br />
>                             <bean:message key="search.term.department"
> />:<br />
>                             <bean:message key="search.term.length" />:<br />
>                             <bean:message key="search.term.date" />:<br />
>                         </td>
>                         <td width="500" align="left" class="smalltext"
> valign="top">
>                             <html:link page="/ArticleDetails.jsp"
>                                 paramId="articleId"
>                                 paramName="article"
>                                 paramProperty="id">
>                                 <bean:write name="article"
> property="title"/>
>                             </html:link><br />
>                             <bean:write name="article"
> property="department"/>
>                             <br />
>                             <bean:write name="article"
> property="length"/>&nbsp;<bean:message key="search.term.clip" />: 00:00:00 -
> 00:00:28<br />
>                             <bean:write name="article"
> property="dateOfPublication"/>
>                         </td>
>                         <%--
>                         <td class="smallbtext" valign="top">
>                          <bean:message key="cart.price" />:
>                         </td>
>                         <td align="left" class="smalltext" valign="top">
>                             <logic:empty name="article"
> property="targetPrice" >
>                                 <bean:write name="article"
> property="currency" />
>                             </logic:empty>
>                             <logic:notEmpty  name="article"
> property="targetPrice">
>                                 <bean:write name="article"
> property="currency" /><br /><bean:write name="article"
> property="targetCurrency" />
>                             </logic:notEmpty>
>                         </td>
>                         <td align="right" class="smalltext" valign="top">
>                             <logic:empty name="article"
> property="targetPrice" >
>                                 <bean:write name="article" property="price"
> />
>                             </logic:empty>
>                             <logic:notEmpty  name="article"
> property="targetPrice">
>                                 <bean:write name="article" property="price"
> /><br /><bean:write name="article" property="targetPrice" />
>                             </logic:notEmpty>
>                         </td>
>                         --%>
>                         <td width="15" valign="top" align="right"
> rowspan="3">&nbsp;</td>
>                         <td width="32" valign="top" align="right"
> rowspan="3">
>
>                             <html:link page="/ArticleDetails.jsp"
>                             paramId="articleId"
>                             paramName="article"
>                             paramProperty="id">
>                             <img alt="Detailansicht"
> SRC="/iwf/graphics/detailsmall.gif" border="0" />
>                             </html:link>
>                             <br />&nbsp;<br />
>
>                             <html:link page="/addToCart.do" paramId="articleId"
> paramName="article" paramProperty="id">
>                                 <img name="tocart6" alt="<bean:message
> key="cart.add" />" SRC="/iwf/graphics/cart.gif" border="0">
>                             </html:link>
>
>                             <br />&nbsp;<br />
>                             <%--
>                             <a href="#"><img alt="Zu Favoriten"
> SRC="/iwf/graphics/favourite.gif" border="0" /></a>
> --%>
>                         </td>
>                     </tr>
>                     <tr>
>                         <td colspan="3" class="smalltext">
>                             <br />
>                         </td>
>                         <td colspan="2" align="left" class="smallbtext"
> valign="top"> <bean:message key="search.lizenzampel" />: </td>
>                         <td valign="top"><img src="/iwf/graphics/ampel.gif"
> alt="Lizenzampel" /></td>
>                     </tr>
>                     <tr>
>                         <td colspan="3" class="smallbtext">
>                             <br /><bean:message key="search.averagerating"
> />:
>                             <img src="/iwf/graphics/sterne_4_5.gif" alt="4,5
> Sterne" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>
>                             <html:link page="/ShowArticleRating.jsp"
>                                 paramId="articleID"
>                                 paramName="article"
>                                 paramProperty="id">
>                                 <bean:message key="article.rating" />
>                             </html:link>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
>
>                             <html:link page="/ArticleDetails.jsp"
>                             paramId="articleId"
>                             paramName="article"
>                             paramProperty="id">
>                             <bean:message key="search.phrase.details" />
>                             </html:link>
>                         </td>
>                         <td colspan="3" class="smallbtext" valign="bottom">
>
>                             <logic:present name="article" property="content"
> >
>                                 <bean:define name="article"
> property="content" id="content"
> type="com.tecmath.cms.mt.valueobjects.ContentVO"/>
>                                 <logic:notEqual name="content"
> property="previewFile" value="">
>                                     <bean:message key="search.term.preview"
> /> in: <br />
>                                     <html:link page='<%=
> "/essence/"+content.getPreviewFile() %>'>
>                                         <logic:notEqual name="content"
> property="thumbnailFile" value="">
>                                             <img
> src="/iwf/graphics/real_16x16.gif" alt="RealPlayer" border="0" />
>                                         </logic:notEqual>
>                                     </html:link>
>                                 </logic:notEqual>
>                             </logic:present>
>                         </td>
>                     </tr>
>                     <tr><td colspan="8"><hr class="hline"></td></tr>
>                 </table><!--Tabelle Suchergebniss Ende-->
>             </td>
>         </tr>
>
> IF I execute my first page I get the following error :
> Can't insert page 'productShortView.jsp' : Illegal to flush within a custom
> tag
>
> CAN someone please tell me what I am doing wrong ?
>
> MANY thanks any any suggestions are welcome !
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>