You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sam Wun <sw...@gmail.com> on 2009/08/19 15:19:48 UTC
Why tiles-defs?
Hi,
Can anyone tell me why use tiles-defs?
I used "traditional" structs from an Action class forward/redirect to
a jsp file.
With tiles-defs, I just simply added "code" to this file to achieve
the url redirection.
Case scenario:
I want to forward to two different search jsp files from another jsp
file (main.jsp).
In tiles-defs.xml file, I have added something like this:
<definition name="portlet.shopping.search" extends="portlet.shopping">
<put name="portlet_content"
value="/portlet/shopping/search.jsp" />
</definition>
<definition name="portlet.shopping.search_v2"
extends="portlet.shopping">
<put name="portlet_content"
value="/portlet/shopping/search_v2.jsp" />
</definition>
In main.jsp file I use the following code to forward to either search_v2.jsp:
<liferay-portlet:renderURL windowState="<%=
WindowState.MAXIMIZED.toString() %>"
varImpl="searchURL"><portlet:param name="struts_action"
value="/shopping/search_v2" /></liferay-portlet:renderURL>
<form action="<%= searchURL %>" method="get" name="<portlet:namespace
/>fm1" onSubmit="submitForm(this); return false;">
<liferay-portlet:renderURLParams varImpl="searchURL" />
<input name="<portlet:namespace />redirect" type="hidden" value="<%=
HtmlUtil.escape(currentURL) %>" />
<input name="<portlet:namespace />breadcrumbsCategoryId" type="hidden"
value="<%= categoryId %>" />
<input name="<portlet:namespace />searchCategoryIds" type="hidden"
value="<%= categoryId %>" />
Thanks
Sam
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Why tiles-defs?
Posted by Tatiyana Tarabara <ta...@egr.msu.edu>.
I am very new user of Struts and I don't know all benefits of using
Tiles, but I am using tiles for example to transfer parameter from one
jsp page to another: if I have jsp page with same part repeated several
times I will put this part in the separate jsp page and give all needed
parameters (bean name, properties, etc) to it through the tiles insert:
In the initial page:
<tiles:insert page="/forms/separate-page.jsp "flush="false">
<tiles:put name="toward" value="neededvalue"/>
</tiles:insert>
To the separate page: <tiles:importAttribute name="toward"/>
Sam Wun wrote:
> Hi,
>
> Can anyone tell me why use tiles-defs?
>
> I used "traditional" structs from an Action class forward/redirect to
> a jsp file.
> With tiles-defs, I just simply added "code" to this file to achieve
> the url redirection.
>
> Case scenario:
>
> I want to forward to two different search jsp files from another jsp
> file (main.jsp).
>
>
> In tiles-defs.xml file, I have added something like this:
> <definition name="portlet.shopping.search" extends="portlet.shopping">
> <put name="portlet_content"
> value="/portlet/shopping/search.jsp" />
> </definition>
> <definition name="portlet.shopping.search_v2"
> extends="portlet.shopping">
> <put name="portlet_content"
> value="/portlet/shopping/search_v2.jsp" />
> </definition>
>
> In main.jsp file I use the following code to forward to either search_v2.jsp:
> <liferay-portlet:renderURL windowState="<%=
> WindowState.MAXIMIZED.toString() %>"
> varImpl="searchURL"><portlet:param name="struts_action"
> value="/shopping/search_v2" /></liferay-portlet:renderURL>
>
> <form action="<%= searchURL %>" method="get" name="<portlet:namespace
> />fm1" onSubmit="submitForm(this); return false;">
> <liferay-portlet:renderURLParams varImpl="searchURL" />
> <input name="<portlet:namespace />redirect" type="hidden" value="<%=
> HtmlUtil.escape(currentURL) %>" />
> <input name="<portlet:namespace />breadcrumbsCategoryId" type="hidden"
> value="<%= categoryId %>" />
> <input name="<portlet:namespace />searchCategoryIds" type="hidden"
> value="<%= categoryId %>" />
>
>
> Thanks
> Sam
>
> ---------------------------------------------------------------------
> 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