I just have a <c:out value='state.title'/> and feed the appropriate
value to the request.  State is a class as follows:

public class StateContainer
    implements Map {
  private Map map;

  public StateContainer() {
    int size = 89;
    this.map = Collections.synchronizedMap(new HashMap(size));
  }

  public void   setStateContainerMap(Map map)                       {
this.map = map; }
  public void   setProperty(Object key, Object value) { map.put(key,value); }
  public Map    getStateContainerMap()                              {
return map; }
  public Object getProperty(Object key)               { return map.get(key); }

  public StateContainer putState(String key, Object value) {
    this.put(key,value);
    return this;
  }

  public void       clear()                       { map.clear(); }
  public boolean    containsKey(Object key)       { return
map.containsKey(key);}
  public boolean    containsValue(Object value)   { return
map.containsValue(value); }
  public Set        entrySet()                    { return map.entrySet(); }
  public boolean    equals(Object object)         { return map.equals(object); }
  public Object     get(Object key)               { return map.get(key); }
  public int        hashCode()                    { return map.hashCode(); }
  public boolean    isEmpty()                     { return map.isEmpty(); }
  public Set        keySet()                      { return map.keySet(); }
  public Object     put(Object key, Object value) { return map.put(key,value); }
  public void       putAll(Map map)               { map.putAll(map); }
  public Object     remove(Object key)            { return map.remove(key); }
  public int        size()                        { return map.size(); }
  public Collection values()                      { return map.values(); }
  public String     toString()                    { return
"StateContainer[map=" + map.toString() + "]"; }
}

Whatever values the page author wants to be dynamic can be assumed to
be in state.  Then, the Action author can make sure that the values
are there.

There is, by the way, good reason to use the composite pattern here. 
I have discussed that before so I won't repeat it.

Jack


On Mon, 24 Jan 2005 17:18:01 -0500, Rick Reumann <[EMAIL PROTECTED]> wrote:
> I'm switching back to using Tiles instead of Sitemesh and I remember one
> issue that I found annoying with Tiles and I'd be curious how you guys
> handle it. Say I have a form that is going to be reused for both "Edit"
> and "Add." I want the <title> attribute to read something like "Add
> Employee" or "Edit Employee," depending on what I'm doing. It seems
> silly to have to create multiple definitions in my tiles-definitions
> that are essentially the same exact definition except that the title has
> changed (potentially you might want a definition to be used for more
> than just the two that I mentioned). This also requires that my struts
> config has to be set up to forward to multiple tiles definitions when
> its really the same page layout but with a different title and could
> really just require one definition to use.
> 
> I've thought of different ways I might want to handle this (ie set a
> title in request scope before leaving action and have the header.jsp
> look for this, or maybe use a filter or over-ride RequestProcessor?) I'm
> curious if others have run into this. Maybe the latest Struts/Tiles has
> a solution that I have not looked into.
> 
> Thanks
> 
> --
> Rick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
------------------------------

"You can lead a horse to water but you cannot make it float on its back."

~Dakota Jack~

"You can't wake a person who is pretending to be asleep."

~Native Proverb~

"Each man is good in His sight. It is not necessary for eagles to be crows."

~Hunkesni (Sitting Bull), Hunkpapa Sioux~

-----------------------------------------------

"This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation."

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to