Now that I've got Jelly built from source I'm ready to contribute by
helping to find bugs. The original post in this thread dealt with
defining custom tags. I suspected, wrongly, that using the CVS
sources would enable the following to work:
Script:
...
<?xml version="1.0"?>
<j:jelly xmlns:j="jelly:core"
xmlns:log="jelly:log"
xmlns:dcc="psg.dcc.jelly.DCCTagLibrary">
<dcc:test>
<log:info>Testing custom jelly tags</log:info>
</dcc:test>
<dcc:notdefined>
<log:info>Why does this print?</log:info>
</dcc:notdefined>
</j:jelly>
Tag library source:
...
package psg.dcc.jelly;
import org.apache.commons.jelly.TagLibrary;
import psg.dcc.jelly.tags.swing.FileChooserTag;
import psg.dcc.jelly.tags.ui.ShowPageTag;
import psg.dcc.jelly.tags.TestTag;
/**
* A Jelly custom tag library that supports DCC.
*
* @author <a href="mailto:pmr@;pajato.com">Paul Reilly</a>
* @version $Revision: 1.0 $
*/
public class DCCTagLibrary extends TagLibrary {
public DCCTagLibrary() {
registerTag( "fileChooser", FileChooserTag.class );
registerTag( "showPage", ShowPageTag.class );
registerTag( "test", TestTag.class );
}
}
Tag source:
...
package psg.dcc.jelly.tags;
import org.apache.commons.jelly.XMLOutput;
import org.apache.commons.jelly.TagSupport;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Test custom tag creation.
*
* @author <a href="mailto:pmr@;pajato.com">Paul Reilly</a>
* @version $Revision: 1.0 $
*/
public class TestTag extends TagSupport {
/** The Log to which logging calls will be made. */
private static final Log log = LogFactory.getLog(TestTag.class);
public TestTag() {
System.out.println( "Constructed the test tag." );
}
private XMLOutput output;
// Tag interface
//-------------------------------------------------------------------------
public void doTag(XMLOutput output) throws Exception {
this.output = output;
System.out.println( "testing, testing" );
}
}
Results:
...
resources:
run:
Nov 5, 2002 10:54:00 AM org.apache.commons.jelly.tags.log.InfoTag doTag
INFO: Testing custom jelly tags
Nov 5, 2002 10:54:00 AM org.apache.commons.jelly.tags.log.InfoTag doTag
INFO: Why does this print?
BUILD SUCCESSFUL
Total time: 11 seconds
I invoke the script from a Java application. There are two issues:
1) Why do the print statements in the tag implementation not get
output?
2) Shouldn't the <notdefined> tag generate an undefined tag error?
-pmr
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org>