You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@yahoo.com> on 2002/02/06 01:39:21 UTC

Tiles Definitions - how to I 18n them?

Hopefully this is easy...

In the following tiles definition:

  <definition name="index" path="/layouts/courseBuilder.jsp">
	  <put name="title"  value="Course Builder" />
	  <put name="header" value="/common/header.jsp" />
	  <put name="menu"   value="doc.menu.main" />
	  <put name="footer" value="/common/footer.jsp" />
	  <put name="body"   value="doc.portal.body" />
  </definition>

How do I make the "title" attribute come from my ApplicationResource.properties
file?

Thanks - first time getting into the nitty gritty of tiles, so sorry for the
ignorance.

Matt


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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


Re: Tiles: specifying an insert attribute that is not required

Posted by Matt Raible <ma...@yahoo.com>.
Yep, worked like a charm - just starting with Tiles, I'll make sure and help
other folks out when I see similar problems to what I'm experiencing.

Thanks,

Matt

--- Cedric Dumoulin <ce...@lifl.fr> wrote:
> 
>   Doesn't the ignore property work for you ?
> 
>   <tiles:insert attribute="search" ignore="true"/>
> 
>     Cedric
> 
> 
> Matt Raible wrote:
> 
> > That worked beautifully - thank you.
> >
> > A new question - is it possible to specify something like the following in
> my
> > layout JSPs:
> >
> > <tiles:insert attribute="search" required="false"/>
> >
> > This would enable my definitions the "option" of defining content for this
> > region, and I might be able to use a common template more often in my site.
>  Or
> > is it possible to just extend the original layout and add one line for this
> new
> > attribute?
> >
> > Thanks,
> >
> > Matt
> >
> > --- Cedric Dumoulin <ce...@lifl.fr> wrote:
> > >
> > >   Hi,
> > >
> > >   If the definition is defined in an xml file, there is no way to set a
> value
> > > from
> > > a property file.
> > >   But, you can do another approach : in your definition, use the property
> key
> > > value, and in your template/layout, read the value from the property file
> > > using the
> > > property key.
> > >
> > >    Cedric
> > >
> > > Example :
> > >   <definition name="index" path="/layouts/courseBuilder.jsp">
> > >           <put name="title.key"  value="title.courseBuilder" />
> > >           <put name="header" value="/common/header.jsp" />
> > >           <put name="menu"   value="doc.menu.main" />
> > >           <put name="footer" value="/common/footer.jsp" />
> > >           <put name="body"   value="doc.portal.body" />
> > >   </definition>
> > >
> > > .... in courseBuilder.jsp :
> > > <tiles:importAttribute name="title.key"/>
> > > <bean:message name="title.key"/>
> > >
> > >
> > > Matt Raible wrote:
> > >
> > > > Hopefully this is easy...
> > > >
> > > > In the following tiles definition:
> > > >
> > > >   <definition name="index" path="/layouts/courseBuilder.jsp">
> > > >           <put name="title"  value="Course Builder" />
> > > >           <put name="header" value="/common/header.jsp" />
> > > >           <put name="menu"   value="doc.menu.main" />
> > > >           <put name="footer" value="/common/footer.jsp" />
> > > >           <put name="body"   value="doc.portal.body" />
> > > >   </definition>
> > > >
> > > > How do I make the "title" attribute come from my
> > > ApplicationResource.properties
> > > > file?
> > > >
> > > > Thanks - first time getting into the nitty gritty of tiles, so sorry
> for
> > > the
> > > > ignorance.
> > > >
> > > > Matt
> > > >
> > > > __________________________________________________
> > > > Do You Yahoo!?
> > > > Send FREE Valentine eCards with Yahoo! Greetings!
> > > > http://greetings.yahoo.com
> > > >
> > > > --
> > > > 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>
> > >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
> >
> > --
> > 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>
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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


Re: Tiles: specifying an insert attribute that is not required

Posted by Cedric Dumoulin <ce...@lifl.fr>.
  Doesn't the ignore property work for you ?

  <tiles:insert attribute="search" ignore="true"/>

    Cedric


Matt Raible wrote:

> That worked beautifully - thank you.
>
> A new question - is it possible to specify something like the following in my
> layout JSPs:
>
> <tiles:insert attribute="search" required="false"/>
>
> This would enable my definitions the "option" of defining content for this
> region, and I might be able to use a common template more often in my site.  Or
> is it possible to just extend the original layout and add one line for this new
> attribute?
>
> Thanks,
>
> Matt
>
> --- Cedric Dumoulin <ce...@lifl.fr> wrote:
> >
> >   Hi,
> >
> >   If the definition is defined in an xml file, there is no way to set a value
> > from
> > a property file.
> >   But, you can do another approach : in your definition, use the property key
> > value, and in your template/layout, read the value from the property file
> > using the
> > property key.
> >
> >    Cedric
> >
> > Example :
> >   <definition name="index" path="/layouts/courseBuilder.jsp">
> >           <put name="title.key"  value="title.courseBuilder" />
> >           <put name="header" value="/common/header.jsp" />
> >           <put name="menu"   value="doc.menu.main" />
> >           <put name="footer" value="/common/footer.jsp" />
> >           <put name="body"   value="doc.portal.body" />
> >   </definition>
> >
> > .... in courseBuilder.jsp :
> > <tiles:importAttribute name="title.key"/>
> > <bean:message name="title.key"/>
> >
> >
> > Matt Raible wrote:
> >
> > > Hopefully this is easy...
> > >
> > > In the following tiles definition:
> > >
> > >   <definition name="index" path="/layouts/courseBuilder.jsp">
> > >           <put name="title"  value="Course Builder" />
> > >           <put name="header" value="/common/header.jsp" />
> > >           <put name="menu"   value="doc.menu.main" />
> > >           <put name="footer" value="/common/footer.jsp" />
> > >           <put name="body"   value="doc.portal.body" />
> > >   </definition>
> > >
> > > How do I make the "title" attribute come from my
> > ApplicationResource.properties
> > > file?
> > >
> > > Thanks - first time getting into the nitty gritty of tiles, so sorry for
> > the
> > > ignorance.
> > >
> > > Matt
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Send FREE Valentine eCards with Yahoo! Greetings!
> > > http://greetings.yahoo.com
> > >
> > > --
> > > 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>
> >
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> --
> 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>


Tiles: specifying an insert attribute that is not required

Posted by Matt Raible <ma...@yahoo.com>.
That worked beautifully - thank you.

A new question - is it possible to specify something like the following in my
layout JSPs:

<tiles:insert attribute="search" required="false"/>

This would enable my definitions the "option" of defining content for this
region, and I might be able to use a common template more often in my site.  Or
is it possible to just extend the original layout and add one line for this new
attribute?

Thanks,

Matt

--- Cedric Dumoulin <ce...@lifl.fr> wrote:
> 
>   Hi,
> 
>   If the definition is defined in an xml file, there is no way to set a value
> from
> a property file.
>   But, you can do another approach : in your definition, use the property key
> value, and in your template/layout, read the value from the property file
> using the
> property key.
> 
>    Cedric
> 
> Example :
>   <definition name="index" path="/layouts/courseBuilder.jsp">
>           <put name="title.key"  value="title.courseBuilder" />
>           <put name="header" value="/common/header.jsp" />
>           <put name="menu"   value="doc.menu.main" />
>           <put name="footer" value="/common/footer.jsp" />
>           <put name="body"   value="doc.portal.body" />
>   </definition>
> 
> .... in courseBuilder.jsp :
> <tiles:importAttribute name="title.key"/>
> <bean:message name="title.key"/>
> 
> 
> Matt Raible wrote:
> 
> > Hopefully this is easy...
> >
> > In the following tiles definition:
> >
> >   <definition name="index" path="/layouts/courseBuilder.jsp">
> >           <put name="title"  value="Course Builder" />
> >           <put name="header" value="/common/header.jsp" />
> >           <put name="menu"   value="doc.menu.main" />
> >           <put name="footer" value="/common/footer.jsp" />
> >           <put name="body"   value="doc.portal.body" />
> >   </definition>
> >
> > How do I make the "title" attribute come from my
> ApplicationResource.properties
> > file?
> >
> > Thanks - first time getting into the nitty gritty of tiles, so sorry for
> the
> > ignorance.
> >
> > Matt
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Send FREE Valentine eCards with Yahoo! Greetings!
> > http://greetings.yahoo.com
> >
> > --
> > 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>
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

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


Re: Tiles Definitions - how to I 18n them?

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

  If the definition is defined in an xml file, there is no way to set a value from
a property file.
  But, you can do another approach : in your definition, use the property key
value, and in your template/layout, read the value from the property file using the
property key.

   Cedric

Example :
  <definition name="index" path="/layouts/courseBuilder.jsp">
          <put name="title.key"  value="title.courseBuilder" />
          <put name="header" value="/common/header.jsp" />
          <put name="menu"   value="doc.menu.main" />
          <put name="footer" value="/common/footer.jsp" />
          <put name="body"   value="doc.portal.body" />
  </definition>

.... in courseBuilder.jsp :
<tiles:importAttribute name="title.key"/>
<bean:message name="title.key"/>


Matt Raible wrote:

> Hopefully this is easy...
>
> In the following tiles definition:
>
>   <definition name="index" path="/layouts/courseBuilder.jsp">
>           <put name="title"  value="Course Builder" />
>           <put name="header" value="/common/header.jsp" />
>           <put name="menu"   value="doc.menu.main" />
>           <put name="footer" value="/common/footer.jsp" />
>           <put name="body"   value="doc.portal.body" />
>   </definition>
>
> How do I make the "title" attribute come from my ApplicationResource.properties
> file?
>
> Thanks - first time getting into the nitty gritty of tiles, so sorry for the
> ignorance.
>
> Matt
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> --
> 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>


Re: Tiles Definitions - how to I 18n them?

Posted by Ivan Siviero <iv...@concept.it>.
>
>   <definition name="index" path="/layouts/courseBuilder.jsp">
>   <put name="title"  value="Course Builder" />
>   <put name="header" value="/common/header.jsp" />
>   <put name="menu"   value="doc.menu.main" />
>   <put name="footer" value="/common/footer.jsp" />
>   <put name="body"   value="doc.portal.body" />
>   </definition>

    well, instead of "Course Builder" String you can put the key which
identifies the string in the ApplicationResources.
    In the jsp page which use the above definition you start the page by
using <tiles:importAttribute/>
   then use the <bean:message key="title">. (Not tested)

    Another solution should be to localize the definition xml file.
    So you should have your default definition file
(componentDefinitions.xml) and other definitions files for the specified
language (componentDefinitions_it, componentDefinitions_en,
componentDefinitions_de ......)
Bye
Ivan
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> --
> 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>