Re: need please wait notice for slow loading pages

2006-12-07 Thread Marilen Corciovei
I implemented something js based here: http://www.resa-air.com/a5/be
while wanting for the flights results to come up. 

Len
www.len.ro

On Wed, 2006-12-06 at 13:07 -0800, Sam Gendler wrote:

 Does anyone have a mechanism for displaying some kind of please wait
 mechanism while waiting for a slow loading page to be rendered?  I can
 think of a couple of potential solutions:
 
 1.  Submit form, have listener send to a please wait page which does
 nothing but send another request which will actually load the page in
 question.  The problems with this include pages that require lots of
 data in the form submission.  I'd have to stick it in the session or
 throw it in a hidden form.  If it is a lot of data, it could be quite
 slow.  No control over when the browser stops displaying the message -
 usually first byte in.  If there is network latency, that could still
 leave several seconds without the message in view.
 
 2.  If Tapestry supports it, I can render the header of the page,
 including a div that says please wait, then flush to the browser
 before initializing the model.  At the end of the page, render some js
 that will hide the div.  Only problem here is flushing before the page
 is completely rendered.  Is this possible in Tapestry?
 
 Note: I cannot use an ajax update of the entire page and use the
 effects available in an AjaxForm to render the message.  At least, I
 don't think I can.  I haven't done an analysis of the pages in
 question, but I'd really prefer top have my solution work on any page,
 rather than just on ajax-y ones.  It would, however, be nice to have a
 solution which looks the same whether dong an ajax update (using
 preEffect and effect) and when doing a full page reload after a normal
 POST.
 
 Thanks
 
 --sam
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


Re: need please wait notice for slow loading pages

2006-12-07 Thread Stefan Esterer

Hi..

and how did you get this working?

thx
stefan


Marilen Corciovei wrote:
 
 I implemented something js based here: http://www.resa-air.com/a5/be
 while wanting for the flights results to come up. 
 
 Len
 www.len.ro
 
 On Wed, 2006-12-06 at 13:07 -0800, Sam Gendler wrote:
 
 Does anyone have a mechanism for displaying some kind of please wait
 mechanism while waiting for a slow loading page to be rendered?  I can
 think of a couple of potential solutions:
 
 1.  Submit form, have listener send to a please wait page which does
 nothing but send another request which will actually load the page in
 question.  The problems with this include pages that require lots of
 data in the form submission.  I'd have to stick it in the session or
 throw it in a hidden form.  If it is a lot of data, it could be quite
 slow.  No control over when the browser stops displaying the message -
 usually first byte in.  If there is network latency, that could still
 leave several seconds without the message in view.
 
 2.  If Tapestry supports it, I can render the header of the page,
 including a div that says please wait, then flush to the browser
 before initializing the model.  At the end of the page, render some js
 that will hide the div.  Only problem here is flushing before the page
 is completely rendered.  Is this possible in Tapestry?
 
 Note: I cannot use an ajax update of the entire page and use the
 effects available in an AjaxForm to render the message.  At least, I
 don't think I can.  I haven't done an analysis of the pages in
 question, but I'd really prefer top have my solution work on any page,
 rather than just on ajax-y ones.  It would, however, be nice to have a
 solution which looks the same whether dong an ajax update (using
 preEffect and effect) and when doing a full page reload after a normal
 POST.
 
 Thanks
 
 --sam
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/need-%22please-wait%22-notice-for-slow-loading-pages-tf2770707.html#a7735720
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: need please wait notice for slow loading pages

2006-12-07 Thread Marilen Corciovei
The concept is simple. You have 2 pages. The one from which you go and
the one which is supposed to follow which is rather slow. The first page
contains a hidden div which gets visible when the user submits the form.
This div is the one which you see with the animated gif. When the slow
page has finished it's load it will replace the first page. This is
based on the fact that the browser will keep the old page until the new
one is loaded.

input jwcid=@Submit
 listener=ognl:listeners.validateAction
 value=message:validate
 onClick=doWait(this, false);
/

The doWait just shows the hidden div/iframe. The only complicated part
was to make the div/iframe about the combo boxes. If this is what you
need I could create a working simple example.

Len 
www.len.ro


On Thu, 2006-12-07 at 01:24 -0800, Stefan Esterer wrote:

 Hi..
 
 and how did you get this working?
 
 thx
 stefan
 
 
 Marilen Corciovei wrote:
  
  I implemented something js based here: http://www.resa-air.com/a5/be
  while wanting for the flights results to come up. 
  
  Len
  www.len.ro
  
  On Wed, 2006-12-06 at 13:07 -0800, Sam Gendler wrote:
  
  Does anyone have a mechanism for displaying some kind of please wait
  mechanism while waiting for a slow loading page to be rendered?  I can
  think of a couple of potential solutions:
  
  1.  Submit form, have listener send to a please wait page which does
  nothing but send another request which will actually load the page in
  question.  The problems with this include pages that require lots of
  data in the form submission.  I'd have to stick it in the session or
  throw it in a hidden form.  If it is a lot of data, it could be quite
  slow.  No control over when the browser stops displaying the message -
  usually first byte in.  If there is network latency, that could still
  leave several seconds without the message in view.
  
  2.  If Tapestry supports it, I can render the header of the page,
  including a div that says please wait, then flush to the browser
  before initializing the model.  At the end of the page, render some js
  that will hide the div.  Only problem here is flushing before the page
  is completely rendered.  Is this possible in Tapestry?
  
  Note: I cannot use an ajax update of the entire page and use the
  effects available in an AjaxForm to render the message.  At least, I
  don't think I can.  I haven't done an analysis of the pages in
  question, but I'd really prefer top have my solution work on any page,
  rather than just on ajax-y ones.  It would, however, be nice to have a
  solution which looks the same whether dong an ajax update (using
  preEffect and effect) and when doing a full page reload after a normal
  POST.
  
  Thanks
  
  --sam
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 


Re: need please wait notice for slow loading pages

2006-12-07 Thread Stefan Esterer

Hi!

thx for your helpful description!
if you cound create a little simple example it would be great.

thx for your effort
stefan


Marilen Corciovei wrote:
 
 The concept is simple. You have 2 pages. The one from which you go and
 the one which is supposed to follow which is rather slow. The first page
 contains a hidden div which gets visible when the user submits the form.
 This div is the one which you see with the animated gif. When the slow
 page has finished it's load it will replace the first page. This is
 based on the fact that the browser will keep the old page until the new
 one is loaded.
 
 input jwcid=@Submit
  listener=ognl:listeners.validateAction
  value=message:validate
  onClick=doWait(this, false);
 /
 
 The doWait just shows the hidden div/iframe. The only complicated part
 was to make the div/iframe about the combo boxes. If this is what you
 need I could create a working simple example.
 
 Len 
 www.len.ro
 
 
 On Thu, 2006-12-07 at 01:24 -0800, Stefan Esterer wrote:
 
 Hi..
 
 and how did you get this working?
 
 thx
 stefan
 
 
 Marilen Corciovei wrote:
  
  I implemented something js based here: http://www.resa-air.com/a5/be
  while wanting for the flights results to come up. 
  
  Len
  www.len.ro
  
  On Wed, 2006-12-06 at 13:07 -0800, Sam Gendler wrote:
  
  Does anyone have a mechanism for displaying some kind of please wait
  mechanism while waiting for a slow loading page to be rendered?  I can
  think of a couple of potential solutions:
  
  1.  Submit form, have listener send to a please wait page which does
  nothing but send another request which will actually load the page in
  question.  The problems with this include pages that require lots of
  data in the form submission.  I'd have to stick it in the session or
  throw it in a hidden form.  If it is a lot of data, it could be quite
  slow.  No control over when the browser stops displaying the message -
  usually first byte in.  If there is network latency, that could still
  leave several seconds without the message in view.
  
  2.  If Tapestry supports it, I can render the header of the page,
  including a div that says please wait, then flush to the browser
  before initializing the model.  At the end of the page, render some js
  that will hide the div.  Only problem here is flushing before the page
  is completely rendered.  Is this possible in Tapestry?
  
  Note: I cannot use an ajax update of the entire page and use the
  effects available in an AjaxForm to render the message.  At least, I
  don't think I can.  I haven't done an analysis of the pages in
  question, but I'd really prefer top have my solution work on any page,
  rather than just on ajax-y ones.  It would, however, be nice to have a
  solution which looks the same whether dong an ajax update (using
  preEffect and effect) and when doing a full page reload after a normal
  POST.
  
  Thanks
  
  --sam
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
 
 

-- 
View this message in context: 
http://www.nabble.com/need-%22please-wait%22-notice-for-slow-loading-pages-tf2770707.html#a7736096
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Tomcat hangs - Tapestry issue or what?

2006-12-07 Thread Marcus.Schulte
If you're running on Java 5, fire up Jconsole and have a look at 
Threads Tab. It'll tell you where your threads are hanging.
A common problem is leaking pooled Db-connections - but that's only a
guess. 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 On Behalf Of Malin Ljungh
 Sent: Thursday, December 07, 2006 9:20 AM
 To: Tapestry users
 Subject: Tomcat hangs - Tapestry issue or what?
 
 Hi all!
 
 I have prolem with my Tomcat hangs (sometimes). I can see the 
 following in my logs:
 
 Dec 6, 2006 4:43:13 PM 
 org.apache.tomcat.util.threads.ThreadPool logFull
 SEVERE: All threads (10) are currently busy, waiting. 
 Increase maxThreads
 (10) or check the servlet status
 
 But it occurres even on very low load (one or two users) so I 
 assume it's something wrong here... requests not ending 
 correctly or something. When it works it works very rapidly 
 so it shouldn't be what I do in the request that is the issue.
 
 I really don't believe it's a Tapestry issure but I thought 
 I'd ask here anyway.. Maybe someone has experienced the same problem?
 
 Anyone?
 
 /Malin
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Node not found... any1 :( ? helpp

2006-12-07 Thread kit

Hi, 

Ok it is actually quite ez to reproduce... 

   
@EventListener(targets=chapterChooser,events=onchange,submitForm=f1,async=true)
 
public void getDistricts(IRequestCycle cycle){ 
String a = this.getFormA().getChapter(); 
ArrayList t = new ArrayList(); 
t = c.getDistricts(a); 
districtModel = new ValueLabelPropertySelectionModel(t); 
setDistrictModel(districtModel); 
cycle.getResponseBuilder().updateComponent(districtChooser); 
} 


I am using firefox browser

I notice the problem happen in  
cycle.getResponseBuilder().updateComponent(districtChooser);   line

the fatal exception did not appear after I commented that line... : ( 
-- 
View this message in context: 
http://www.nabble.com/Node-not-found...-any1-%3A%28---helpp-tf2762493.html#a7736559
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tomcat hangs - Tapestry issue or what?

2006-12-07 Thread Malin Ljungh

Thanks Marcus!
The thing is I'm running on hosted environment, I have only an SSH prompt.
I'll see if I can reproduce the problem on my local machine and use the
Jconsole.

For DB access I use Hibernate so I hope it's not leaking db-connections.


On 12/7/06, [EMAIL PROTECTED]  [EMAIL PROTECTED] wrote:


If you're running on Java 5, fire up Jconsole and have a look at
Threads Tab. It'll tell you where your threads are hanging.
A common problem is leaking pooled Db-connections - but that's only a
guess.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Malin Ljungh
 Sent: Thursday, December 07, 2006 9:20 AM
 To: Tapestry users
 Subject: Tomcat hangs - Tapestry issue or what?

 Hi all!

 I have prolem with my Tomcat hangs (sometimes). I can see the
 following in my logs:

 Dec 6, 2006 4:43:13 PM
 org.apache.tomcat.util.threads.ThreadPool logFull
 SEVERE: All threads (10) are currently busy, waiting.
 Increase maxThreads
 (10) or check the servlet status

 But it occurres even on very low load (one or two users) so I
 assume it's something wrong here... requests not ending
 correctly or something. When it works it works very rapidly
 so it shouldn't be what I do in the request that is the issue.

 I really don't believe it's a Tapestry issure but I thought
 I'd ask here anyway.. Maybe someone has experienced the same problem?

 Anyone?

 /Malin


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Re: Re: Custom validator not called when value is empty?

2006-12-07 Thread Sam Gendler

Yeah, you should inject a ValidationDelegate into your page and pass
it to your form as the delegate.  Then, you can stick any arbitrary
error messages in the delegate, attached to particular fields or not.
So long as your error handling in the template renders every error,
rather than just the first one, you should see it, and if you attached
the error to a field, the field will be marked as being in error (the
default is to slap a couple of asterisks after it and place the field
in a div marked with a red class, if I remember correctly).  Any
messages from validation or translation errors are also automatically
added to the delegate. There are some nice examples of this in the
freely available chapters (chapter 3, specifically) of the Enjoy Web
Development with Tapestry e-book.

--sam

On 12/6/06, Malin Ljungh [EMAIL PROTECTED] wrote:

Guys - you're great!

Acually Sam was right - by overriding the getAcceptsNull in my validator and
returning true did the trick.
I also tried overriding the isRequired method but this method never gets
called it seems (?)

Though - the other solution from Francesco is very intresting also!
But I don't really get it - I don't have the getDelegate method in my
page... is there some injection missing here, or how do I do it?


Malin


On 12/5/06, Sam Gendler [EMAIL PROTECTED] wrote:

 Yes, even if you can't get your validator itself to work (and you
 should be able to), you should definitely just add an error message to
 your existing validation delegate, rather than making a custom method
 for each field you want to validate.  That will allow your standard
 error handling mechanism in the view to render the error rather than
 requiring special conditionals within your template.

 --sam


 On 12/4/06, fdegrassi [EMAIL PROTECTED] wrote:
  I think you can add  custom validation messages to your
  ValidationDelegate and display them along with your validators errors.
  It should work more or less like this.
 
  public void doRegister() {
  if (getStart()  getStop()) {
  getDelegate().record(getStartField(), Start should be less than
  Stop);
  return;
  }
  if (getDelegate().getHasErrors())
  return;
 
  // to register stuff 
  // ..
  }
 
  Good luck
 
  Francesco Degrassi
 
 
  Malin Ljungh wrote:
   Thank you guys! You've been very helpful.
  
   I now make the validation in submit but it's not pretty; in the submit
   listener I have this:
  
   if(!validateFieldX()) {
 setFieldXValid(false);
 return null;
   }
  
   and in the html I have an @If to display validation message if
 validation
   has failed.
   Is there a neater way or is this how it is done?
  
   Malin
  
   On 12/3/06, Sam Gendler [EMAIL PROTECTED] wrote:
  
   Why not just build the set of validators for the field dynamically?
   Assuming you can determine whether the field should be required by
 the
   time the field rewinds (rather than being dependant on something not
   yet rewound), then you can include the required validator in the list
   only if it is actually required.  However, since the 'required'
   validator is obviously called whether the field has a value or not, I
   would suggest taking a look at the source for that validator to
   determine where you have gone wrong with yours.  It is clearly
   possible. Without seeing your source, that's about the best I can
   suggest.
  
   --sam
  
  
   On 12/2/06, Malin Ljungh [EMAIL PROTECTED] wrote:
Good evening!
   
I have written my own validator which works excellent - as long as
 a
   value
is submitted in the field to be validated. Have I missed something
   here?
What should I do?
   
To add a required validator may seem to be the obvious solution but
   the
thing is that the field is not always required - it depends.
   
Cheers
Malin
   
   
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: need please wait notice for slow loading pages

2006-12-07 Thread Marilen Corciovei
Here it is:
http://www.len.ro/work/articles/please-wait-tapestry-component/view

hope it helps,
Len

On Thu, 2006-12-07 at 01:53 -0800, Stefan Esterer wrote:

 Hi!
 
 thx for your helpful description!
 if you cound create a little simple example it would be great.
 
 thx for your effort
 stefan
 
 
 Marilen Corciovei wrote:
  
  The concept is simple. You have 2 pages. The one from which you go and
  the one which is supposed to follow which is rather slow. The first page
  contains a hidden div which gets visible when the user submits the form.
  This div is the one which you see with the animated gif. When the slow
  page has finished it's load it will replace the first page. This is
  based on the fact that the browser will keep the old page until the new
  one is loaded.
  
  input jwcid=@Submit
   listener=ognl:listeners.validateAction
   value=message:validate
   onClick=doWait(this, false);
  /
  
  The doWait just shows the hidden div/iframe. The only complicated part
  was to make the div/iframe about the combo boxes. If this is what you
  need I could create a working simple example.
  
  Len 
  www.len.ro
  
  
  On Thu, 2006-12-07 at 01:24 -0800, Stefan Esterer wrote:
  
  Hi..
  
  and how did you get this working?
  
  thx
  stefan
  
  
  Marilen Corciovei wrote:
   
   I implemented something js based here: http://www.resa-air.com/a5/be
   while wanting for the flights results to come up. 
   
   Len
   www.len.ro
   
   On Wed, 2006-12-06 at 13:07 -0800, Sam Gendler wrote:
   
   Does anyone have a mechanism for displaying some kind of please wait
   mechanism while waiting for a slow loading page to be rendered?  I can
   think of a couple of potential solutions:
   
   1.  Submit form, have listener send to a please wait page which does
   nothing but send another request which will actually load the page in
   question.  The problems with this include pages that require lots of
   data in the form submission.  I'd have to stick it in the session or
   throw it in a hidden form.  If it is a lot of data, it could be quite
   slow.  No control over when the browser stops displaying the message -
   usually first byte in.  If there is network latency, that could still
   leave several seconds without the message in view.
   
   2.  If Tapestry supports it, I can render the header of the page,
   including a div that says please wait, then flush to the browser
   before initializing the model.  At the end of the page, render some js
   that will hide the div.  Only problem here is flushing before the page
   is completely rendered.  Is this possible in Tapestry?
   
   Note: I cannot use an ajax update of the entire page and use the
   effects available in an AjaxForm to render the message.  At least, I
   don't think I can.  I haven't done an analysis of the pages in
   question, but I'd really prefer top have my solution work on any page,
   rather than just on ajax-y ones.  It would, however, be nice to have a
   solution which looks the same whether dong an ajax update (using
   preEffect and effect) and when doing a full page reload after a normal
   POST.
   
   Thanks
   
   --sam
   
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   
   
   
  
  
  
 


Re: Re: Tomcat hangs - Tapestry issue or what?

2006-12-07 Thread Sam Gendler

if you have ssh access, then you can easily connect Jconsole to your
application via an ssh tunnel.  Ssh allows you to set up a port on
your local machine which will simple transfer every byte received
across the ssh connection to any arbitrary port and host on the other
side of the connection.   don't know anything about Jconsole, but as a
generic example, let's pretend Jconsol needs to connect to your server
on port 8081.  In that case, you would run the following command on
your local machine:

ssh -L8081:localhost:8081 my.remotehost.com

This will cause any connection to port 8081 on your local machine (the
first 8081) to be tunneled through the connection to port 8081 on a
machine called localhost at the other end of the connection.  In this
case, that means the machine you are ssh'd into.  You could also give
a hostname which would be resolved on the server machine, so you can
use hostnames that aren't available to the internet itself.  Now, you
can just tell Jconsole to connect to localhost on port 8081 and all of
its traffic will magically cross your ssh tunnel.  You can tunnel
anything through ssh this way.  It is VERY handy when dealing with
remote hosts, particularly if you've got a network of machines that
are not directly accessible to the internet.  Open up ssh on one
machine with limited functionality/accessibility and you can then have
access to every other machine it can see, including those it shares
the 'secured' network with, even if you need more than terminal
access.  You can even tunnel X across such a connection, allowing you
to run gui apps on your remote hosts.  A crucial ability when you get
an app that requires X in order to run the installer (not as rare as
you'd think).  This should also work for remote debugging,
incidentally.

--sam



On 12/7/06, Malin Ljungh [EMAIL PROTECTED] wrote:

Thanks Marcus!
The thing is I'm running on hosted environment, I have only an SSH prompt.
I'll see if I can reproduce the problem on my local machine and use the
Jconsole.

For DB access I use Hibernate so I hope it's not leaking db-connections.


On 12/7/06, [EMAIL PROTECTED]  [EMAIL PROTECTED] wrote:

 If you're running on Java 5, fire up Jconsole and have a look at
 Threads Tab. It'll tell you where your threads are hanging.
 A common problem is leaking pooled Db-connections - but that's only a
 guess.

  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  On Behalf Of Malin Ljungh
  Sent: Thursday, December 07, 2006 9:20 AM
  To: Tapestry users
  Subject: Tomcat hangs - Tapestry issue or what?
 
  Hi all!
 
  I have prolem with my Tomcat hangs (sometimes). I can see the
  following in my logs:
 
  Dec 6, 2006 4:43:13 PM
  org.apache.tomcat.util.threads.ThreadPool logFull
  SEVERE: All threads (10) are currently busy, waiting.
  Increase maxThreads
  (10) or check the servlet status
 
  But it occurres even on very low load (one or two users) so I
  assume it's something wrong here... requests not ending
  correctly or something. When it works it works very rapidly
  so it shouldn't be what I do in the request that is the issue.
 
  I really don't believe it's a Tapestry issure but I thought
  I'd ask here anyway.. Maybe someone has experienced the same problem?
 
  Anyone?
 
  /Malin
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: need please wait notice for slow loading pages

2006-12-07 Thread Sam Gendler

I thought about doing that, but I wasn't convinced I could rely on all
browsers leaving the page visible until it received content for the
next page.  Have you used this in IE 6 and 7, Firefox 1.5 and 2, and
Safari 2 by any chance? If not, I guess I'll check it out. It's
probably more typing than my solution because of the number of onClick
handlers I'll have to add, but it is a lot simpler and less likely to
have side effects. Thanks.

--sam


On 12/7/06, Marilen Corciovei [EMAIL PROTECTED] wrote:

Here it is:
http://www.len.ro/work/articles/please-wait-tapestry-component/view

hope it helps,
Len

On Thu, 2006-12-07 at 01:53 -0800, Stefan Esterer wrote:

 Hi!

 thx for your helpful description!
 if you cound create a little simple example it would be great.

 thx for your effort
 stefan


 Marilen Corciovei wrote:
 
  The concept is simple. You have 2 pages. The one from which you go and
  the one which is supposed to follow which is rather slow. The first page
  contains a hidden div which gets visible when the user submits the form.
  This div is the one which you see with the animated gif. When the slow
  page has finished it's load it will replace the first page. This is
  based on the fact that the browser will keep the old page until the new
  one is loaded.
 
  input jwcid=@Submit
   listener=ognl:listeners.validateAction
   value=message:validate
   onClick=doWait(this, false);
  /
 
  The doWait just shows the hidden div/iframe. The only complicated part
  was to make the div/iframe about the combo boxes. If this is what you
  need I could create a working simple example.
 
  Len
  www.len.ro
 
 
  On Thu, 2006-12-07 at 01:24 -0800, Stefan Esterer wrote:
 
  Hi..
 
  and how did you get this working?
 
  thx
  stefan
 
 
  Marilen Corciovei wrote:
  
   I implemented something js based here: http://www.resa-air.com/a5/be
   while wanting for the flights results to come up.
  
   Len
   www.len.ro
  
   On Wed, 2006-12-06 at 13:07 -0800, Sam Gendler wrote:
  
   Does anyone have a mechanism for displaying some kind of please wait
   mechanism while waiting for a slow loading page to be rendered?  I can
   think of a couple of potential solutions:
  
   1.  Submit form, have listener send to a please wait page which does
   nothing but send another request which will actually load the page in
   question.  The problems with this include pages that require lots of
   data in the form submission.  I'd have to stick it in the session or
   throw it in a hidden form.  If it is a lot of data, it could be quite
   slow.  No control over when the browser stops displaying the message -
   usually first byte in.  If there is network latency, that could still
   leave several seconds without the message in view.
  
   2.  If Tapestry supports it, I can render the header of the page,
   including a div that says please wait, then flush to the browser
   before initializing the model.  At the end of the page, render some js
   that will hide the div.  Only problem here is flushing before the page
   is completely rendered.  Is this possible in Tapestry?
  
   Note: I cannot use an ajax update of the entire page and use the
   effects available in an AjaxForm to render the message.  At least, I
   don't think I can.  I haven't done an analysis of the pages in
   question, but I'd really prefer top have my solution work on any page,
   rather than just on ajax-y ones.  It would, however, be nice to have a
   solution which looks the same whether dong an ajax update (using
   preEffect and effect) and when doing a full page reload after a normal
   POST.
  
   Thanks
  
   --sam
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
 
 





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: need please wait notice for slow loading pages

2006-12-07 Thread Fred Janon

It's probably more typing than my solution because of the number of

onClick handlers I'll have to add

Not sure if you can do it in your context, but instead of calling the JS
function in all buttons onClick, you could just call it in the FORM
onSubmit...


Re: Re: need please wait notice for slow loading pages

2006-12-07 Thread Marilen Corciovei
On Thu, 2006-12-07 at 03:45 -0800, Sam Gendler wrote:

 I thought about doing that, but I wasn't convinced I could rely on all
 browsers leaving the page visible until it received content for the
 next page.  Have you used this in IE 6 and 7, Firefox 1.5 and 2, and
 Safari 2 by any chance? If not, I guess I'll check it out. It's
 probably more typing than my solution because of the number of onClick
 handlers I'll have to add, but it is a lot simpler and less likely to
 have side effects. Thanks.

When I developed the site last year I tested it in Firefox 1.5, IE 6,
and IE 5 (as the one installed at airline company at that moment). I
think the only problem might arrise if the long waiting part is
somewhere in a component. As far as I understand the process if the
response takes some time to arrive then it's ok, if part of the page is
rendered then a long wait occurs until the rest is fetched then it's not
ok. I payed some attention to get into the first case. I did not got any
complaints since then.

Len
www.len.ro

 --sam
 
 
 On 12/7/06, Marilen Corciovei [EMAIL PROTECTED] wrote:
  Here it is:
  http://www.len.ro/work/articles/please-wait-tapestry-component/view
 
  hope it helps,
  Len
 
  On Thu, 2006-12-07 at 01:53 -0800, Stefan Esterer wrote:
 
   Hi!
  
   thx for your helpful description!
   if you cound create a little simple example it would be great.
  
   thx for your effort
   stefan
  
  
   Marilen Corciovei wrote:
   
The concept is simple. You have 2 pages. The one from which you go and
the one which is supposed to follow which is rather slow. The first page
contains a hidden div which gets visible when the user submits the form.
This div is the one which you see with the animated gif. When the slow
page has finished it's load it will replace the first page. This is
based on the fact that the browser will keep the old page until the new
one is loaded.
   
input jwcid=@Submit
 listener=ognl:listeners.validateAction
 value=message:validate
 onClick=doWait(this, false);
/
   
The doWait just shows the hidden div/iframe. The only complicated part
was to make the div/iframe about the combo boxes. If this is what you
need I could create a working simple example.
   
Len
www.len.ro
   
   
On Thu, 2006-12-07 at 01:24 -0800, Stefan Esterer wrote:
   
Hi..
   
and how did you get this working?
   
thx
stefan
   
   
Marilen Corciovei wrote:

 I implemented something js based here: http://www.resa-air.com/a5/be
 while wanting for the flights results to come up.

 Len
 www.len.ro

 On Wed, 2006-12-06 at 13:07 -0800, Sam Gendler wrote:

 Does anyone have a mechanism for displaying some kind of please wait
 mechanism while waiting for a slow loading page to be rendered?  I 
 can
 think of a couple of potential solutions:

 1.  Submit form, have listener send to a please wait page which does
 nothing but send another request which will actually load the page 
 in
 question.  The problems with this include pages that require lots of
 data in the form submission.  I'd have to stick it in the session or
 throw it in a hidden form.  If it is a lot of data, it could be 
 quite
 slow.  No control over when the browser stops displaying the 
 message -
 usually first byte in.  If there is network latency, that could 
 still
 leave several seconds without the message in view.

 2.  If Tapestry supports it, I can render the header of the page,
 including a div that says please wait, then flush to the browser
 before initializing the model.  At the end of the page, render some 
 js
 that will hide the div.  Only problem here is flushing before the 
 page
 is completely rendered.  Is this possible in Tapestry?

 Note: I cannot use an ajax update of the entire page and use the
 effects available in an AjaxForm to render the message.  At least, I
 don't think I can.  I haven't done an analysis of the pages in
 question, but I'd really prefer top have my solution work on any 
 page,
 rather than just on ajax-y ones.  It would, however, be nice to 
 have a
 solution which looks the same whether dong an ajax update (using
 preEffect and effect) and when doing a full page reload after a 
 normal
 POST.

 Thanks

 --sam

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



   
   
   
  
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


Re: Re: Re: need please wait notice for slow loading pages

2006-12-07 Thread Sam Gendler

On 12/7/06, Fred Janon [EMAIL PROTECTED] wrote:

It's probably more typing than my solution because of the number of
onClick handlers I'll have to add

Not sure if you can do it in your context, but instead of calling the JS
function in all buttons onClick, you could just call it in the FORM
onSubmit...




Unfortunately, my problem is that I need it on plain links as well as
in forms.  Nothing I can't fix by just assigning a new class to any
link that needs the handler and then adding the handler via a
javascript method which iterates over all elements with the
'pleaseWait' class.

--sam

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: need please wait notice for slow loading pages

2006-12-07 Thread Marilen Corciovei
To avoid making multiple changes you could wrap your @Submit component
into a @CustomSubmit which passes all informal parameters and add's the
onClick and then overwritting the @Submit with @CustomSubmit in
the .application (worked in 3.* don't know about 4.*)

Len
www.len.ro

On Thu, 2006-12-07 at 20:56 +0900, Fred Janon wrote:

 It's probably more typing than my solution because of the number of
 onClick handlers I'll have to add
 
 Not sure if you can do it in your context, but instead of calling the JS
 function in all buttons onClick, you could just call it in the FORM
 onSubmit...


Re: Re: Re: need please wait notice for slow loading pages

2006-12-07 Thread Fred Janon


Unfortunately, my problem is that I need it on plain links as well as
in forms.  Nothing I can't fix by just assigning a new class to any
link that needs the handler and then adding the handler via a
javascript method which iterates over all elements with the
'pleaseWait' class.

--sam



Sounds like the 'best' solution in your case...


Re: Re: Re: need please wait notice for slow loading pages

2006-12-07 Thread Danny Angus
if you can get the first bytes of the second (slow) page loaded you can 
start that page with the html for a div to appear in the centre of the 
screen in front of the real content.
The last thing on the page should be the html which moves this either away 
to the left (negative coordinates) of the screen or to the back behind 
the real content.

this e.g works in ie (but not f-fox, that is left as an exercise for the 
reader) :

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
head
meta http-equiv=Content-Type content=text/html; charset=utf-8 /
titleUntitled Document/title
style type=text/css
!--
.wait {
background-color: #FF;
position: absolute;
visibility: visible;
z-index: 10;
left: 90px;
top: 40px;
width: 200px;
height: 200px;
}
--
/style
/head

body onload=waitOne.style.zIndex='-10'

div class=wait id=waitOnePlease Wait/div
div

img src=http://www.direct.gov.uk/assetRoot/04/01/85/19/04018519.jpg; 
width=100 height=100 /
img src=http://www.arroyofest.org/images/T-shirt%20back.JPG; width=100 
height=100 /
img src=http://www.direct.gov.uk/assetRoot/04/01/85/19/04018519.jpg; 
width=100 height=100 //div

/body
/html

[EMAIL PROTECTED] wrote on 07/12/2006 12:17:16:

 On 12/7/06, Fred Janon [EMAIL PROTECTED] wrote:
  It's probably more typing than my solution because of the number of
  onClick handlers I'll have to add
 
  Not sure if you can do it in your context, but instead of calling the 
JS
  function in all buttons onClick, you could just call it in the FORM
  onSubmit...
 
 
 
 Unfortunately, my problem is that I need it on plain links as well as
 in forms.  Nothing I can't fix by just assigning a new class to any
 link that needs the handler and then adding the handler via a
 javascript method which iterates over all elements with the
 'pleaseWait' class.
 
 --sam
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


***
The information in this e-mail is confidential and for use by the addressee(s) 
only. If you are not the intended recipient please delete the message from your 
computer. You may not copy or forward it or use or disclose its contents to any 
other person. As Internet communications are capable of data corruption Student 
Loans Company Limited does not accept any responsibility for changes made to 
this message after it was sent. For this reason it may be inappropriate to rely 
on advice or opinions contained in an e-mail without obtaining written 
confirmation of it. Neither Student Loans Company Limited or the sender accepts 
any liability or responsibility for viruses as it is your responsibility to 
scan attachments (if any). Opinions and views expressed in this e-mail are 
those of the sender and may not reflect the opinions and views of The Student 
Loans Company Limited.

This footnote also confirms that this email message has been swept for the 
presence of computer viruses.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: XTile and cycle.activate

2006-12-07 Thread MattHouston

Thanks for your answer.

I've just a problem with your solution : ILink link =
svc.getLink(false,params) doesn't work. This instruction stop the execution
but don't get any error message...
I've tested it with differents solutions :
1/
@InjectPage(NoviaMail_ReadMail)
public abstract ReadMail getReadMail();
   
   ILink link = svc.getLink(false, getReadMail());

2/ ILink link = svc.getLink(false, NoviaMail_ReadMail);

No one works... Have you got any idea ?



Jessek wrote:
 
 I should clarify, this all works when using the normal core ajax
 services provided in 4.1.1, not specifically in the XTile service.
 
 On 12/6/06, Jesse Kuhnert [EMAIL PROTECTED] wrote:
 FYI, this all just works as expected in t 4.1.1. (the solution is
 still a little questionable but it's the best default behavior I could
 think of so far)

 On 12/6/06, Robert Zeigler [EMAIL PROTECTED] wrote:
  cycle.activate will make the activated page be the page that renders.
  However... the xtile service doesn't result in a page render. It
 results
  in an ajax response; hence, cycle.activate won't work. What you might
  consider doing is putting the url of the page you want to activate into
  the service parameters.  Then you could just replace the document
  location with the new url. Something along the lines of:
 
  else {
 IEngineSerivce svc =
 cycle.getEngine().getService(Tapestry.PAGE_SERVICE);
 Object[] params = new Object[] { NoviaMail_ReadMail };
 ILink link = svc.getLink(false,params);
 cycle.setServiceParameters(new Object[]
  {redirect,link.getAbsoluteURL()});
  }
 
  and in javascript, something like:
 
  my_function(params) {
 if (params[0] == redirect) {
   document.location.href=params[1];
   return;
 }
 ...
  }
 
  Something along those lines.
 
  Robert
 
  MattHouston wrote:
   Hi !
  
   I have a probleme using the XTile component and cycle.activate.
   I do sth in AJAX with XTile and in my Java function who handle
 requests,
   sometimes i only receive and send requests to the client, that works
 good.
   But i would like to sometimes not send a request but activate another
 page,
   I thought I can do that with cycle.activate, but it doesn't works...
  
   The code of my function :
  
 public void handleListOfMailsRequest(IRequestCycle cycle) {
 Object[] params = ((RequestCycle)
 cycle).getServiceParameters();
 System.out.println(length parmas : +params.length);
 if (params.length == 0) return;
  
 if (params[0].equals(isNews)) { // works good
   [...]
  
 String[] ret = {mm.getDate(), mm.getFrom(),
 mm.getSubject(),
   mm.getSize(), false, mm.getId()};
 ((RequestCycle)
 cycle).setServiceParameters(ret);
 }
 else { //dont work
 cycle.activate(NoviaMail_ReadMail);
 }
 }
  
   Any help will be apprecated.
   Thanks
  
   MattHouston
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Jesse Kuhnert
 Tapestry/Dojo team member/developer

 Open source based consulting work centered around
 dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

 
 
 -- 
 Jesse Kuhnert
 Tapestry/Dojo team member/developer
 
 Open source based consulting work centered around
 dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/XTile-and-cycle.activate-tf2769341.html#a7738544
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: about Beanform and JPA (persistence)

2006-12-07 Thread DJ Gredler

I haven't used EntityManagers directly, but your code looks fine to me,
especially if it works ;-)

You may want to wrap your flush( ) call in a try/catch block in case
something goes wrong, and roll back the transaction in the catch block.

Once you get more comfortable with things (and if you're using Hibernate),
you may want to check out some of the integration packages (Tapernate,
Honeycomb, etc) that handle transaction scoping for you. Spring might also
be a good option if you end up splitting your app up into presentation /
service / persistence layers.

On 12/6/06, Cyrille37 [EMAIL PROTECTED] wrote:


Hello,

I'm coming back with a beginner question ;-)

After 3 weeks of Java Web App discovering, I'm actually working with
Tapestry 4.0.2, Netbeans 5.5 which give me easy data persistence support
with JPA Toplink essential, and Tomcat5.5 and Mysql5.

So I've finaly got something working with Beanform and JPA and I come to
you to get comments and ideas and best practice.

For the persistence, the method I've found is to do the following :

* To remember with object I'm playing with :

@Persist(client)
public abstract int getProductId();
public abstract void setProductId(int productId);

* To manage the Beanform's bean :

private Product _product ;
public Product getProduct()
{
if( this._product==null  this.getProductId()0 )
{
this.setProduct(  this.loadProduct( this.getProductId ()) );
}
return this._product ;
}

public void setProduct( Product product )
{
this._product = product ;
}

* For initializing the page at the first time :

public void activateExternalPage(Object[] parameters, IRequestCycle
cycle)
{
int pid = Integer.parseInt( parameters[0].toString());
setProductId( pid );
this.setProduct ( this.loadProduct(pid) );
}

* And finally to implement the Beanform 'save' listener :

public String save()
{
System.out.println( ProductEdit.save() );
if( this.getDelegate().getHasErrors() )
return null;
EntityManager em = getDataManagerFactory().GetEntityManager();
/*** I find that method a beat strange but it works ! ***/
em.getTransaction ().begin();
em.flush();
em.getTransaction().commit();

return Home;
}

Thanks to have read my poetry ;-)
Cyrille.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: need please wait notice for slow loading pages

2006-12-07 Thread Marilen Corciovei
It looks as you add the content to it's body. An example is here:
http://www.resa-air.com/a5/be

Len

On Thu, 2006-12-07 at 20:09 +0530, Karthik N wrote:

 len,
 
 on your blog can you please post a screen shot of how the Please wait
 component display looks?
 
 Thanks


Re: XTile and cycle.activate

2006-12-07 Thread MattHouston

Re

I have found another way to make this work.

Thanks for all
CU

MattHouston


MattHouston wrote:
 
 Hi !
 
 I have a probleme using the XTile component and cycle.activate.
 I do sth in AJAX with XTile and in my Java function who handle requests,
 sometimes i only receive and send requests to the client, that works good.
 But i would like to sometimes not send a request but activate another
 page, I thought I can do that with cycle.activate, but it doesn't works...
 
 The code of my function : 
 
   public void handleListOfMailsRequest(IRequestCycle cycle) {
   Object[] params = ((RequestCycle) cycle).getServiceParameters();
   System.out.println(length parmas : +params.length);
   if (params.length == 0) return;
   
   if (params[0].equals(isNews)) { // works good
 [...]
   
   String[] ret = {mm.getDate(), mm.getFrom(), 
 mm.getSubject(),
 mm.getSize(), false, mm.getId()};
   ((RequestCycle) cycle).setServiceParameters(ret);
   }
   else { //dont work
   cycle.activate(NoviaMail_ReadMail);
   }
   }
 
 Any help will be apprecated.
 Thanks
 
 MattHouston
 

-- 
View this message in context: 
http://www.nabble.com/XTile-and-cycle.activate-tf2769341.html#a7741161
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



@Persist weirdness

2006-12-07 Thread Dan Adams
I need a sanity check. :) So I have the following map of maps which I
need to persist in the user session:

@Persist
public abstract MapString, MapString, Object getPageParameters();
public abstract void setPageParameters(MapString, MapString, Object
params);

Everything seems to work fine except that if I clear my session by
deleting my cookies and come back to the page getPageParameters()
returns the same map rather than null. I mean, it should return null
right? I'm running this in Jetty in case it matters.

-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Securing URL Parameters

2006-12-07 Thread Damian Krzeminski

Dennis Sinelnikov wrote:

Dear Fellow Tapestriers :),

I need to implement an EngineService that will return a specific file 
living on a filesystem.  I need to pass a parameter in the url that 
specifies which file to return.  I've searched the tapestry list serve 
archives for an elegant solution, but nothing really caught my eye.  My 
initial thought was to do a one-way hash of the file and pass it via the 
parameter in the url; when the url comes back the service would 
replicate the process by comparing the hashes of all the files and see 
which one matches; the one matches return to the user.


I'm curious to see what others are doing in securing urls from malicious 
users.  Sample code or any suggestions are greatly appreciated.


Thanks,
Dennis


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




I was looking for elegant solution for that problem as well. I ended up doing something similar to 
AssetService, which is I guess what you are trying to do as well.


The code is here:
http://scm.sipfoundry.org/rep/sipX/main/sipXconfig/web/src/org/sipfoundry/sipxconfig/components/DownloadService.java
http://scm.sipfoundry.org/rep/sipX/main/sipXconfig/web/src/org/sipfoundry/sipxconfig/components/DownloadLink.java

It's in subversion repository - you can get entire project from here: 
http://scm.sipfoundry.org/rep/sipX/main/sipXconfig


If anybody comes up with something better I'd like to know that.
Damian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Manually initializing persistent properties

2006-12-07 Thread Dan Adams
What is the correct place to initialize a @Persisted property?
pageAttached() is too early it seems as the properties haven't been
updated but pageBeginRender() is too later since you have to update them
before rendering begins.

-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Manually initializing persistent properties

2006-12-07 Thread Martin Strand
I do it in pageBeginRender. I suppose you could use pageValidate if you  
need it a little earlier.


On Thu, 07 Dec 2006 17:20:45 +0100, Dan Adams [EMAIL PROTECTED] wrote:


What is the correct place to initialize a @Persisted property?
pageAttached() is too early it seems as the properties haven't been
updated but pageBeginRender() is too later since you have to update them
before rendering begins.




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tapestry and Spring 2.0

2006-12-07 Thread Skorpien126

Spring 2 is released and I want to know if it´s compatible with tapestry
4.0.2 or even with 4.1??? Is there maybe a new Tapestry-spring.jar
available??

-- 
View this message in context: 
http://www.nabble.com/Tapestry-and-Spring-2.0-tf2775514.html#a7742600
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tapestry and Spring 2.0

2006-12-07 Thread Daniel Tabuenca

I think it should be compatible, but don't quote me on that. In any
case I am using Spring 2 with tapestry without using tapestry-spring.
I use spring-2.0 @Configurable annotation to allow me to inject my
beans into any object including Tapestry pages and Hibernate entities.
I also use spring-annotations an add-on that allows me to define
spring beans using anotations rather than a context.xml. I'm quite
happy with both.


On 12/7/06, Skorpien126 [EMAIL PROTECTED] wrote:


Spring 2 is released and I want to know if it´s compatible with tapestry
4.0.2 or even with 4.1??? Is there maybe a new Tapestry-spring.jar
available??

--
View this message in context: 
http://www.nabble.com/Tapestry-and-Spring-2.0-tf2775514.html#a7742600
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tapestry and Spring 2.0

2006-12-07 Thread Kalle Korhonen

We are using Spring 2.0 and Tapestry 4.0.2 together with Trails 1.0-SNAPSHOT.
You can quote me on it :) 2.0 interfaces are pretty much the same as in
1.2.6. Context file schema has some minor changes and some test classes have
changed. Overall, there should be no problem switching.

Kalle

On 12/7/06, Daniel Tabuenca [EMAIL PROTECTED] wrote:


I think it should be compatible, but don't quote me on that. In any
case I am using Spring 2 with tapestry without using tapestry-spring.
I use spring-2.0 @Configurable annotation to allow me to inject my
beans into any object including Tapestry pages and Hibernate entities.
I also use spring-annotations an add-on that allows me to define
spring beans using anotations rather than a context.xml. I'm quite
happy with both.


On 12/7/06, Skorpien126 [EMAIL PROTECTED] wrote:

 Spring 2 is released and I want to know if it´s compatible with tapestry
 4.0.2 or even with 4.1??? Is there maybe a new Tapestry-spring.jar
 available??

 --
 View this message in context:
http://www.nabble.com/Tapestry-and-Spring-2.0-tf2775514.html#a7742600
 Sent from the Tapestry - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: @Persist weirdness

2006-12-07 Thread Dan Adams
So I added an @InitialValue which calls a method to create the initial
map and this seems to have fixed it. After reading the enhancement
source I found out something tricky about this.

SpecifiedPropertyWorker.addReinitializer gets called if you don't set an
initial value and it basically does (for property 'foo'):

in finishLoad():
foo$default = foo;

in pageDetached():
foo = foo$default;

now, in my class in finishLoad I was doing essentially:
foo = new HashMap();

So on the first call to the page this would set the default value of the
property to that specific object. So if you reset your session you would
get the same object back when it initialized it to the default value.

However, when you use @InitialValue the enhancement adds the following:

finishLoad():
foo$initialValueBinding = foo$initialValueBinding.createBinding(this);
foo = (evaluate the binding);

pageDetached():
foo = (evaluate the binding);

So it appears that if you are going to @Persist an object and need the
initial value to not be null you should be sure to use @InitialValue or
otherwise you could end up with some weirdness. In my case it works if
you test it naively but fortunately my test cases were robust enough to
catch it.

On Thu, 2006-12-07 at 10:58 -0500, Dan Adams wrote:
 I need a sanity check. :) So I have the following map of maps which I
 need to persist in the user session:
 
 @Persist
 public abstract MapString, MapString, Object getPageParameters();
 public abstract void setPageParameters(MapString, MapString, Object
 params);
 
 Everything seems to work fine except that if I clear my session by
 deleting my cookies and come back to the page getPageParameters()
 returns the same map rather than null. I mean, it should return null
 right? I'm running this in Jetty in case it matters.
 
-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Textfield inside a @for and different bean translator for each TextField instance

2006-12-07 Thread Jabbar

Hello all,

I have the following,

.page file,

component id=collection type=For
 binding name=source value=channelSetup/
 binding name=value value=currentChannelSetup/
/component

component id=text type=TextField
binding name=value value=currentChannelSetup.field/
binding name=translator value=bean:currentChannel.bean/
/component


.html file

div jwcid=collection

input jwcid=text /

/div

What I want to know is if I can have

binding name=translator value=bean:currentChannel.bean/

or something similar ?


--
Thanks

A Jabbar Azam

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



@Persist and @InitialValue (followup)

2006-12-07 Thread Dan Adams
I've ran into a problem that other people seem to have reported on the
mailing list before. But my unanswered question is: if you use @Persist
and @InitialValue, when does the value get set back from the session?
I've got the same problem someone else did where the property is set to
the same value every time. Thanks.


-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: problem with 4.1.1 snapshot

2006-12-07 Thread Henry Chen
Thanks so much!

-Original Message-
From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 07, 2006 7:56 AM
To: Tapestry users
Subject: Re: problem with 4.1.1 snapshot

You are missing a required library.

http://tapestry.apache.org/tapestry4.1/tapestry-framework/dependencies.html

On 12/7/06, Henry Chen [EMAIL PROTECTED] wrote:
 I tried to use the latest 4.1.1 snapshot in the repository but got the
 following error when I launch the application in the web browser. Can
 anybody tell me why this is happening? I'm using tapestry-acegi. Don't
know
 if that is a problem. I would be very grateful for any help. Thank you.





 javax.servlet.ServletException: Unable to construct service
 tapestry.request.DisableCachingFilter: Error building service
 tapestry.request.DisableCachingFilter: Failure invoking constructor for
 class org.apache.tapestry.services.impl.DisableCachingFilter:
 edu/emory/mathcs/backport/java/util/concurrent/locks/ReentrantLock


org.apache.tapestry.services.impl.WebRequestServicerPipelineBridge.service(W
 ebRequestServicerPipelineBridge.java:60)


$ServletRequestServicer_10f5bf1f257.service($ServletRequestServicer_10f5bf1f
 257.java)


$ServletRequestServicer_10f5bf1f256.service($ServletRequestServicer_10f5bf1f
 256.java)


org.apache.tapestry.request.DecodedRequestInjector.service(DecodedRequestInj
 ector.java:55)


$ServletRequestServicerFilter_10f5bf1f253.service($ServletRequestServicerFil
 ter_10f5bf1f253.java)


$ServletRequestServicerFilter_10f5bf1f252.service($ServletRequestServicerFil
 ter_10f5bf1f252.java)


$ServletRequestServicer_10f5bf1f258.service($ServletRequestServicer_10f5bf1f
 258.java)


com.javaforge.tapestry.acegi.filter.FilterChainAdapter.doFilter(FilterChainA
 dapter.java:43)


org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(Ano
 nymousProcessingFilter.java:125)
 $Filter_10f5bf1f251.doFilter($Filter_10f5bf1f251.java)
 $Filter_10f5bf1f250.doFilter($Filter_10f5bf1f250.java)


com.javaforge.tapestry.acegi.filter.ServletRequestServicerFilterAdapter.serv
 ice(ServletRequestServicerFilterAdapter.java:42)


$ServletRequestServicer_10f5bf1f258.service($ServletRequestServicer_10f5bf1f
 258.java)


com.javaforge.tapestry.acegi.filter.FilterChainAdapter.doFilter(FilterChainA
 dapter.java:43)


org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFil
 ter.java:216)

$FormProcessor_10f5bf1f24f.doFilter($FormProcessor_10f5bf1f24f.java)

$FormProcessor_10f5bf1f24e.doFilter($FormProcessor_10f5bf1f24e.java)


com.javaforge.tapestry.acegi.filter.ServletRequestServicerFilterAdapter.serv
 ice(ServletRequestServicerFilterAdapter.java:42)


$ServletRequestServicer_10f5bf1f258.service($ServletRequestServicer_10f5bf1f
 258.java)


org.apache.tapestry.multipart.MultipartDecoderFilter.service(MultipartDecode
 rFilter.java:52)


$ServletRequestServicerFilter_10f5bf1f247.service($ServletRequestServicerFil
 ter_10f5bf1f247.java)


$ServletRequestServicerFilter_10f5bf1f246.service($ServletRequestServicerFil
 ter_10f5bf1f246.java)


$ServletRequestServicer_10f5bf1f258.service($ServletRequestServicer_10f5bf1f
 258.java)


org.apache.tapestry.services.impl.SetupRequestEncoding.service(SetupRequestE
 ncoding.java:53)


$ServletRequestServicerFilter_10f5bf1f255.service($ServletRequestServicerFil
 ter_10f5bf1f255.java)


$ServletRequestServicerFilter_10f5bf1f254.service($ServletRequestServicerFil
 ter_10f5bf1f254.java)


$ServletRequestServicer_10f5bf1f258.service($ServletRequestServicer_10f5bf1f
 258.java)


com.javaforge.tapestry.acegi.filter.FilterChainAdapter.doFilter(FilterChainA
 dapter.java:43)


org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpS
 essionContextIntegrationFilter.java:195)
 $Filter_10f5bf1f249.doFilter($Filter_10f5bf1f249.java)
 $Filter_10f5bf1f248.doFilter($Filter_10f5bf1f248.java)


com.javaforge.tapestry.acegi.filter.ServletRequestServicerFilterAdapter.serv
 ice(ServletRequestServicerFilterAdapter.java:42)


$ServletRequestServicer_10f5bf1f258.service($ServletRequestServicer_10f5bf1f
 258.java)


$ServletRequestServicer_10f5bf1f241.service($ServletRequestServicer_10f5bf1f
 241.java)


$ServletRequestServicer_10f5bf1f240.service($ServletRequestServicer_10f5bf1f
 240.java)


org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:123
 )

 org.apache.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:104)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.tapestry.RedirectFilter.doFilter(RedirectFilter.java:103)

 root cause

 org.apache.hivemind.ApplicationRuntimeException: Unable to construct
service
 tapestry.request.DisableCachingFilter: Error building service
 tapestry.request.DisableCachingFilter: Failure invoking constructor for
 class org.apache.tapestry.services.impl.DisableCachingFilter:
 

Re: @Persist and @InitialValue (followup)

2006-12-07 Thread Ron Piterman
Yes, it doesn't seem they work together - for me too... (on t4.0)
Cheers,
Ron

Dan Adams wrote:
 I've ran into a problem that other people seem to have reported on the
 mailing list before. But my unanswered question is: if you use @Persist
 and @InitialValue, when does the value get set back from the session?
 I've got the same problem someone else did where the property is set to
 the same value every time. Thanks.
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Dependency management of the tapestry-flash maven distribution

2006-12-07 Thread Renat Zubairov

Hello All,

I've just noticed that tapestry-flash required tapestry and hence
maven loaded tapestry 4.0.1 by default where I'm using currently
4.1.1-SNAPSHOT. What is wrong? Is dependency is incorrect or naming of
the tapestry is not correct in the flash.pom?

--
Best regards,
Renat Zubairov

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dependency management of the tapestry-flash maven distribution

2006-12-07 Thread Jesse Kuhnert

You just need to add some exclusions as done here:

http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/pom.xml?view=markup

On 12/7/06, Renat Zubairov [EMAIL PROTECTED] wrote:

Hello All,

I've just noticed that tapestry-flash required tapestry and hence
maven loaded tapestry 4.0.1 by default where I'm using currently
4.1.1-SNAPSHOT. What is wrong? Is dependency is incorrect or naming of
the tapestry is not correct in the flash.pom?

--
Best regards,
Renat Zubairov

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Html Email Messages

2006-12-07 Thread Dave Kallstrom

In tapestry versions prior to 4.1 we rendered email message using tapestry
with the following code.

BaseHTMLMessagePage sendPage = (BaseHTMLMessagePage) getHtmlPage(inner);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IMarkupWriter writer = new MarkupWriterImpl(text/html, new
PrintWriter(out), new AsciiMarkupFilter());
inner.activate(sendPage);
inner.renderPage(writer);
writer.flush();
subjectAndBody[0] = sendPage.getSubject();
subjectAndBody[1] = out.toString();
inner.cleanup();
getRequestGlobals(cycle).store(cycle);

After recently upgrading to 4.1 this method no longer works.
RequestCycle.renderPage no longer takes an IMarkupWriter but requires a
ResponseBuilder. I've tried the DefaultResponseBuilder which seems to want
to write to the WebResponse instead of the IMarkupWriter that I send it. My
question is how best to make this work again? Do I need to implement a new
ResponseBuilder somehow or extend the DefaultResponseBuilder? Or is there a
better way to render tapestry pages for html email?
--
Dave Kallstrom


Re: @Persist and @InitialValue (followup)

2006-12-07 Thread Dan Adams
So, how do you set the initial value of a Persisted property to
something non-trivial?

On Thu, 2006-12-07 at 17:58 +0100, Ron Piterman wrote:
 Yes, it doesn't seem they work together - for me too... (on t4.0)
 Cheers,
 Ron
 
 Dan Adams wrote:
  I've ran into a problem that other people seem to have reported on the
  mailing list before. But my unanswered question is: if you use @Persist
  and @InitialValue, when does the value get set back from the session?
  I've got the same problem someone else did where the property is set to
  the same value every time. Thanks.
  
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
-- 
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Dependency management of the tapestry-flash maven distribution

2006-12-07 Thread Renat Zubairov

Thanks!

On 07/12/06, Jesse Kuhnert [EMAIL PROTECTED] wrote:

You just need to add some exclusions as done here:

http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/pom.xml?view=markup

On 12/7/06, Renat Zubairov [EMAIL PROTECTED] wrote:
 Hello All,

 I've just noticed that tapestry-flash required tapestry and hence
 maven loaded tapestry 4.0.1 by default where I'm using currently
 4.1.1-SNAPSHOT. What is wrong? Is dependency is incorrect or naming of
 the tapestry is not correct in the flash.pom?

 --
 Best regards,
 Renat Zubairov

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Best regards,
Renat Zubairov

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: Manually initializing persistent properties

2006-12-07 Thread Sam Gendler

pageValidate happens when the page is first activated in the cycle.
Any annotations are also executed at this time, so @InitialValue has
already done its work when pageValidate is called

pageAttached happens just after that. It only fires once per request,
whether rewind or render

activateExternalPage happens next, if it is an IExternalPage, so now
any external parameters are populated

pageBeginRender happens after that.  It fires before the rewind AND
before the render cycle.  So yes, the first time pageBeginRender is
called, your properties have not yet been updated by the rewind cycle.
However, the second time pageBeginRender is called, it is just about
to begin the render cycle, so all of your properties are fully
populated. You can detect whether it is rewinding or rendering by
calling cycle.isRewinding() within the method.

So it is probably best to leave your initialization in
pageBeginRender, since that is the only place you put init code which
is dependant on your external params or which will occur before render
cycle instead of before rewind.  I wind up breaking my pageBeginRender
method up into 4 stages for precisely this reason.

   @InitialValue(ognl:false)
   public abstract boolean isOnceInitialized();
   public abstract void setOnceInitialized(boolean val);

   public final void pageBeginRender(PageEvent event) {
   initPage(event);
   if (!isOnceInitialized()) {
   initOnlyOnce(event);
   setOnceInitialized(true);
   }
   if (getRequestCycle().isRewinding()) {
   initForRewind(event);
   } else {
   initForRender(event);
   }
   }

This is in my base page class(es).  I then simply overload initPage,
initOnlyOnce, initForRewind, and initForRender according to what the
page requires.  It just eliminates having lots of init code in the
same method with conditionals to determine where the code needs to
fire.

--sam


On 12/7/06, Martin Strand [EMAIL PROTECTED] wrote:

I do it in pageBeginRender. I suppose you could use pageValidate if you
need it a little earlier.

On Thu, 07 Dec 2006 17:20:45 +0100, Dan Adams [EMAIL PROTECTED] wrote:

 What is the correct place to initialize a @Persisted property?
 pageAttached() is too early it seems as the properties haven't been
 updated but pageBeginRender() is too later since you have to update them
 before rendering begins.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Html Email Messages

2006-12-07 Thread Sam Gendler

I don't know 4.1, but if you provide a Response and replace the
outputstream, you'll likely get what you want.  You'll just have to
ensure the headers don't get sent, but I believe that is a method you
can overload in the Response.

--sam


On 12/7/06, Dave Kallstrom [EMAIL PROTECTED] wrote:

In tapestry versions prior to 4.1 we rendered email message using tapestry
with the following code.

BaseHTMLMessagePage sendPage = (BaseHTMLMessagePage) getHtmlPage(inner);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IMarkupWriter writer = new MarkupWriterImpl(text/html, new
PrintWriter(out), new AsciiMarkupFilter());
inner.activate(sendPage);
inner.renderPage(writer);
writer.flush();
subjectAndBody[0] = sendPage.getSubject();
subjectAndBody[1] = out.toString();
inner.cleanup();
getRequestGlobals(cycle).store(cycle);

After recently upgrading to 4.1 this method no longer works.
RequestCycle.renderPage no longer takes an IMarkupWriter but requires a
ResponseBuilder. I've tried the DefaultResponseBuilder which seems to want
to write to the WebResponse instead of the IMarkupWriter that I send it. My
question is how best to make this work again? Do I need to implement a new
ResponseBuilder somehow or extend the DefaultResponseBuilder? Or is there a
better way to render tapestry pages for html email?
--
Dave Kallstrom




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Textfield inside a @for and different bean translator for each TextField instance

2006-12-07 Thread Sam Gendler

Assuming currentChannel.bean returns a valid translator object, I
don't see why it shouldn't work.  It would certainly work outside of
the loop.  I do that all the time.

--sam


On 12/7/06, Jabbar [EMAIL PROTECTED] wrote:

Hello all,

I have the following,

.page file,

component id=collection type=For
  binding name=source value=channelSetup/
  binding name=value value=currentChannelSetup/
 /component

component id=text type=TextField
 binding name=value value=currentChannelSetup.field/
 binding name=translator value=bean:currentChannel.bean/
/component


.html file

div jwcid=collection

input jwcid=text /

/div

What I want to know is if I can have

 binding name=translator value=bean:currentChannel.bean/

or something similar ?


--
Thanks

 A Jabbar Azam

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: @Persist weirdness

2006-12-07 Thread Sam Gendler

In general, however, you are advsied not to store mutable objects into
the session.  The mechanism used to persist into the session should be
opaque to the programmer, and it is likely that a persistence
mechanism will only actually store an object if it has changed since
the last time it was stored.  Admittedly, this will work just fine if
you are running on a single host, but it isn't guaranteed to do so.
As soon as you start distributing your sessions around a cluster,
however, you will run into real difficulties, because changes to the
session are only replicated if the reference to a persistent entity
has changed.  Since your reference is to a mutable object, it is
possible to modify the object (by adding or removing a key or value)
without modifying the reference to it.  This would cause the map to
fail to be propagated to the cluster.

For session distribution, there is a nice fix for this problem you can
use.  There is an interface you can implement (the name of which
escapes me) which will allow the session to ask the object whether it
needs to be distributed.  But there is also a base class you can
extend called org.apache.tapestry.BaseSessionStoreOptimized.  If you
look at the javadoc for that object, you'll see the interface name I
was speaking of. BaseSessionStoreOptimized provides a method you can
call whenever you modify your mutable object which will cause the
object to correctly notify the session manager that it needs to be
redistributed.

Now, I have absolutely no idea if the @Persist annotation is smart
enough to check for the existence of the interface in question and
test for modifications as appropriate, but it might be.  But at least
you now know why you should avoid mutable objects in the session.
Maybe the tap devs can fix the annotation if it doesn't already do
this.

--sam


On 12/7/06, Dan Adams [EMAIL PROTECTED] wrote:

So I added an @InitialValue which calls a method to create the initial
map and this seems to have fixed it. After reading the enhancement
source I found out something tricky about this.

SpecifiedPropertyWorker.addReinitializer gets called if you don't set an
initial value and it basically does (for property 'foo'):

in finishLoad():
foo$default = foo;

in pageDetached():
foo = foo$default;

now, in my class in finishLoad I was doing essentially:
foo = new HashMap();

So on the first call to the page this would set the default value of the
property to that specific object. So if you reset your session you would
get the same object back when it initialized it to the default value.

However, when you use @InitialValue the enhancement adds the following:

finishLoad():
foo$initialValueBinding = foo$initialValueBinding.createBinding(this);
foo = (evaluate the binding);

pageDetached():
foo = (evaluate the binding);

So it appears that if you are going to @Persist an object and need the
initial value to not be null you should be sure to use @InitialValue or
otherwise you could end up with some weirdness. In my case it works if
you test it naively but fortunately my test cases were robust enough to
catch it.

On Thu, 2006-12-07 at 10:58 -0500, Dan Adams wrote:
 I need a sanity check. :) So I have the following map of maps which I
 need to persist in the user session:

 @Persist
 public abstract MapString, MapString, Object getPageParameters();
 public abstract void setPageParameters(MapString, MapString, Object
 params);

 Everything seems to work fine except that if I clear my session by
 deleting my cookies and come back to the page getPageParameters()
 returns the same map rather than null. I mean, it should return null
 right? I'm running this in Jetty in case it matters.

--
Dan Adams
Senior Software Engineer
Interactive Factory
617.235.5857


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Decision of whether to use tapestry

2006-12-07 Thread Sam Gendler

I typed up a long response, but then reread your question and I think
maybe I need some clarification. I included my original response below
in case it answers your question. If you are looking for something
that can be included in any page, rendered by any framework, then I'm
not sure you really want to use Tapestry.  The only way you are going
to build something that can be used absolutely anywhere is to render
the poll entirely in html and javascript.  Take a look at dojo for
examples of lots of widgets that can be used in any web page by simply
including the correct js files.  However, dojo does leave the backend
processing as an exercise for the user, rather than providing a
service to handle storing and rendering user input.

The difficult thing in your concept is submitting the results back to
a server which will maintain totals and render them back to the
browser, either graphically, or maybe just as a data structure that
the browser can then use to render graphically.  Tapestry can be used
to do this, fairly easily, but in general, Tapestry is a fairly
stateful framework that is used for building applications rather than
just widgets that can be inserted into other apps. You could implement
an IExternalPage which receives the selected answer and poll id in the
URL, stores the answer against the poll id, and serves up totals.  The
only real caveat is that your tapestry-based pollserver is likely to
be on a different host than the containing page, so you'll have to use
cross domain techniques to allow tapestry to serve up js that can
interact with the template provided in the containing page.  This is
basically just a matter of serving up js as a string and then
eval()'ing that string within the context of the containing document.
There are lots of discussions of cross-domain js on the web, so I'll
leave that to you to research.  You'd have the same problem with any
framework you might choose to implement the backend in.

Now, if you were just talking about building a tapestry poll component
that can be used only in other Tapestry applications, the answer is
definitely yes and I have a fairly detailed answer below:

Yes, it is possible.  There are a lot of parallels between your
component and the contrib:Table component that comes with Tapestry
(although the table is likely to be much more complex).

Just to give you some concepts to refer to in your research, here's
brief outline if what you'd likely do.

Create a poll component that takes some data structure that defines
the poll and the current results (assuming you also want to display
results there). The poll component iterates over each poll answer
rendering an @Block component that is provided by the page template.
The @Block component contains all of the template code necessary to
render a single answer of the poll.  If the user wants a table, they
open the table tag in their template, then include an @Block component
which renders a single table row (or column, depending upon
preference).  You can use a different Block component to render a link
to the results, a submit button, or anything else you care for.

If you provide reasonable defaults, many users will never have to
define a Block at all in order to use your poll.  Your component is
only responsible for providing default layout and data structures, but
everything is overloadable via Blocks.  Something like the following
(I'll use a list this time, just to show the difference):

ul jwcid=[EMAIL PROTECTED] questions=ognl:answers
index=ognl:currentanswer element=literal:ul
   span jwcid=[EMAIL PROTECTED]
   lispan jwcid=@Insert value=ognl:currentAnswer//li
   /span
/ul

My little example above excludes the actual selection mechanism,
submit button, or results display, but all of that is easy enough.
You might find that your default 'Poll' component consists of multiple
sub components - PollView, PollResults, PollSubmit. The little sample
above is probably actually a PollView component which would be wrapped
the Poll component.  The PollView, PollResults, and PollSubmit can be
placed in different locations, relative to each other, by simply
replacing the outer Poll layer, or by using them without an outer Poll
layer.  This is exactly how the table component works, using a
TableView to render the table, a TablePages component to render the
page changing mechanism.  The TableView itself consists of
TableColumns, TableRows, etc.

OK, assuming you are a tapestry novice, that probably went WAY over
your head.  However, it will hopefully give you some keywords to watch
out for as you read documentation.  I recommend that you read the
first 4 chapters of the Enjoy Web Development with Tapestry ebook that
is linked from the tapestry home page.  You should also check out the
tapestry tables tutorial webapp and then look at the source code to
contrib:Table.  You could probably read through all of that in a long
day, if you don't actually implement any of the tutorial code, anyway.
At the 

Re: Re: Tomcat hangs - Tapestry issue or what?

2006-12-07 Thread Malin Ljungh

Thank you guys.

Sam, I totally agree with you. Increasing max threads will only delay my
worries. My ISP has increased max thread size to 40 so at least I'm unable
to reproduce my problem on one or two users.

I've tried to get the JConsole to work with SSH but with no luck, seems to
be tricky... I'll try more another day.
Running JConsole on my local development server works great and I can see
clearly that 3 threads is enough for one user. One thread is mysteriously
always busy, one thread is in use shortly on every request and if I try hard
refreshing I can get another thread running.

I'll talk to my nice ISP and see if they can help me running the JConsole.


Malin

On 12/7/06, Sam Gendler [EMAIL PROTECTED] wrote:


On 12/7/06, Jesse Kuhnert [EMAIL PROTECTED] wrote:
 Increase the max thread size on your tomcat context threadpool. It
 looks to me like the log message is telling you a max of 10 is
 currently allocated for this purpose now. (an abnormally low number)


If this is really only occuring with one or two users on the system,
10 threads should be enough, since no browser will open more than 2
connections to the server at any single instant.  It would appear that
something is preventing threads from returning to the pool as soon as
the request is completed. Bumping the max threads up to a higher
number will give you temporary relief, but doesn't fix the underlying
problem that is preventing you from reusing threads efficiently.  10
is a very low number, however, and you may well find that bumping the
number to 100 will instantly give you enough headroom that you never
see the problem again (with reasonable load, anyway).  But since this
is a hosted server, it is entirely possible you can't bump the
maxThreads number.  In that case, you can complain to your ISP or else
you will have to figure out why the threads aren't being reused.

--sam

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Textfield inside a @for and different bean translator for each TextField instance

2006-12-07 Thread Jabbar

Hello,

Thank for your assistance again! It worked.



On 07/12/06, Sam Gendler [EMAIL PROTECTED] wrote:

Assuming currentChannel.bean returns a valid translator object, I
don't see why it shouldn't work.  It would certainly work outside of
the loop.  I do that all the time.

--sam


On 12/7/06, Jabbar [EMAIL PROTECTED] wrote:
 Hello all,

 I have the following,

 .page file,

 component id=collection type=For
   binding name=source value=channelSetup/
   binding name=value value=currentChannelSetup/
  /component

 component id=text type=TextField
  binding name=value value=currentChannelSetup.field/
  binding name=translator value=bean:currentChannel.bean/
 /component


 .html file

 div jwcid=collection

 input jwcid=text /

 /div

 What I want to know is if I can have

  binding name=translator value=bean:currentChannel.bean/

 or something similar ?


 --
 Thanks

  A Jabbar Azam

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Thanks

A Jabbar Azam

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: about Beanform and JPA (persistence)

2006-12-07 Thread Sam Gendler

I'll clarify a little.  In general, you want to keep persistence code,
ui code, and business rules fairly separate.  This will keep your
application much more flexible as more and more requirements are added
over time.

In your example code, you've got persistence embedded directly in ui
code.  Should you ever decide to replace your perisistence layer with
something else (say, replace toplink with hibernate, ibatis, or even
raw jdbc), you will have to go in and modify every page class you've
built that has persistence code in it.  In a large project, this is
effectively impossible to do without destabilizing the codebase too
much to be acceptable.  Therefore, most well architected apps will
keep all perisistence code in a separate set of interfaces.  So long
as you can create a persistence layer that maintains the same
interface, you can replace one with another very simply.  This is
where dependency injection becomes useful - Instead of injecting a
toplink data access object into your page, you can inject a hibernate
one instead.

But wait, did I just say injecting a dao into the page?  Most of us
would argue you never want to do that, for the following reason.
Suppose you have a method in your DAO which stores an entity into the
database.  If you are using your dao directly in your page class, then
you either have to open and commit a transaction directly in your page
(violating the rule about keeping persistence code out of your ui
layer and once again locking you into a particular transaction
mechanism, preventing you from switching between JDBC transactions,
JTA transactions, etc), or else your DAO itself has to open the
transaction, save the entity, and commit the transaction.  This would
be fine in this circumstance.  Your persistence code would stay in
your persistence layer, but now you have another problem.  Page1 may
store just a single instance of the entity, so including transaction
semantics around that store operation works just fine.  But now you
have to add Page2, and Page2 wants to store two entities.  But if
either store() fails (unique column conflict, for instance), you don't
want to store() either of the entities.  So now your transaction
within the store method won't work, since the first store() will be
fully committed before the second store() fails, offering you no way
to roll back.  So your only option is to implement another DAO method
- one which takes a collection of entities and stores them all within
a single transaction.  You can probably see that as your project
grows, you are going to wind up with a lot of very similar methods,
each different only in the transaction behaviour.

The rule that you must be able to store both entities if you are going
to store either one is considered a 'business rule' - an artificial
constraint on what you are allowed to do.  Business rules frequently
change over the life of a project, so once again, you want to keep
your business logic firmly separated from your ui.  Again, this is
accomplished by shoving your business logic into separate classes with
a well defined interface and injecting instances of those interfaces
into your page classes.  Now, your ui code doesn't need to know
anything about transactions because your service layer is handling
them.  Your ui can call a method to store() two entities and doesn't
need to be concerned with the details of how that occurs or what is
allowed.  All it knows is it either succeeded or failed based on an
exception may catch. Once again, your ui layer is clean.  It is
injected only with service interfaces.  Service objects are injected
with DAO interfaces, and you've got a nice clean layer separation.

Except for one thing.  You've got a bunch of transaction code sitting
in your service layer, wrapped around calls into your DAOs, which no
longer have any knowledge of transactions themselves.  This means
there is still a strong binding between your service layer and your
perisistence layer, making it very difficult to modify one without
modifying the other.  That's generally considered a _bad_thing_ and
should be avoided.  So this is where Spring steps in and provides some
VERY useful functionality.  Spring gives a nice declarative mechanism
(ie. you can set it up in a config file or annotation, rather than by
writing code)  for forcing a transaction around any method of any
object.  You can define a business method that calls multiple DAO
methods and you can tell spring that anytime someone calls that
method, you want a transaction to be started before the method
executes, and the transaction to be committed when the method is
completed without throwing an exception, or rolled back if an
exception is caught.  Now you can remove all of that pesky transaction
code from your service layer, giving you true independance from your
persistence layer outside of the persistence interfaces, which should
be generic across any persistence mechanism.  OK, you've still got a
dependency in your config, but at 

Re: Re: Textfield inside a @for and different bean translator for each TextField instance

2006-12-07 Thread Sam Gendler

I didn't do anything.  You had it right to begin with ;-)  It was a good guess.

--sam


On 12/7/06, Jabbar [EMAIL PROTECTED] wrote:

Hello,

Thank for your assistance again! It worked.



On 07/12/06, Sam Gendler [EMAIL PROTECTED] wrote:
 Assuming currentChannel.bean returns a valid translator object, I
 don't see why it shouldn't work.  It would certainly work outside of
 the loop.  I do that all the time.

 --sam


 On 12/7/06, Jabbar [EMAIL PROTECTED] wrote:
  Hello all,
 
  I have the following,
 
  .page file,
 
  component id=collection type=For
binding name=source value=channelSetup/
binding name=value value=currentChannelSetup/
   /component
 
  component id=text type=TextField
   binding name=value value=currentChannelSetup.field/
   binding name=translator value=bean:currentChannel.bean/
  /component
 
 
  .html file
 
  div jwcid=collection
 
  input jwcid=text /
 
  /div
 
  What I want to know is if I can have
 
   binding name=translator value=bean:currentChannel.bean/
 
  or something similar ?
 
 
  --
  Thanks
 
   A Jabbar Azam
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




--
Thanks

 A Jabbar Azam

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Tapestry is slow on my machine.

2006-12-07 Thread Henry Chen
I'm running Tapestry 4.1.1 snapshot, tomcat 5.5 on two machines. The speed
is kind of slow. I did a test on the workbench sample. The speed is much
slower than browsing the workbench sample on tapestry website. Does anybody
have this issue too? Any suggestions? Thanks a lot!

 



Re: Drag-n-Drop component

2006-12-07 Thread Sam Gendler

Well, at its simplest, you can just put straight dojo js code directly
in your template, a solution which requires absolutely no explicit
support from tapestry at all.

If you need the ability to reuse that code easily, then you could wrap
it up in a component, but nothing truly says you have to do that
(although it is generally recommended, if only for code leigibility
and maintenance reasons).  Without a tap component, you'll likely need
to update a hidden field or fields that you explicitly include in the
page at the time of the drop and/or fire off a request to a tapestry
service.  This things can also be done without explicit support from
tapestry. If you wrap your functionality up in a component, then you
can have your component template include the necessary hidden fields,
links, and forms. I don't know the specifics of dojo drag and drop, so
I can't steer you in the correct direction there.  If you just
implement it in a page using raw js code and hidden fields, you'll
likely discover quite quickly how it should be encapsulated into a
component.

--sam


On 12/7/06, Emmanuel Sowah [EMAIL PROTECTED] wrote:

Hi,

Does anyone has a drag and drop tapestry component to share? Are there plans
to integrate dojo's drag and drop javascript into core tapestry?
Or can someone give me some guidelines as to how to do this in tapestry with
Dojo's javascript?

Thanks,
Emmanuel




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tapestry is slow on my machine.

2006-12-07 Thread Sam Gendler

Do you have caching disabled?  If you do, then tapestry is doing all
kinds of extra work on every request in order to detect any changes
that are made to the webapp between requests.  Generally, caching will
be enabled via an environment variable set like this:
-Dorg.apache.tapestry.disable-caching=true but it could easily be in a
startup script or similar, too.  Remove the line entirely or set it to
false and you should see it improve performance dramatically.  The
downside is you'll now have to restart the app to detect any changes
made to the templates, page files, or properties files in the webapp.

--sam


On 12/7/06, Henry Chen [EMAIL PROTECTED] wrote:

I'm running Tapestry 4.1.1 snapshot, tomcat 5.5 on two machines. The speed
is kind of slow. I did a test on the workbench sample. The speed is much
slower than browsing the workbench sample on tapestry website. Does anybody
have this issue too? Any suggestions? Thanks a lot!







-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Re: RE: 4.1 Stability (Hi Jesse! :P)

2006-12-07 Thread Sam Gendler

if you look at the docs for tap 4.1, you'll see the contrib components
there.  I haven't used them all, but table definitely works.  I
haven't looked to see if it supports async operations now.  My guess
is that that work has yet to be completed, but it will still work the
way it used to.  I definitely have functional tables in a Tap4.1 app.

--sam


On 12/6/06, Daniel Tabuenca [EMAIL PROTECTED] wrote:

What about the Contrib components available for 4.0? Will these work with 4.1?


On 12/5/06, Daniel Tabuenca [EMAIL PROTECTED] wrote:
 So tacos 4.0 is definetly not compatible with Tapestry 4.1? If so, it
 would be nice to include  old components and forward them to  tapestry
 with a not that they are deprecated.

 On 12/5/06, andyhot [EMAIL PROTECTED] wrote:
  No, not really...
  I've recently started tacos-4.1.0 snapshot releases... but they only
  contain
  the sitemap components = really cool way to get an instant menu system in
  your app.
 
  Anyway, some tacos components can now be replaced with the ones tapestry
  provides,
  which ones are you currently using ?
  For instance tacos:AjaxForm can now be Form with async=true
 
  So, i wasn't planning on including tacos:AjaxForm and such in tacos-4.1.0
  but perhaps we can ease the migration process by adding them + making
  them forward to tapestry's ones
 
  Daniel Tabuenca wrote:
   If I'm currently using 4.0.2+Tacos, can someone tell me if I can
   upgrade to 4.1+Tacos and incrmenetally port my pages that use tacos
   components to the new 4.1 ajax framework?
  
   On 12/5/06, Sam Gendler [EMAIL PROTECTED] wrote:
   Given the parameters that you describe for your app, I'd definitely go
   with 4.1.  The only reason I wouldn't is if you knew you were going to
   be building a very large app that was going to use a significant
   percentage of the API, since in that case, you might struggle keeping
   up with changes.  But all the baseline tapestry functionality works
   98% of the time and I imagine that the API in the core is already
   pretty stable. Bugs may come and go, but at least you shouldn't be
   rewriting entire functions to match some new interface.  And 4.1 is
   unquestionably superior to tap + tacos for ajax functionality
   (although tacos has some nice components that haven't been ported yet.
But they should be pretty simple to do yourself, shoudl the need
   arise).
  
   --sam
  
  
   On 12/5/06, [EMAIL PROTECTED]
   [EMAIL PROTECTED] wrote:
Thanks! My app is launched in 4.0 right now, but the next version
   will probably be launched January 31st, so that was part of the
   reason I was aching to go for 4.1 since there's still 2 months to go
   for bug fixes, etc... Though I suppose we *should* schedule Christmas
   somewhere in there ;)
   
Greg
   
-Original Message-
From: news [mailto:[EMAIL PROTECTED] Behalf Of Ron Piterman
Sent: Tuesday, December 05, 2006 1:23 PM
To: users@tapestry.apache.org
Subject: Re: 4.1 Stability (Hi Jesse! :P)
   
   
If you need ajax, you can't go around 4.1 - if you don't, 4.0 has some
advantages (as far as I can see) - such as much smaller javascript
footprint for form validation, and stability -
   
However, Jesse does a great work in fixing bugs in 4.1 very fast, I go
to sleep in Europe and Jesse fixes the bugs at day time in the states,
so the next morning a new version is out - thats amazing !
   
It is not so easy to recommend anything in active development for
production - I can just say - I am working on a project which
   should go
in production on Jan 1st and am using 4.1 ---
   
Cheers,
Ron
   
   
Cyrille37 wrote:

 Hi Jesse,

 You think we have to use the 4.1 vs. 4.0.
 For example I'm learning Tapestry for a project which will really
   start
 in january.
 Will you tell me to use the 4.1 ?

 thanks
 cyrille

 Jesse Kuhnert a écrit :
 I think it would reckless of me to recommend anything that may
   or may
 not affect anyone's job/career..

 That being said - if it were me - yeah I'd totally go for it.

 It's probably been a mistake to wait so long for 4.1.1 to come out
 anyways. Probably I'll just fix this validation message issue and
 release it.

 On 12/5/06, [EMAIL PROTECTED]
 [EMAIL PROTECTED] wrote:
 Okay, I know Jesse is probably fed up with these types of
   questions!
 And we've gone over it before, about 4.1, 5.0, roadmaps, etc, a
 couple weeks ago.

 The 4.1 snapshot that's out right now, for a relatively
   simple app
 - no custom components, hivemind services, Java 1.4 so no
 annotations, and maybe a sprinkle of DOJO stuff (hence the
   reason to
 switch to 4.1!!) - would moving from 4.0 to 4.1 be a horrible
   idea?

 I skimmed over a lot of the open issues on JIRA and none seem too
 severe, or too widespread to some of the proven core of
   tapestry.

Re: Tapestry is slow on my machine.

2006-12-07 Thread Daniel Tabuenca

Yes definitely. Disable caching has a HUGE performance hit (more then
you'd think). It also eventually causes your program to run out of
memory I've found.

On 12/7/06, Sam Gendler [EMAIL PROTECTED] wrote:

Do you have caching disabled?  If you do, then tapestry is doing all
kinds of extra work on every request in order to detect any changes
that are made to the webapp between requests.  Generally, caching will
be enabled via an environment variable set like this:
-Dorg.apache.tapestry.disable-caching=true but it could easily be in a
startup script or similar, too.  Remove the line entirely or set it to
false and you should see it improve performance dramatically.  The
downside is you'll now have to restart the app to detect any changes
made to the templates, page files, or properties files in the webapp.

--sam


On 12/7/06, Henry Chen [EMAIL PROTECTED] wrote:
 I'm running Tapestry 4.1.1 snapshot, tomcat 5.5 on two machines. The speed
 is kind of slow. I did a test on the workbench sample. The speed is much
 slower than browsing the workbench sample on tapestry website. Does anybody
 have this issue too? Any suggestions? Thanks a lot!






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Securing URL Parameters

2006-12-07 Thread Dennis Sinelnikov

Damian Krzeminski wrote:

Dennis Sinelnikov wrote:

Dear Fellow Tapestriers :),

I need to implement an EngineService that will return a specific file 
living on a filesystem.  I need to pass a parameter in the url that 
specifies which file to return.  I've searched the tapestry list serve 
archives for an elegant solution, but nothing really caught my eye.  
My initial thought was to do a one-way hash of the file and pass it 
via the parameter in the url; when the url comes back the service 
would replicate the process by comparing the hashes of all the files 
and see which one matches; the one matches return to the user.


I'm curious to see what others are doing in securing urls from 
malicious users.  Sample code or any suggestions are greatly appreciated.


Thanks,
Dennis


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




I was looking for elegant solution for that problem as well. I ended up 
doing something similar to AssetService, which is I guess what you are 
trying to do as well.


The code is here:
http://scm.sipfoundry.org/rep/sipX/main/sipXconfig/web/src/org/sipfoundry/sipxconfig/components/DownloadService.java 

http://scm.sipfoundry.org/rep/sipX/main/sipXconfig/web/src/org/sipfoundry/sipxconfig/components/DownloadLink.java 



It's in subversion repository - you can get entire project from here: 
http://scm.sipfoundry.org/rep/sipX/main/sipXconfig


If anybody comes up with something better I'd like to know that.
Damian


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Thanks Sam and Damian.  I guess the answer was right in front of my nose 
the whole time. ;)


-Dennis


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Tapestry is slow on my machine.

2006-12-07 Thread Jesse Kuhnert

Slower than the website? Not sure what to say. I would probably need
more definitive metrics on what you mean by slow .

On 12/7/06, Henry Chen [EMAIL PROTECTED] wrote:

I'm running Tapestry 4.1.1 snapshot, tomcat 5.5 on two machines. The speed
is kind of slow. I did a test on the workbench sample. The speed is much
slower than browsing the workbench sample on tapestry website. Does anybody
have this issue too? Any suggestions? Thanks a lot!








--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Bean validator - validation method not being called

2006-12-07 Thread Steve Wells

A bit of validation grief here (Tapestry 4.0.2), I hope someone can help or
provide an example of their own of this (besides the one in Kent Tongs
book).

I'm trying to create a custom validator that grabs maxLength and required
info from the data model.  The Bean I define as the validator takes 3
parameters which are being set ok when the form is submitted but the *
validate* method is not called, and despite trying variations to acheive
this it still does not work.

Best elaborated in code:

Validator Bean:

public class DataObjectFieldValidator extends BaseValidator {
   // *** These fields are populated OK via their setters
   private String dataObjectName;
   private String fieldName;
   private DataContext dataContext;

   // This does not get called
   public void validate(IFormComponent iFormComponent, ValidationMessages
validationMessages, Object object) throws ValidatorException {
   if (log.isInfoEnabled()) {
   log.info(iFormComponent:  + iFormComponent);
   log.info(object:  + object);
   }
   throw new ValidatorException(Why is this not getting here???);

.page spec:

bean name=myValidator class=com.validator.DataObjectFieldValidator
   set name=dataContext value=ognl:dataContext/
   set name=dataObjectName value=literal:MyDataObject/
   set name=fieldName value=literal:myField/
   /bean
   component id=question type=TextField
   binding name=value value=question/
   binding name=validators value=bean:myValidator/
   /component

Java page class:

// This will work for built in validators but not the custom bean
if (getDelegate().getHasErrors()) {
   log.info(Entry Errors found:  + getDelegate().getFirstError());
   return null;
}

TIA,

Steve


Re: Bean validator - validation method not being called

2006-12-07 Thread Steve Wells

ok naturally I stumbled over my own solution not 5 mins after posting this.

The solution was to change the bean-validator method to return true
public boolean getAcceptsNull() {
   return true;  // was false
   }

The giveaway was when I actually typed something in and then got the
validation failure, I stupidly kept trying the empty field case. doh!

On 08/12/06, Steve Wells [EMAIL PROTECTED] wrote:


A bit of validation grief here (Tapestry 4.0.2), I hope someone can help
or provide an example of their own of this (besides the one in Kent Tongs
book).

I'm trying to create a custom validator that grabs maxLength and required
info from the data model.  The Bean I define as the validator takes 3
parameters which are being set ok when the form is submitted but the *
validate* method is not called, and despite trying variations to acheive
this it still does not work.

Best elaborated in code:

Validator Bean:

public class DataObjectFieldValidator extends BaseValidator {
// *** These fields are populated OK via their setters
private String dataObjectName;
private String fieldName;
private DataContext dataContext;

// This does not get called
public void validate(IFormComponent iFormComponent, ValidationMessages
validationMessages, Object object) throws ValidatorException {
if (log.isInfoEnabled()) {
log.info(iFormComponent:  + iFormComponent);
log.info(object:  + object);
}
throw new ValidatorException(Why is this not getting here???);

.page spec:

bean name=myValidator class=com.validator.DataObjectFieldValidator
set name=dataContext value=ognl:dataContext/
set name=dataObjectName value=literal:MyDataObject/
set name=fieldName value=literal:myField/
/bean
component id=question type=TextField
binding name=value value=question/
binding name=validators value=bean:myValidator/
/component

Java page class:

// This will work for built in validators but not the custom bean
if (getDelegate().getHasErrors()) {
log.info(Entry Errors found:  + getDelegate().getFirstError());
return null;
}

TIA,

Steve



Re: Decision of whether to use tapestry

2006-12-07 Thread Deep Blue

Hi,

Wow! Thanks for your reply! I didn't figure out that anyone will bother to
help me out as this is not a technical question.

Actually, I haven't been expressed my question very well. Here are a few
points I like to clarify:
1. The page that my client submit will eventually sit inside the the same
web application as the tapestry component (just copy the page into the
exploded folder under web application server). There will be only one web
application (pages that client submitted, together with the tapestry
component/code, service, persistence classes).
2. Only one framework will be chosen. Currently I'm using Struts Tiles as
I'm familiar with struts, and it took a lot of pain to do this kind of
'portlet' thing and it requires another template file to specify the look 
feel of the poll.
3. I have a very tight schedule.. haha.. Therefore, I can't afford to learn
tapestry and throw it away. So, have to ask experts like you who have worked
with Tapestry before.


My question is, can tapestry do this kind of thing like:
Users are flexible to choose the layout, look  feel of the poll
It can be in a table:
if display result
table
 tr jwcid=[EMAIL PROTECTED]
sample answer
 /tr/table
/if

It can also be a plain text:
if display result
span jwcid=[EMAIL PROTECTED]  sample answer
/span
/if

The page consists of the code above doesn't need extra configuration (eg. in
xml files) in order to use the component.

Thanks alot!


Best Regards,
Guang Sheng


On 12/8/06, Sam Gendler [EMAIL PROTECTED] wrote:


I typed up a long response, but then reread your question and I think
maybe I need some clarification. I included my original response below
in case it answers your question. If you are looking for something
that can be included in any page, rendered by any framework, then I'm
not sure you really want to use Tapestry.  The only way you are going
to build something that can be used absolutely anywhere is to render
the poll entirely in html and javascript.  Take a look at dojo for
examples of lots of widgets that can be used in any web page by simply
including the correct js files.  However, dojo does leave the backend
processing as an exercise for the user, rather than providing a
service to handle storing and rendering user input.

The difficult thing in your concept is submitting the results back to
a server which will maintain totals and render them back to the
browser, either graphically, or maybe just as a data structure that
the browser can then use to render graphically.  Tapestry can be used
to do this, fairly easily, but in general, Tapestry is a fairly
stateful framework that is used for building applications rather than
just widgets that can be inserted into other apps. You could implement
an IExternalPage which receives the selected answer and poll id in the
URL, stores the answer against the poll id, and serves up totals.  The
only real caveat is that your tapestry-based pollserver is likely to
be on a different host than the containing page, so you'll have to use
cross domain techniques to allow tapestry to serve up js that can
interact with the template provided in the containing page.  This is
basically just a matter of serving up js as a string and then
eval()'ing that string within the context of the containing document.
There are lots of discussions of cross-domain js on the web, so I'll
leave that to you to research.  You'd have the same problem with any
framework you might choose to implement the backend in.

Now, if you were just talking about building a tapestry poll component
that can be used only in other Tapestry applications, the answer is
definitely yes and I have a fairly detailed answer below:

Yes, it is possible.  There are a lot of parallels between your
component and the contrib:Table component that comes with Tapestry
(although the table is likely to be much more complex).

Just to give you some concepts to refer to in your research, here's
brief outline if what you'd likely do.

Create a poll component that takes some data structure that defines
the poll and the current results (assuming you also want to display
results there). The poll component iterates over each poll answer
rendering an @Block component that is provided by the page template.
The @Block component contains all of the template code necessary to
render a single answer of the poll.  If the user wants a table, they
open the table tag in their template, then include an @Block component
which renders a single table row (or column, depending upon
preference).  You can use a different Block component to render a link
to the results, a submit button, or anything else you care for.

If you provide reasonable defaults, many users will never have to
define a Block at all in order to use your poll.  Your component is
only responsible for providing default layout and data structures, but
everything is overloadable via Blocks.  Something like the following
(I'll use a list this time, just to show the difference):


Re: Re: Decision of whether to use tapestry

2006-12-07 Thread Sam Gendler

Well, the asnwer to your question is still yes, but it isn't a
'normal' use of Tapestry much as it isn't obvious how to do it in
struts, either. As a result, I'd recommend that you don't use
Tapestry.  Given your tight schedule and lack of familiarity with the
framework, I suspect you'll have a working application faster if you
stick with what you know.

--sam


On 12/7/06, Deep Blue [EMAIL PROTECTED] wrote:

Hi,

Wow! Thanks for your reply! I didn't figure out that anyone will bother to
help me out as this is not a technical question.

Actually, I haven't been expressed my question very well. Here are a few
points I like to clarify:
1. The page that my client submit will eventually sit inside the the same
web application as the tapestry component (just copy the page into the
exploded folder under web application server). There will be only one web
application (pages that client submitted, together with the tapestry
component/code, service, persistence classes).
2. Only one framework will be chosen. Currently I'm using Struts Tiles as
I'm familiar with struts, and it took a lot of pain to do this kind of
'portlet' thing and it requires another template file to specify the look 
feel of the poll.
3. I have a very tight schedule.. haha.. Therefore, I can't afford to learn
tapestry and throw it away. So, have to ask experts like you who have worked
with Tapestry before.


My question is, can tapestry do this kind of thing like:
Users are flexible to choose the layout, look  feel of the poll
It can be in a table:
if display result
table
  tr jwcid=[EMAIL PROTECTED]
 sample answer
  /tr/table
/if

It can also be a plain text:
if display result
span jwcid=[EMAIL PROTECTED]  sample answer
/span
/if

The page consists of the code above doesn't need extra configuration (eg. in
xml files) in order to use the component.

Thanks alot!


Best Regards,
Guang Sheng


On 12/8/06, Sam Gendler [EMAIL PROTECTED] wrote:

 I typed up a long response, but then reread your question and I think
 maybe I need some clarification. I included my original response below
 in case it answers your question. If you are looking for something
 that can be included in any page, rendered by any framework, then I'm
 not sure you really want to use Tapestry.  The only way you are going
 to build something that can be used absolutely anywhere is to render
 the poll entirely in html and javascript.  Take a look at dojo for
 examples of lots of widgets that can be used in any web page by simply
 including the correct js files.  However, dojo does leave the backend
 processing as an exercise for the user, rather than providing a
 service to handle storing and rendering user input.

 The difficult thing in your concept is submitting the results back to
 a server which will maintain totals and render them back to the
 browser, either graphically, or maybe just as a data structure that
 the browser can then use to render graphically.  Tapestry can be used
 to do this, fairly easily, but in general, Tapestry is a fairly
 stateful framework that is used for building applications rather than
 just widgets that can be inserted into other apps. You could implement
 an IExternalPage which receives the selected answer and poll id in the
 URL, stores the answer against the poll id, and serves up totals.  The
 only real caveat is that your tapestry-based pollserver is likely to
 be on a different host than the containing page, so you'll have to use
 cross domain techniques to allow tapestry to serve up js that can
 interact with the template provided in the containing page.  This is
 basically just a matter of serving up js as a string and then
 eval()'ing that string within the context of the containing document.
 There are lots of discussions of cross-domain js on the web, so I'll
 leave that to you to research.  You'd have the same problem with any
 framework you might choose to implement the backend in.

 Now, if you were just talking about building a tapestry poll component
 that can be used only in other Tapestry applications, the answer is
 definitely yes and I have a fairly detailed answer below:

 Yes, it is possible.  There are a lot of parallels between your
 component and the contrib:Table component that comes with Tapestry
 (although the table is likely to be much more complex).

 Just to give you some concepts to refer to in your research, here's
 brief outline if what you'd likely do.

 Create a poll component that takes some data structure that defines
 the poll and the current results (assuming you also want to display
 results there). The poll component iterates over each poll answer
 rendering an @Block component that is provided by the page template.
 The @Block component contains all of the template code necessary to
 render a single answer of the poll.  If the user wants a table, they
 open the table tag in their template, then include an @Block component
 which renders a single table row (or column, depending upon