You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Manri Offermann <ta...@eastbeam.co.jp> on 2004/12/15 05:22:09 UTC
Strange parameter ADDITION
this is how I use the component in both webapps
<span jwcid="$content$">
<html jwcid="@DefaultLayout" title="TEST">
<span jwcid="@BaseForm" target="index"></span>
</html>
</span>
the page spec is a default one
Manri
----- Original Message -----
From: "Manri Offermann" <ta...@eastbeam.co.jp>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, December 15, 2004 1:16 PM
Subject: Strange parameter
> Hi all,
>
> I have a very strange problem with parameters.
>
> I have a base class for Form Components with common tasks. Instead of
> coding the target page in the submit function, I give the Form Component a
> parameter which tells the component where to go after the form has been
> submitted.
>
> I have a small webapp where everything works fine. I subclass the Base
> Form Component and the "target" parameter is set correctly.
>
> Now I am working on a different webapp and included my base classes packed
> in a jar.
>
> I copied my test pages and specification + component specs etc. from the
> previous webapp.
> Now I hit the submit button and the parameter "target" returns null.
>
> Short: in one webapp the parameter is set and in another it is not, even
> the page and component specs are exactly the same.
>
> Both webapps use the same Application Server.
>
> Any clues?
>
>
> Manri Offermann
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE component-specification
> PUBLIC "-//Apache Software Foundation//Tapestry Specification
> 3.0//EN"
> "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
> <!-- generated by Spindle, http://spindle.sourceforge.net -->
>
> <component-specification
> class="com.eastbeam.web.tapestry.component.form.BaseForm" allow-body="yes"
> allow-informal-parameters="yes">
>
> <description>Basic Form</description>
>
> <parameter name="target" type="java.lang.String" required="yes"
> direction="in"/>
>
> <bean name="delegate"
> class="com.eastbeam.web.tapestry.delegate.StandardValidationDelegate"/>
>
> <component id="form" type="Form">
> <binding name="listener" expression="listeners.submit"/>
> <binding name="delegate" expression="beans.delegate"/>
> </component>
>
> </component-specification>
>
> --------------------------------------------------------------------------------------------
>
> public abstract class BaseForm extends BaseComponent {
>
> /**
> * @return Returns the target.
> */
> public abstract String getTarget(); // the parameter
>
> protected boolean isProtected() {
> return false; // if this form can not be accessed without a valid login
> }
>
> protected IPage submit(IRequestCycle cycle, IValidationDelegate delegate)
> throws ServiceException {
> // this method will be overriden by subclasses for custom logic
> return null;
> }
>
> public void submit(IRequestCycle cycle) {
> // the listener method for the form
> System.out.println("####" + getTarget()); <---------------------- HERE
> IValidationDelegate delegate = (IValidationDelegate)
> getBeans().getBean("delegate");
>
> if (isProtected()) {
> delegate.record(new ValidatorException("permission.denied"));
> return;
> }
>
> if (delegate.getHasErrors())
> return;
>
> try {
> IPage page = submit(cycle, delegate);
> if (page != null)
> cycle.activate(page);
> else if (getTarget() != null)
> cycle.activate(getTarget());
>
> } catch (ApplicationException e) {
> ExceptionReporter.report(e);
> delegate.record(new ValidatorException("err.fatal"));
> return;
> } catch (ServiceException e) {
> delegate.record(new ValidatorException(getMessage(e.getMessage())));
> return;
> }
> }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org