You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Butler <pe...@141.com> on 2004/02/03 08:56:48 UTC

Component form is null first time page is viewed in 3.0b3, OK after session restart

Hi All

I'm having a problem with a ValidField component, set up like this:

<form jwcid="@Form" delegate="ognl:beans.delegate">
	<span jwcid="@FieldLabel"
field="ognl:components.price">Price</span>
	<input jwcid="price@ValidField" value="ognl:listing.price"
validator="ognl:beans.doubleRequired" displayName="Price"/>
</form>

An excerpt from the page specification is below:
<page-specification class="pricom.broker.pages.AddListing">
	<bean name="doubleRequired"
class="org.apache.tapestry.valid.NumberValidator">
        <set-property name="valueType" expression="'double'"/>
        <set-property name="required" expression="true"/>
        <set-property name="zeroIsNull" expression="true"/>
    </bean>
<bean name="delegate"
class="pricom.broker.components.SimpleValidationDelegate"/>
</page-specification>

I also have a validation delegate like this:
    public void writeLabelPrefix...
	if (isInError(component))
	{
	    writer.begin("span");
	    writer.attribute("class", "label-error");
	} else {
		writer.begin("span");
		writer.attribute("class", "label");
	}

The first time the page is viewed, Tapestry throws a
NullPointerException from ValidationDelegate.isInError (line 435), which
is 
        String formName = component.getForm().getName();

The NullPointerException is generated because the component's form
property is null, so the above call fails.

However, when I restart the session from the exception page, the page
displays fine.  This happens every time, and also happens when I call
the same page declared in the .application file with a different name.

Does anyone have any ideas on this?

Thanks in advance

Peter Butler

www.clever.co.nz


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