The Layout component is not a special component, it's just the same as any other component. You can reference any component as the root element of a page, or any HTML element. All you need to do is include the namespace, for example:
<t:otherlayout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> <!-- stuff goes here --> </t:otherlayout> Carl Joel Halbert wrote: > Hi Serge, > > Thanks, that worked - I didn't realise that the Layout.java and tml > files had to be in a directory named /component. > > May I ask one more question, which is how to support layout files of an > arbitrary name? Say I want to have Layout2.java and Layout2.tml.... > > Thx > Joel > > > > SergeEby wrote: >> Hi, >> >> Layouts are regular components that need to be created by you and are not >> handled differently. >> Make sure your Layout Java class is under >> src/main/java/<root-package>/components and the associated tml is in >> src/main/resources/<root-package>/components >> >> /Serge >> >> >> Joel Halbert-2 wrote: >> >>> Hi, >>> >>> I'm having issues using layouts (T5 5.0.15), with a tml, something >>> like this: >>> >>> <t:layout >>> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> >>> <div id="header"> >>> <table id="top"> >>> >>> etc.... >>> >>> >>> However, I get the exception, >>> *Caused by: java.lang.IllegalArgumentException: Unable to resolve >>> 'layout' to a component class name.* Available component types: >>> ActionLink, AddRowLink, AjaxFormLoop, Any, BeanDisplay, BeanEditForm, >>> BeanEditor, Checkbox, DateField, Delegate, Errors, EventLink, >>> ExceptionDisplay, Form, FormFragment, FormInjector, Grid, GridCell, >>> GridColumns, GridPager, GridRows, If, Label, Loop, Output, OutputRaw, >>> PageLink, Palette, PasswordField, PropertyDisplay, PropertyEditor, >>> Radio, RadioGroup, RemoveRowLink, RenderObject, Select, Submit, >>> SubmitNotifier, TextArea, TextField, TextOutput, Unless, Upload, Zone. >>> >>> >>> As per previous threads on this exception I've ensured that my >>> Layout.tml and Layout.java file exists in the correct build and >>> Tomcat directories, which they do. >>> >>> After putting the debugger on it I see it is attempting to look up >>> the Layout in ComponentClassResolver.java: >>> >>> private String locate(String logicalName, Map<String, String> >>> logicalNameToClassName) >>> { >>> rebuild(); >>> >>> String result = logicalNameToClassName.get(logicalName); >>> >>> However, the map which is populated with logical names to classes >>> clearly doesn't contain a reference to Layout. >>> I understand layouts are handled differently to other components, >>> created "on the fly". Is there something I might be missing here? >>> Should it be attempting to load the Layout in this way? >>> >>> Thx >>> Joel >>> >>> >>> -- >>> SU3 Analytics Ltd >>> 61b Oxford Gardens >>> W10 5UJ >>> London >>> >>> Tel: +44 20 8960 2634 >>> Mob: +44 75 2501 0825 >>> www.su3analytics.com >>> >>> SU3 Analytics Ltd is a company registered in England and Wales under >>> company number 06639473 at registered address 61b Oxford Gardens, London >>> W10 5UJ, United Kingdom. >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
