tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken McWilliams <ken.mcwilli...@gmail.com>
Subject Re: Tiles decoration/run time composition/interaction between tiles
Date Sun, 08 Apr 2012 02:19:13 GMT
On Sat, Apr 7, 2012 at 8:27 AM, Nicolas LE BAS <mail@nlebas.net> wrote:

> Hi!
> I don't really understand your use case. Has it something to do with
> including javascript/css in the <head> section to support your code in the
> <body> section? Can you provide an example?

That is exactly it.

An example... JSP fragment follows later to show the idea, this was only
typed in the message so it should be interpreted as pseudo JSP. I'm not
sure what is possible in regular EL so if what I've done is not legal you
should note the expression language is ONGL for which something of the sort
is legal (and my expressions should be unless I made a typo).

Here is my intended purpose (and I'm just doing this for fun):

I'm not there yet exactly but simply I want the user to select "widgets"
(in the basic case a div with a certain class or id ) then I need to
include the relevant javascript/css in the head so it will do its magic.

Lets say I have some entity classes (or in any case models which are java
beans for which a sent to the view) and I would like the user to be able to
edit the content of these models but I don't know what they will contain...
I want the view to figure out how to render the model.  This naturally
isn't going to produce pretty forms by default (although an editor could be
built do correct this after the fact).

To help with this I created a tag that works with struts2 called

<ken:properties var="model" name="getters" type="get"/>
<ken:properties var="model" name="setters" type="set"/>
<ken:properties var="model" name="both" type="both"/>

The following tags currently push all the getters of model into a
collection called "getters", all setters into "setters", and both setters
and getters into "all"... this is a simplified expression, the default
assumes getters for the action (only returning the getters declared in the
action, need to still implement include/exclude types which can filter out
methods from subclasses after a certain point and specific interfaces, or
for the reverse and include them)

Now using a tag that looks something like:

<!-- typeDefinitions defines what class types for a particular mode (read,
write, read/write) will resolve to which particular template, ie: a write
and readwrite Date type will resolve to a jQuery date picker with date
selection enabled while a read only Date[] would resolve the a jQuery date
picker without any selection (just shows the dates).

This is because I might know the general purpose such as the types must map
to a certain DB but nothing about what a particular table may contain
(something like that)  -->
<ken:typedefinitions name="basicSet">
    <s:iterator value="#both" var="cur">
       <s:if test="getters.contains(cur) && setters.contains(cur)">
          <s:polyview mode="rw"/>
       <s:elseif test="getters.contains(cur)">
          <s:polyview mode="r"/>
          <s:polyview mode="w"/>

So the definition will be made up of views (JSPs in my case), although I
favouring unobtrusive JS... there is in most cases just going to need to be
a single div inserted into the body and a JS source inserted in the head.

I'm not sure how tiles works exactly... each jsp renders its view and then
is composed into a single document? If so, is it possible to alter the
template while the JSPs are rendering?

That way the definitions for how a polyview would render would be defined
by tiles it self.

I don't think you need a mutable container for that, anyway.

That would be great. The less I need to do the better (or look into).

> But concerning the struts2 setup: as long as you don't use freemarker, I
> believe you can just ignore StrutsTilesListener and use your own instead
> (or one that is provided by Tiles).
> On 12-04-06 09:40 PM, Ken McWilliams wrote:
>> I'll just explain the use case: I want to create custom tags which require
>> source tags be included in the header. I would like these tags to work
>> with
>> tiles somehow to achieve this. My component tags will just push strings
>> (paths to js files).
>> I am using tiles 2.2.2 in my project currently.
>> To complicate matters I am using the struts2-tiles-plugin (which sets
>> things up for me and I don't know how to set tiles parameters from there).
>> For instance I want to investigate using a mutable container but am
>> uncertain as how to get alter the setup struts2 provides.

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