You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Glen Stampoultzis <gs...@iinet.net.au> on 2004/01/26 02:29:46 UTC

Javascript form submit

I know I can add a form submit handler by using the following code in a page:

         IForm form = (IForm) getComponent( "myForm" );
         form.addEventHandler( ... );

What I'm not sure of is where the best place to add this code is.  At a 
guess I'd say adding it to the attach() method would be right but I'm not 
sure.  I want to avoid the function being called twice.



Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/


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


Re: Javascript form submit

Posted by Glen Stampoultzis <gs...@iinet.net.au>.
Oh... and the other thing.  If I add it on the attach do I need to do 
anything on the detach?

Regards,

Glen

At 12:29 PM 26/01/2004, you wrote:

>I know I can add a form submit handler by using the following code in a page:
>
>         IForm form = (IForm) getComponent( "myForm" );
>         form.addEventHandler( ... );
>
>What I'm not sure of is where the best place to add this code is.  At a 
>guess I'd say adding it to the attach() method would be right but I'm not 
>sure.  I want to avoid the function being called twice.
>
>
>
>Glen Stampoultzis
>gstamp@iinet.net.au
>http://members.iinet.net.au/~gstamp/glen/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/


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


Re: Null values after some period of inactivity

Posted by Sándor Norbert <sa...@mail.datanet.hu>.
Maybe your session expires and the persistent properties are reset to their
initial value.
I use the validate() method to avoid exceptions in this case.

Norbi

----- Original Message ----- 
From: "Jonny Wray" <jo...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, February 06, 2004 3:38 AM
Subject: Null values after some period of inactivity


>
> Hi there, I'm relatively new to tapestery so I'm sure I'm missing
> something obvious here. The problem is I get the following error:
>
> Value for parameter 'listener' in component
> SearchResults/resultTable.link is null, and a non-null value is
> required.
>
> when I activate a link after the session has been idle for a while. I'm
> using a DirectLink component inside my own LinkedTable which is used in
> the above mentioned SearchResults page.
>
> In SearchResults.page: (tableValueListener is a listener in the page
> code)
>
> <component id="resultTable" type="LinkedTable">
>   <static-binding name="dataSource">resultList</static-binding>
>   <binding name="linkListener"
> expression="listeners.tableValueListener" />
> </component>
>
> In LinkedTable.jwc:
>
> <parameter name="dataSource" type="java.lang.String" required="yes"
> direction="in" />
>
> <parameter name="linkListener"
> type="org.apache.tapestry.IActionListener"
>     required="yes" direction="in" />
>
>
> <component id="link" type="DirectLink">
>    <binding name="listener" expression="linkListener" />
>    <binding name="parameters" expression="currentParameter" />
>    <binding name="disabled" expression= "currentDisabled" />
> </component>
>
> In my LinkedTable java I have an instance variable linkListener with
> getters and setters and I reset it to null in initialize.
>
> Any idea why I'm getting this error when my session has been inactive
> for a while?
>
> thanks in advance,
> Jonny
>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: Null values after some period of inactivity

Posted by Marilen Corciovei <le...@nemesisit.rdsnet.ro>.
Another problem I encountered is when you have values set in your page
or component class. This class is stored in the tapestry pool for some
time and then lost. Check that you nullified all class variables on
detach. If you do so and the problem was there then you will get the
error without timeout.

Len


On Fri, 2004-02-06 at 07:00, Bryan Lewis wrote:

> I saw something like this once.  I had an ognl expression that
> referenced a component's parameter.  After the app sat for a while (and
> only then), I got an error "Unable to resolve expression."  My guess was
> that the variable was being garbage collected by Java.
> 
> I fixed it by moving the expression from the html to the java code.
> This failed:
> 
> .html:
>     <span jwcid="@Shell" title="ognl:'MyApp ' + title" ...>
> where 'title' was a typical instance variable with accessor methods.
> 
> This worked:
> 
> .html:
>     <span jwcid="@Shell" title="ognl:donutTitle" ...>
> .java:
>     public String getDonutTitle() { return "MyApp " + title; }
> 
> Maybe that will give you a clue of where to start looking.  You might
> add log statements to see which of your component's parameters is
> getting cleaned up. Adding code to force g.c. might help testing.  If
> you isolate the parameter, enclosing it in a method (or making it
> persistent somehow) might help.  Perhaps there's some subtle bug in the
> ognl/tapestry interface such that references to parameters aren't hard
> references and are subject to garbage collection.
> 
> 
> 
> ----- Original Message ----- 
> From: "Jonny Wray" <jo...@yahoo.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Thursday, February 05, 2004 9:38 PM
> Subject: Null values after some period of inactivity
> 
> 
> >
> > Hi there, I'm relatively new to tapestery so I'm sure I'm missing
> > something obvious here. The problem is I get the following error:
> >
> > Value for parameter 'listener' in component
> > SearchResults/resultTable.link is null, and a non-null value is
> > required.
> >
> > when I activate a link after the session has been idle for a while.
> I'm
> > using a DirectLink component inside my own LinkedTable which is used
> in
> > the above mentioned SearchResults page.
> >
> > In SearchResults.page: (tableValueListener is a listener in the page
> > code)
> >
> > <component id="resultTable" type="LinkedTable">
> >   <static-binding name="dataSource">resultList</static-binding>
> >   <binding name="linkListener"
> > expression="listeners.tableValueListener" />
> > </component>
> >
> > In LinkedTable.jwc:
> >
> > <parameter name="dataSource" type="java.lang.String" required="yes"
> > direction="in" />
> >
> > <parameter name="linkListener"
> > type="org.apache.tapestry.IActionListener"
> >     required="yes" direction="in" />
> >
> >
> > <component id="link" type="DirectLink">
> >    <binding name="listener" expression="linkListener" />
> >    <binding name="parameters" expression="currentParameter" />
> >    <binding name="disabled" expression= "currentDisabled" />
> > </component>
> >
> > In my LinkedTable java I have an instance variable linkListener with
> > getters and setters and I reset it to null in initialize.
> >
> > Any idea why I'm getting this error when my session has been inactive
> > for a while?
> >
> > thanks in advance,
> > Jonny
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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



Re: Null values after some period of inactivity

Posted by Bryan Lewis <br...@maine.rr.com>.
I saw something like this once.  I had an ognl expression that
referenced a component's parameter.  After the app sat for a while (and
only then), I got an error "Unable to resolve expression."  My guess was
that the variable was being garbage collected by Java.

I fixed it by moving the expression from the html to the java code.
This failed:

.html:
    <span jwcid="@Shell" title="ognl:'MyApp ' + title" ...>
where 'title' was a typical instance variable with accessor methods.

This worked:

.html:
    <span jwcid="@Shell" title="ognl:donutTitle" ...>
.java:
    public String getDonutTitle() { return "MyApp " + title; }

Maybe that will give you a clue of where to start looking.  You might
add log statements to see which of your component's parameters is
getting cleaned up. Adding code to force g.c. might help testing.  If
you isolate the parameter, enclosing it in a method (or making it
persistent somehow) might help.  Perhaps there's some subtle bug in the
ognl/tapestry interface such that references to parameters aren't hard
references and are subject to garbage collection.



----- Original Message ----- 
From: "Jonny Wray" <jo...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, February 05, 2004 9:38 PM
Subject: Null values after some period of inactivity


>
> Hi there, I'm relatively new to tapestery so I'm sure I'm missing
> something obvious here. The problem is I get the following error:
>
> Value for parameter 'listener' in component
> SearchResults/resultTable.link is null, and a non-null value is
> required.
>
> when I activate a link after the session has been idle for a while.
I'm
> using a DirectLink component inside my own LinkedTable which is used
in
> the above mentioned SearchResults page.
>
> In SearchResults.page: (tableValueListener is a listener in the page
> code)
>
> <component id="resultTable" type="LinkedTable">
>   <static-binding name="dataSource">resultList</static-binding>
>   <binding name="linkListener"
> expression="listeners.tableValueListener" />
> </component>
>
> In LinkedTable.jwc:
>
> <parameter name="dataSource" type="java.lang.String" required="yes"
> direction="in" />
>
> <parameter name="linkListener"
> type="org.apache.tapestry.IActionListener"
>     required="yes" direction="in" />
>
>
> <component id="link" type="DirectLink">
>    <binding name="listener" expression="linkListener" />
>    <binding name="parameters" expression="currentParameter" />
>    <binding name="disabled" expression= "currentDisabled" />
> </component>
>
> In my LinkedTable java I have an instance variable linkListener with
> getters and setters and I reset it to null in initialize.
>
> Any idea why I'm getting this error when my session has been inactive
> for a while?
>
> thanks in advance,
> Jonny
>
>
>
>
> ---------------------------------------------------------------------
> 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


Null values after some period of inactivity

Posted by Jonny Wray <jo...@yahoo.com>.
Hi there, I'm relatively new to tapestery so I'm sure I'm missing
something obvious here. The problem is I get the following error:

Value for parameter 'listener' in component
SearchResults/resultTable.link is null, and a non-null value is
required.

when I activate a link after the session has been idle for a while. I'm
using a DirectLink component inside my own LinkedTable which is used in
the above mentioned SearchResults page.

In SearchResults.page: (tableValueListener is a listener in the page
code)

<component id="resultTable" type="LinkedTable">
  <static-binding name="dataSource">resultList</static-binding>
  <binding name="linkListener"
expression="listeners.tableValueListener" />
</component>

In LinkedTable.jwc:

<parameter name="dataSource" type="java.lang.String" required="yes"
direction="in" />

<parameter name="linkListener"
type="org.apache.tapestry.IActionListener" 
    	required="yes" direction="in" />


<component id="link" type="DirectLink">
   <binding name="listener" expression="linkListener" />
   <binding name="parameters" expression="currentParameter" />
   <binding name="disabled" expression= "currentDisabled" />
</component>

In my LinkedTable java I have an instance variable linkListener with
getters and setters and I reset it to null in initialize.

Any idea why I'm getting this error when my session has been inactive
for a while?

thanks in advance,
Jonny




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


Inspector - Engine properties visit = none

Posted by Joerg Latteier <la...@online.de>.
Hi,

The visit object is definitely initialized and existing (using a
<SPAN jwcid="@Insert" value="ognl:engine.visit.test.successfulLogin"> 
tag on my page proves it), but the inspector's application engine 
page still says "visit=none". 
Does anyone know the possible reason ?

probably a typical newbie question but I didnt find an
answer in the archive or in the other docs.

Thanks,
Joerg


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


Re: Dealing with blanks in Insert/Table

Posted by Jonny Wray <jo...@yahoo.com>.
Thanks,

Ah, I guess that explains why some of the documented features of the
Table component didn't work when I tryed them last week - documentation
preceding the release.

I look forward to trying the new version.


Jonny

--- Mindbridge <mi...@yahoo.com> wrote:
> Hi,
> 
> > When you don't specify anything in a html table browsers don't
> treat it
> > like a normal table cell.
> 
> This has been changed in the new version (currently in CVS, will come
> out as
> beta4 in a couple of days).
> 
> A whole new way Table can be used has been added as well. It is far
> more
> natural and obvious, somewhat similar to Foreach. Please check the
> Component
> Reference on the Tapestry site.
> 
> -mb
> 
> ----- Original Message ----- 
> From: "Jonny Wray" <jo...@yahoo.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Tuesday, January 27, 2004 12:12 AM
> Subject: Dealing with blanks in Insert/Table
> 
> 
> >
> > Hi,
> >
> > When you don't specify anything in a html table browsers don't
> treat it
> > like a normal table cell. You don't get the css class applyed to it
> for
> > example. Inserting a @nbsp; in the cell with deal with the problem.
> My
> > old JSP code was littered with conditionals looking for empty
> strings
> > and inserting @nbsp; instead.
> >
> > Now, is there anyway of doing this in tapestry with the @Insert and
> > @Table components?
> >
> > I know it's sort of trivial, but I'm sure it'll be the first thing
> my
> > users will comment on if not done correctly
> >
> > thanks
> > Jonny
> >
> >
> ---------------------------------------------------------------------
> > 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
> 


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


Re: Dealing with blanks in Insert/Table

Posted by Mindbridge <mi...@yahoo.com>.
Hi,

> When you don't specify anything in a html table browsers don't treat it
> like a normal table cell.

This has been changed in the new version (currently in CVS, will come out as
beta4 in a couple of days).

A whole new way Table can be used has been added as well. It is far more
natural and obvious, somewhat similar to Foreach. Please check the Component
Reference on the Tapestry site.

-mb

----- Original Message ----- 
From: "Jonny Wray" <jo...@yahoo.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, January 27, 2004 12:12 AM
Subject: Dealing with blanks in Insert/Table


>
> Hi,
>
> When you don't specify anything in a html table browsers don't treat it
> like a normal table cell. You don't get the css class applyed to it for
> example. Inserting a @nbsp; in the cell with deal with the problem. My
> old JSP code was littered with conditionals looking for empty strings
> and inserting @nbsp; instead.
>
> Now, is there anyway of doing this in tapestry with the @Insert and
> @Table components?
>
> I know it's sort of trivial, but I'm sure it'll be the first thing my
> users will comment on if not done correctly
>
> thanks
> Jonny
>
> ---------------------------------------------------------------------
> 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


Dealing with blanks in Insert/Table

Posted by Jonny Wray <jo...@yahoo.com>.
Hi,

When you don't specify anything in a html table browsers don't treat it
like a normal table cell. You don't get the css class applyed to it for
example. Inserting a @nbsp; in the cell with deal with the problem. My
old JSP code was littered with conditionals looking for empty strings
and inserting @nbsp; instead.

Now, is there anyway of doing this in tapestry with the @Insert and
@Table components?

I know it's sort of trivial, but I'm sure it'll be the first thing my
users will comment on if not done correctly

thanks
Jonny

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


Inspector - Engine properties visit = none

Posted by Joerg Latteier <la...@online.de>.
Hi,

probably a typical newbie question but I didnt find an
answer in the archive or in the other docs.

The visit object has definitely been initialized (using a
<SPAN jwcid="@Insert" value="ognl:engine.visit.test.successfulLogin"> 
tag on my page proves it), but the inspector's application engine 
page says "none". 
Does anyone know the possible reason ?

Thanks,
Joerg


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


RE: Javascript form submit

Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
You should invoke this addEventHandler() somewhere within your page, from code that executes while
the Form component is rendering ... that is, from within the body of the Form component.

The Form will collect any or all event handlers are write a consolidated event handler.

Typically, a specialized component (that uses a script specification to generate client-side
JavaScript) will also obtain the Form component and invoke addEventHandler() on it ... all from
within the component's renderComponent() method.

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Tapestry: Java Web Components 
http://jakarta.apache.org/tapestry/
http://javatapestry.blogspot.com

> -----Original Message-----
> From: Glen Stampoultzis [mailto:gstamp@iinet.net.au] 
> Sent: Sunday, January 25, 2004 8:30 PM
> To: tapestry-user@jakarta.apache.org
> Subject: Javascript form submit
> 
> 
> 
> I know I can add a form submit handler by using the following 
> code in a page:
> 
>          IForm form = (IForm) getComponent( "myForm" );
>          form.addEventHandler( ... );
> 
> What I'm not sure of is where the best place to add this code 
> is.  At a 
> guess I'd say adding it to the attach() method would be right 
> but I'm not 
> sure.  I want to avoid the function being called twice.
> 
> 
> 
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
> 
> 
> ---------------------------------------------------------------------
> 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