struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus L." <ml.in.h...@gmail.com>
Subject newbie issue - tiles plugin, adding content to "dynamic" attributes
Date Mon, 02 Jun 2008 17:01:01 GMT
hi list!

i'm new to struts and tiles and read a lot of docs, tutorials and lists last
few days. i think i got the basics and managed to implement some test
applications.

however, i still don't understand how to get attributes dynamic... i've seen
"runtime composition" in the ViewPreparer and DefinitionFactory, but i don't
know how to access the controller generated data from there..

following situation:

tiles.xml
-----------------
...
<definition name="page" template="/WEB-INF/jsp/layoutABCD.jsp">
  <put-attribute name="contentA" value="/WEB-INF/jsp/contentA.jsp" />
  <put-attribute name="contentB" value="/WEB-INF/jsp/contentB.jsp" />
  <put-attribute name="contentC" value="/WEB-INF/jsp/contentC.jsp" />
  <put-attribute name="contentD" value="/WEB-INF/jsp/contentD.jsp" />
</definition>
...
-----------------

struts.xml
-----------------
...
<package name="page" namespace="/page" extends="struts-default">
    <result-types>
      <result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult"/>
    </result-types>

    <action name="view" class="org.non.actions.PageAction" method="view">
       <result name="view" type="tiles">page</result>
...
--------------------

contentX.jsp ( X = A, B, C, D )
--------------------
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:property value="page.contentX" />
-------------------

what i want to do now is to have an arbitrary number of content elements (1)
and to avoid these "stub"-JSPs at all (2)...

for problem (1) i'm going to extend the DefinitionFactory, but that's for
later..

what's more import now is problem (2):

in the ViewPreparer i can add attributes, but i don't know how to access the
action controller to fill them with data.. (as that would avoid the JSPs..)


this must be a very basic problem, so i guess someone can put me on the
right way.

thanks.

markus.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message