You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Randolph Kahle <ra...@variantia.net> on 2004/10/17 01:15:35 UTC

Help requested with component parameters

I am writing my first component with parameters and I am running into 
an exception.

<<<<<

Method 'abstract boolean net.OptionDisplay.isOptionChoice()' (declared 
in class net.OptionDisplay) has no implementation in class 
net.OptionDisplay (or enhanced subclass net.OptionDisplay$Enhance_4).

 >>>>>

is displayed in the browser for

<<<<<

<?xml version="1.0" ?>
<!DOCTYPE component-specification PUBLIC
   "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
   "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

<component-specification
	allow-body="no"
	allow-informal-parameters="no"
	class="net.OptionDisplay">
	
	<parameter
		name="optionChoice"
	  type="boolean"
		direction="in"
	  required="no"/>

</component-specification>

 >>>>>

with Java class

<<<<<

package net;

import org.apache.tapestry.AbstractComponent;
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;



public abstract class OptionDisplay
         extends AbstractComponent
	{

	abstract boolean isOptionChoice();


	protected void renderComponent( IMarkupWriter writer, IRequestCycle 
cycle )
		{
		java.util.Date date = new java.util.Date();

		if ( isOptionChoice() )
			{
			writer.print( date.toString() );
			}
		}

	}


 >>>>>

Called from HTML:

<<<<<

time<span jwcid="@OptionDisplay" option="ognl:false" />.

 >>>>>

I am stumped.

Would someone be willing to point out what I am doing wrong?

Thank you!

Regards,

Randy

Re: Help requested with component parameters

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Oct 16, 2004, at 7:32 PM, Randolph Kahle wrote:

> I believe I found the problem:
>
> The signature should be public:
>
> public abstract boolean isOptionChoice();
> ^^^^^^

That is correct - otherwise it is default package protected and thus 
classes outside your package (meaning the Tapestry infrastructure) 
cannot access your method.  More than likely Tapestry only instruments 
public abstract methods anyway.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Help requested with component parameters

Posted by Randolph Kahle <ra...@variantia.net>.
I believe I found the problem:

The signature should be public:

public abstract boolean isOptionChoice();
^^^^^^

Randy