Hi, I am a beginner with tapestry and I am trying to create my first custom
component. I am using Kent Tongs book as my source and doing the Copyright
component, but I am doing somthing wrong becouse I receive a
org.apache.tapestry.util.xml.DocumentParseException that states: Unable to
read context:/default/html/public/index.page: Attribute "value" must be
declared for element type "component". And then I got
org.xml.sax.SAXParseException that states: Attribute "value" must be
declared for element type "component".

I figure that there is something wrong with my mapping or the location of
the files or the location, but I cant find out what is wrong.

My mycompany.application looks like this:
<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE application PUBLIC 
    "-//Apache Software Foundation//Tapestry Specification 4.0//EN" 
    "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
    
<application name="mycompany"> 

        <library id="contrib"
specification-path="classpath:/org/apache/tapestry/contrib/Contrib.library"/>
    
    <meta key="org.apache.tapestry.component-class-packages"
value="com.mycompany.ui.web.components"/>
    <component-type type="Copyright"
specification-path="classes/com/mycompany/ui/web/components/Copyright.jwc"/>
</application>


My Copyright.html:
<html>
<body jwcid="$content$">
<hr>Copyright <span jwcid="year">2005</span>. Investacorp Inc. All rights
reserved.
</body>
</html>

My Copyright.jwc:
<?xml version="1.0"?>
<!DOCTYPE component-specification PUBLIC
        "-//Apache Software Foundation//Tapestry Specification 4.0//EN"
        "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
        
<component-specification allow-body="no">
        <description>It renders a copyright notice.</description>
        <parameter name="holder" required="yes"/>
        <component id="year" type="Insert">
                <binding name="value" value="currentYear"/>
        </component>
</component-specification>


My Copyright.java:
package com.mycompany.ui.web.components;

import java.util.GregorianCalendar;

import org.apache.tapestry.BaseComponent;

public class Copyright extends BaseComponent {

        public int getCurrentYear() {
                return new GregorianCalendar().get(GregorianCalendar.YEAR);
        }
        
}

My index.page fale that tries to use the component:
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC "-//Apache Software Foundation//Tapestry
Specification 4.0//EN"
        "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";>
        
<page-specification class="com.mycompany.ui.web.action.home.HomeAction">
    
        <component id="companyName" type="Insert" >
                <binding name="value" value="repSite.companyName"/>
        </component>

        <component id="copyright" value="Copyright">
                <binding name="holder" value="companyName"/>
        </component>
</page-specification>


I have my java-class in a seperate folder structure:
src/main/java/com/mycompany/ui/web/components/Copyright.java
My .jwc file have this location:
WEB-INF/classes/com/mycompany/ui/web/components/Copyright.jwc
My .application have this location: WEB-INF/mycompany.application

As far as my knowlegde is I think this is correct... but it does not
work...can somebody point out the error/errors in my code?
thanks
Jacob


-- 
View this message in context: 
http://www.nabble.com/Issues-with-Custom-Components-tf2204142.html#a6104003
Sent from the Tapestry - User forum at Nabble.com.


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

Reply via email to