T5 br troubles

2008-05-17 Thread maxthesecond

I might be wrong, and for sure it's not critical but I found out the
following behavihour when including br tags in my component:


component  output   result

br/  br parsers warn that br is not properly closed
br   none Tapestry wisdomely throws an exception Tag neds end
tag
/br  none Tapestry misses de point and complains on certain
div

Just in case someone else has found the same behavihour...Tapestry 5.0.11

Thanks
  
-- 
View this message in context: 
http://www.nabble.com/T5-%3Cbr%3E-troubles-tp17289805p17289805.html
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: EventLink and context from page

2008-05-17 Thread Tomasz Dziurko
You understood me very correcltly :)
But I have loop with products and each product has 'add to cart' link.
AFAIK it's not possible to use ActionLink in loop, cause every
ActionLink must have unique id and when I don't know how many items
will be in the loop it's hard do write methods connected to each
AcionLink.
PageLink, which you mentioned. seems to be created to different
purposes... so problem is still unresolved :)

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



Re: EventLink and context from page

2008-05-17 Thread Robert Zeigler

Stick in a single action link.
It will take care of uniquifying its id.
Then write a single handler.
Put the instance-specific information in the context for the action  
link, and then your handler can accept that info as method parameters.


Robert

On May 17, 2008, at 5/176:51 AM , Tomasz Dziurko wrote:


You understood me very correcltly :)
But I have loop with products and each product has 'add to cart' link.
AFAIK it's not possible to use ActionLink in loop, cause every
ActionLink must have unique id and when I don't know how many items
will be in the loop it's hard do write methods connected to each
AcionLink.
PageLink, which you mentioned. seems to be created to different
purposes... so problem is still unresolved :)

-
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]



Question about select component

2008-05-17 Thread amebaliu

Hi all, I have a question about select componenet,somehow, my options starts
from null, then userone, then usertwo, rahter than start from userone.. I
really can not find where is the error..  Hope somebody can help me, thanks
a lot
Here is my code
select t:type=select t:model=users t:value=user/

@Inject
private Messages messages;
public SelectModel getUsers(){
return new EnumSelectModel(Users.class,messages);
}

@Persist
private Users user;
public Users getUser(){
return this.user;
}
public void setUser(Users user){
this.user = user;
}
package test.todolist.model;

public enum Users {
USERONE,USERTWO,USERTHREE
}
-- 
View this message in context: 
http://www.nabble.com/Question-about-select-component-tp17291010p17291010.html
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: Question about select component

2008-05-17 Thread SergeEby

Hey,

Assuming you are using version 5.0.11, you can add: blankoption=never to
the component definition.

See details here: 
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Select.html

/Serge


amebaliu wrote:
 
 Hi all, I have a question about select componenet,somehow, my options
 starts from null, then userone, then usertwo, rahter than start from
 userone.. I really can not find where is the error..  Hope somebody can
 help me, thanks a lot
 Here is my code
 select t:type=select t:model=users t:value=user/
 
 @Inject
   private Messages messages;
   public SelectModel getUsers(){
   return new EnumSelectModel(Users.class,messages);
   }
   
 @Persist
   private Users user;
   public Users getUser(){
   return this.user;
   }
   public void setUser(Users user){
   this.user = user;
   }
 package test.todolist.model;
 
 public enum Users {
   USERONE,USERTWO,USERTHREE
 }
 

-- 
View this message in context: 
http://www.nabble.com/Question-about-select-component-tp17291010p17291503.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



how can I call a web url from actionlink

2008-05-17 Thread jg433
Hi,

I would like to have a link, where on click first some cleanup action will be 
done,
like for example closing a database connection etc, and then finally redirekt 
the
user to some absolute URL in the web.

How can I accomplish this?
I have something like this:

a href=# t:type=actionlink t:id=quitGameQuit/a

@OnEvent (component=quitGame)
Object onQuit(){
memory.quit();
// more things to do before quitting
return ?? // go to http://www.someOtherWebspace.com;; 
}

thank you!
Juliane
_
Unbegrenzter Speicherplatz für Ihr E-Mail Postfach? Jetzt aktivieren!
http://freemail.web.de/club/landingpage.htm/?mc=02


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



Little confused

2008-05-17 Thread Manuel Corrales
Hi, here is my problem. I have a bean on my java page, but i am not using
the beaneditorform component to create a new one. Acording to Alexander
book, the beaneditorform component can handle the initialization of the
bean, so you dont have to create one. As i am not using this component,
should i define the bean with a sentence like this:

private Matafuego matafuego = new Matafuego();

or should i create the new instance on the onActivate method?

I tryied the first approach, but the bean is always the same (i guess
because of the page pooling mechanism). What is the right approach to this?

Thanks very much.


Re: Little confused

2008-05-17 Thread Kevin Menard
I would probably use a lazy getter with a @Persist attached to the field.

Something like:

@Persist
private Matafuego matafuego;

public Metafuego getMetafuego()
{
   if (null == metafuego)
   {
   metafuego = new Metafuego();
   }

   return metafuego;
}

The page instance is guaranteed to be accessed by only a single thread at a
time, so that should be safe for you.

-- 
Kevin


On 5/17/08 10:01 AM, Manuel Corrales [EMAIL PROTECTED] wrote:

 Hi, here is my problem. I have a bean on my java page, but i am not using
 the beaneditorform component to create a new one. Acording to Alexander
 book, the beaneditorform component can handle the initialization of the
 bean, so you dont have to create one. As i am not using this component,
 should i define the bean with a sentence like this:
 
 private Matafuego matafuego = new Matafuego();
 
 or should i create the new instance on the onActivate method?
 
 I tryied the first approach, but the bean is always the same (i guess
 because of the page pooling mechanism). What is the right approach to this?
 
 Thanks very much.


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



Re: T5 br troubles

2008-05-17 Thread jg433
this is a common behaviour/problem not only with tapestry.
br- tags in xhtml should be written with a space before the closing 
characters:
br /

Juliane

-Ursprüngliche Nachricht-
Von: Tapestry users users@tapestry.apache.org
Gesendet: 17.05.08 11:39:49
An: users@tapestry.apache.org
Betreff: T5 br troubles

I might be wrong, and for sure it's not critical but I found out the 
following behavihour when including 
 tags in my component: component output result br/ 
 parsers warn that 
 is not properly closed
 none Tapestry wisdomely throws an exception Tag neds end tag /br 
none Tapestry misses de point and complains on certain div Just in 
case someone else has found the same behavihour...Tapestry 5.0.11 
Thanks -- View this message in context: http://www.nabble.com/T5-%
3Cbr%3E-troubles-tp17289805p17289805.html Sent from the Tapestry - 
User mailing list archive at Nabble.com. -
 To unsubscribe, e-mail: 
[EMAIL PROTECTED] For additional commands, e-mail:

[EMAIL PROTECTED]


___
EINE FÜR ALLE: die kostenlose WEB.DE-Plattform für Freunde und Deine
Homepage mit eigenem Namen. Jetzt starten! http://unddu.de/[EMAIL PROTECTED]


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



Re: Little confused

2008-05-17 Thread Manuel Corrales
Thanks for your answer, but i still have the same issue. Maybe i am not
explaining the problem ok. I have a page with a link, when i press the link
the application goes to the new Matafuego page, where i am using a hand
made form (i mean not using beaneditorform tag). The first time i do this,
everything works fine, i complete the date press Save and the application
redirects to the main page again. But the second time i press the link to
add a new Matafuego, the form has the data i complete on the first one. The
behavior i am looking here, is that each time i access the form, i create a
new Matafuego, i mean a clean form and a new Matafuego instance.

Thanks in advance.

On Sat, May 17, 2008 at 11:54 AM, Kevin Menard [EMAIL PROTECTED]
wrote:

 I would probably use a lazy getter with a @Persist attached to the field.

 Something like:

 @Persist
 private Matafuego matafuego;

 public Metafuego getMetafuego()
 {
   if (null == metafuego)
   {
   metafuego = new Metafuego();
   }

   return metafuego;
 }

 The page instance is guaranteed to be accessed by only a single thread at a
 time, so that should be safe for you.

 --
 Kevin


 On 5/17/08 10:01 AM, Manuel Corrales [EMAIL PROTECTED] wrote:

  Hi, here is my problem. I have a bean on my java page, but i am not using
  the beaneditorform component to create a new one. Acording to Alexander
  book, the beaneditorform component can handle the initialization of the
  bean, so you dont have to create one. As i am not using this component,
  should i define the bean with a sentence like this:
 
  private Matafuego matafuego = new Matafuego();
 
  or should i create the new instance on the onActivate method?
 
  I tryied the first approach, but the bean is always the same (i guess
  because of the page pooling mechanism). What is the right approach to
 this?
 
  Thanks very much.


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




Re: how can I call a web url from actionlink

2008-05-17 Thread Thiago HP
Return an URL object:
 @OnEvent (component=quitGame)
 Object onQuit()  throws MalformedURLException {
memory.quit();
// more things to do before quitting
return new URL(http://www.someOtherWebspace.com;);
 }
-- 
Thiago

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



Re: Little confused

2008-05-17 Thread Ned Jackson Lovely
Set your private variable to null in your onSuccess function.

On 5/17/08, Manuel Corrales [EMAIL PROTECTED] wrote:
 Thanks for your answer, but i still have the same issue. Maybe i am not
 explaining the problem ok. I have a page with a link, when i press the link
 the application goes to the new Matafuego page, where i am using a hand
 made form (i mean not using beaneditorform tag). The first time i do this,
 everything works fine, i complete the date press Save and the application
 redirects to the main page again. But the second time i press the link to
 add a new Matafuego, the form has the data i complete on the first one. The
 behavior i am looking here, is that each time i access the form, i create a
 new Matafuego, i mean a clean form and a new Matafuego instance.

 Thanks in advance.

 On Sat, May 17, 2008 at 11:54 AM, Kevin Menard [EMAIL PROTECTED]
 wrote:

 I would probably use a lazy getter with a @Persist attached to the field.

 Something like:

 @Persist
 private Matafuego matafuego;

 public Metafuego getMetafuego()
 {
   if (null == metafuego)
   {
   metafuego = new Metafuego();
   }

   return metafuego;
 }

 The page instance is guaranteed to be accessed by only a single thread at
 a
 time, so that should be safe for you.

 --
 Kevin


 On 5/17/08 10:01 AM, Manuel Corrales [EMAIL PROTECTED] wrote:

  Hi, here is my problem. I have a bean on my java page, but i am not
  using
  the beaneditorform component to create a new one. Acording to Alexander
  book, the beaneditorform component can handle the initialization of the
  bean, so you dont have to create one. As i am not using this component,
  should i define the bean with a sentence like this:
 
  private Matafuego matafuego = new Matafuego();
 
  or should i create the new instance on the onActivate method?
 
  I tryied the first approach, but the bean is always the same (i guess
  because of the page pooling mechanism). What is the right approach to
 this?
 
  Thanks very much.


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





-- 
njl

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



Re: Little confused

2008-05-17 Thread Manuel Corrales
Hi Ned, the onSuccess methos is executed before the onSubmit, so that would
not work for me because i am doing the model logic on the onSubmit. I tryed
setting my variable in null after executing my businnes logic, but i still
have the same issue. My private variable should not be cleaned by Tapestry
pooling mechanism?

The only thing i can think to fix this, is to set my variable to null after
the bussines logic, and then on the onACtivate method check if its null, the
i create a new one, if its not null then i do nothing.

Thanks, and still waiting for an elegant solution to this ;)
**

On Sat, May 17, 2008 at 12:12 PM, Ned Jackson Lovely [EMAIL PROTECTED] wrote:

 Set your private variable to null in your onSuccess function.

 On 5/17/08, Manuel Corrales [EMAIL PROTECTED] wrote:
  Thanks for your answer, but i still have the same issue. Maybe i am not
  explaining the problem ok. I have a page with a link, when i press the
 link
  the application goes to the new Matafuego page, where i am using a hand
  made form (i mean not using beaneditorform tag). The first time i do
 this,
  everything works fine, i complete the date press Save and the application
  redirects to the main page again. But the second time i press the link to
  add a new Matafuego, the form has the data i complete on the first one.
 The
  behavior i am looking here, is that each time i access the form, i create
 a
  new Matafuego, i mean a clean form and a new Matafuego instance.
 
  Thanks in advance.
 
  On Sat, May 17, 2008 at 11:54 AM, Kevin Menard [EMAIL PROTECTED]
  wrote:
 
  I would probably use a lazy getter with a @Persist attached to the
 field.
 
  Something like:
 
  @Persist
  private Matafuego matafuego;
 
  public Metafuego getMetafuego()
  {
if (null == metafuego)
{
metafuego = new Metafuego();
}
 
return metafuego;
  }
 
  The page instance is guaranteed to be accessed by only a single thread
 at
  a
  time, so that should be safe for you.
 
  --
  Kevin
 
 
  On 5/17/08 10:01 AM, Manuel Corrales [EMAIL PROTECTED]
 wrote:
 
   Hi, here is my problem. I have a bean on my java page, but i am not
   using
   the beaneditorform component to create a new one. Acording to
 Alexander
   book, the beaneditorform component can handle the initialization of
 the
   bean, so you dont have to create one. As i am not using this
 component,
   should i define the bean with a sentence like this:
  
   private Matafuego matafuego = new Matafuego();
  
   or should i create the new instance on the onActivate method?
  
   I tryied the first approach, but the bean is always the same (i guess
   because of the page pooling mechanism). What is the right approach to
  this?
  
   Thanks very much.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 


 --
 njl

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




Re: Little confused

2008-05-17 Thread Kevin Menard
It doesn't really matter where you clear it.  Just clear it when you're done
with it.  As for the lifecycle question, you have to clear it because you
@Persisted it.  If you didn't @Persist it, you wouldn't have to clear it,
but you'd likely lose your data when working with the form, depending on
your workflow.

This should work fine.  I do it all the time.

-- 
Kevin


On 5/17/08 12:34 PM, Manuel Corrales [EMAIL PROTECTED] wrote:

 Hi Ned, the onSuccess methos is executed before the onSubmit, so that would
 not work for me because i am doing the model logic on the onSubmit. I tryed
 setting my variable in null after executing my businnes logic, but i still
 have the same issue. My private variable should not be cleaned by Tapestry
 pooling mechanism?
 
 The only thing i can think to fix this, is to set my variable to null after
 the bussines logic, and then on the onACtivate method check if its null, the
 i create a new one, if its not null then i do nothing.
 
 Thanks, and still waiting for an elegant solution to this ;)
 **


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



Re: Using t5-components

2008-05-17 Thread Sven Homburg
looks like the jars not copied in your WEB-INF/lib directory

2008/5/17 Toby Hobson [EMAIL PROTECTED]:

 Hi

 I'm looking at the t5-components project and I am trying to use the
 PagedLoop component. I've added the commons and contrib dependencies and the
 repo to my pom.xml and they are now on my classpath. But when I try to use

li t:type=t5components/PagedLoop source=images value=photo
${photo.name}
/li

 Tapestry complains that it can't find a component called
 t5components/PagedLoop. Do I have to somehow tell T5 where to find the new
 components?

 Thanks

 Toby




-- 
with regards
Sven Homburg
http://tapestry5-components.googlecode.com


Re: Little confused

2008-05-17 Thread Manuel Corrales
Ok, thanks. Probably this is some stupid begginer mistake, but i cant make
this work. My class is this:

public class NuevoMatafuego {

private Matafuego matafuego = new Matafuego();
@Inject
private Messages messages;
@Component
private Form nuevoMatafuegoForm;
@Component(id = nroAparato)
private TextField nroAparato;

public SelectModel getTiposDeMatafuego() {
return new EnumSelectModel(TipoMatafuego.class, messages);
}

public Matafuego getMatafuego() {
return matafuego;
}

public void setMatafuego(Matafuego matafuego) {
this.matafuego = matafuego;
}

void onActivate() {
if (matafuego == null) {
matafuego = new Matafuego();
}
}

@OnEvent(value = submit, component = nuevoMatafuegoForm)
Object onSubmitNuevoMatafuegoForm() {
MatafuegoFacade facade = new MatafuegoFacade();
try {
facade.guardarMatafuego(matafuego);
matafuego = null;
return MainMatafuegos.class;
} catch ( ConstraintViolationException e) {
nuevoMatafuegoForm.recordError(nroAparato,
messages.get(matafuegoDuplicado));
return this;
}
}

}


As you can see, the matafuego instance is not @Persist, so i really do not
undestand why is not being cleared. Also if instead of doing Matafuego
matafuego = new Matafuego(); on the declaration, i dont initialize it, then
when i try to save it, it is null in the onSubmit method.

Any suggestion?

On Sat, May 17, 2008 at 1:51 PM, Kevin Menard [EMAIL PROTECTED] wrote:

 It doesn't really matter where you clear it.  Just clear it when you're
 done
 with it.  As for the lifecycle question, you have to clear it because you
 @Persisted it.  If you didn't @Persist it, you wouldn't have to clear it,
 but you'd likely lose your data when working with the form, depending on
 your workflow.

 This should work fine.  I do it all the time.

 --
 Kevin


 On 5/17/08 12:34 PM, Manuel Corrales [EMAIL PROTECTED] wrote:

  Hi Ned, the onSuccess methos is executed before the onSubmit, so that
 would
  not work for me because i am doing the model logic on the onSubmit. I
 tryed
  setting my variable in null after executing my businnes logic, but i
 still
  have the same issue. My private variable should not be cleaned by
 Tapestry
  pooling mechanism?
 
  The only thing i can think to fix this, is to set my variable to null
 after
  the bussines logic, and then on the onACtivate method check if its null,
 the
  i create a new one, if its not null then i do nothing.
 
  Thanks, and still waiting for an elegant solution to this ;)
  **


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




Re: Little confused

2008-05-17 Thread Manuel Corrales
Sorry, my mistake. The same code i posted but without initializing the
matafuego variable is working now. I still dont completely understand why
tapestry is not cleaning my matafuego variable.

Thanks very much for your help!

On Sat, May 17, 2008 at 2:39 PM, Manuel Corrales [EMAIL PROTECTED]
wrote:

 Ok, thanks. Probably this is some stupid begginer mistake, but i cant make
 this work. My class is this:

 public class NuevoMatafuego {

 private Matafuego matafuego = new Matafuego();
 @Inject
 private Messages messages;
 @Component
 private Form nuevoMatafuegoForm;
 @Component(id = nroAparato)
 private TextField nroAparato;

 public SelectModel getTiposDeMatafuego() {
 return new EnumSelectModel(TipoMatafuego.class, messages);
 }

 public Matafuego getMatafuego() {
 return matafuego;
 }

 public void setMatafuego(Matafuego matafuego) {
 this.matafuego = matafuego;
 }

 void onActivate() {
 if (matafuego == null) {
 matafuego = new Matafuego();
 }
 }

 @OnEvent(value = submit, component = nuevoMatafuegoForm)
 Object onSubmitNuevoMatafuegoForm() {
 MatafuegoFacade facade = new MatafuegoFacade();
 try {
 facade.guardarMatafuego(matafuego);
 matafuego = null;
 return MainMatafuegos.class;
 } catch ( ConstraintViolationException e) {
 nuevoMatafuegoForm.recordError(nroAparato,
 messages.get(matafuegoDuplicado));
 return this;
 }
 }

 }


 As you can see, the matafuego instance is not @Persist, so i really do not
 undestand why is not being cleared. Also if instead of doing Matafuego
 matafuego = new Matafuego(); on the declaration, i dont initialize it, then
 when i try to save it, it is null in the onSubmit method.

 Any suggestion?


 On Sat, May 17, 2008 at 1:51 PM, Kevin Menard [EMAIL PROTECTED]
 wrote:

 It doesn't really matter where you clear it.  Just clear it when you're
 done
 with it.  As for the lifecycle question, you have to clear it because you
 @Persisted it.  If you didn't @Persist it, you wouldn't have to clear it,
 but you'd likely lose your data when working with the form, depending on
 your workflow.

 This should work fine.  I do it all the time.

 --
 Kevin


 On 5/17/08 12:34 PM, Manuel Corrales [EMAIL PROTECTED] wrote:

  Hi Ned, the onSuccess methos is executed before the onSubmit, so that
 would
  not work for me because i am doing the model logic on the onSubmit. I
 tryed
  setting my variable in null after executing my businnes logic, but i
 still
  have the same issue. My private variable should not be cleaned by
 Tapestry
  pooling mechanism?
 
  The only thing i can think to fix this, is to set my variable to null
 after
  the bussines logic, and then on the onACtivate method check if its null,
 the
  i create a new one, if its not null then i do nothing.
 
  Thanks, and still waiting for an elegant solution to this ;)
  **


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





Re: Little confused

2008-05-17 Thread Manuel Corrales
Ok, me bothering again. Now when i have a validation error that was checked
on the server side, the form is completely wiped out. Thats the normal
behavior?

On Sat, May 17, 2008 at 2:49 PM, Manuel Corrales [EMAIL PROTECTED]
wrote:

 Sorry, my mistake. The same code i posted but without initializing the
 matafuego variable is working now. I still dont completely understand why
 tapestry is not cleaning my matafuego variable.

 Thanks very much for your help!


 On Sat, May 17, 2008 at 2:39 PM, Manuel Corrales [EMAIL PROTECTED]
 wrote:

 Ok, thanks. Probably this is some stupid begginer mistake, but i cant make
 this work. My class is this:

 public class NuevoMatafuego {

 private Matafuego matafuego = new Matafuego();
 @Inject
 private Messages messages;
 @Component
 private Form nuevoMatafuegoForm;
 @Component(id = nroAparato)
 private TextField nroAparato;

 public SelectModel getTiposDeMatafuego() {
 return new EnumSelectModel(TipoMatafuego.class, messages);
 }

 public Matafuego getMatafuego() {
 return matafuego;
 }

 public void setMatafuego(Matafuego matafuego) {
 this.matafuego = matafuego;
 }

 void onActivate() {
 if (matafuego == null) {
 matafuego = new Matafuego();
 }
 }

 @OnEvent(value = submit, component = nuevoMatafuegoForm)
 Object onSubmitNuevoMatafuegoForm() {
 MatafuegoFacade facade = new MatafuegoFacade();
 try {
 facade.guardarMatafuego(matafuego);
 matafuego = null;
 return MainMatafuegos.class;
 } catch ( ConstraintViolationException e) {
 nuevoMatafuegoForm.recordError(nroAparato,
 messages.get(matafuegoDuplicado));
 return this;
 }
 }

 }


 As you can see, the matafuego instance is not @Persist, so i really do not
 undestand why is not being cleared. Also if instead of doing Matafuego
 matafuego = new Matafuego(); on the declaration, i dont initialize it, then
 when i try to save it, it is null in the onSubmit method.

 Any suggestion?


 On Sat, May 17, 2008 at 1:51 PM, Kevin Menard [EMAIL PROTECTED]
 wrote:

 It doesn't really matter where you clear it.  Just clear it when you're
 done
 with it.  As for the lifecycle question, you have to clear it because you
 @Persisted it.  If you didn't @Persist it, you wouldn't have to clear it,
 but you'd likely lose your data when working with the form, depending on
 your workflow.

 This should work fine.  I do it all the time.

 --
 Kevin


 On 5/17/08 12:34 PM, Manuel Corrales [EMAIL PROTECTED] wrote:

  Hi Ned, the onSuccess methos is executed before the onSubmit, so that
 would
  not work for me because i am doing the model logic on the onSubmit. I
 tryed
  setting my variable in null after executing my businnes logic, but i
 still
  have the same issue. My private variable should not be cleaned by
 Tapestry
  pooling mechanism?
 
  The only thing i can think to fix this, is to set my variable to null
 after
  the bussines logic, and then on the onACtivate method check if its
 null, the
  i create a new one, if its not null then i do nothing.
 
  Thanks, and still waiting for an elegant solution to this ;)
  **


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






Re: Little confused

2008-05-17 Thread Manuel Corrales
Well, i think i am really screwing thnigs up. Very sorry for abusing of your
time, i have almost everything working ok. Thanks for your time!

On Sat, May 17, 2008 at 2:57 PM, Manuel Corrales [EMAIL PROTECTED]
wrote:

 Ok, me bothering again. Now when i have a validation error that was checked
 on the server side, the form is completely wiped out. Thats the normal
 behavior?


 On Sat, May 17, 2008 at 2:49 PM, Manuel Corrales [EMAIL PROTECTED]
 wrote:

 Sorry, my mistake. The same code i posted but without initializing the
 matafuego variable is working now. I still dont completely understand why
 tapestry is not cleaning my matafuego variable.

 Thanks very much for your help!


 On Sat, May 17, 2008 at 2:39 PM, Manuel Corrales 
 [EMAIL PROTECTED] wrote:

 Ok, thanks. Probably this is some stupid begginer mistake, but i cant
 make this work. My class is this:

 public class NuevoMatafuego {

 private Matafuego matafuego = new Matafuego();
 @Inject
 private Messages messages;
 @Component
 private Form nuevoMatafuegoForm;
 @Component(id = nroAparato)
 private TextField nroAparato;

 public SelectModel getTiposDeMatafuego() {
 return new EnumSelectModel(TipoMatafuego.class, messages);
 }

 public Matafuego getMatafuego() {
 return matafuego;
 }

 public void setMatafuego(Matafuego matafuego) {
 this.matafuego = matafuego;
 }

 void onActivate() {
 if (matafuego == null) {
 matafuego = new Matafuego();
 }
 }

 @OnEvent(value = submit, component = nuevoMatafuegoForm)
 Object onSubmitNuevoMatafuegoForm() {
 MatafuegoFacade facade = new MatafuegoFacade();
 try {
 facade.guardarMatafuego(matafuego);
 matafuego = null;
 return MainMatafuegos.class;
 } catch ( ConstraintViolationException e) {
 nuevoMatafuegoForm.recordError(nroAparato,
 messages.get(matafuegoDuplicado));
 return this;
 }
 }

 }


 As you can see, the matafuego instance is not @Persist, so i really do
 not undestand why is not being cleared. Also if instead of doing Matafuego
 matafuego = new Matafuego(); on the declaration, i dont initialize it, then
 when i try to save it, it is null in the onSubmit method.

 Any suggestion?


 On Sat, May 17, 2008 at 1:51 PM, Kevin Menard [EMAIL PROTECTED]
 wrote:

 It doesn't really matter where you clear it.  Just clear it when you're
 done
 with it.  As for the lifecycle question, you have to clear it because
 you
 @Persisted it.  If you didn't @Persist it, you wouldn't have to clear
 it,
 but you'd likely lose your data when working with the form, depending on
 your workflow.

 This should work fine.  I do it all the time.

 --
 Kevin


 On 5/17/08 12:34 PM, Manuel Corrales [EMAIL PROTECTED]
 wrote:

  Hi Ned, the onSuccess methos is executed before the onSubmit, so that
 would
  not work for me because i am doing the model logic on the onSubmit. I
 tryed
  setting my variable in null after executing my businnes logic, but i
 still
  have the same issue. My private variable should not be cleaned by
 Tapestry
  pooling mechanism?
 
  The only thing i can think to fix this, is to set my variable to null
 after
  the bussines logic, and then on the onACtivate method check if its
 null, the
  i create a new one, if its not null then i do nothing.
 
  Thanks, and still waiting for an elegant solution to this ;)
  **


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







Re: T5: Exception Handling

2008-05-17 Thread Filip S. Adamsen

Hi Leon,

How to override server error pages depends on what server you're using. 
As far as I'm aware it's unfortunately not possible to use Tapestry 
pages as server error pages - if I'm wrong here, I'd really like to know 
how to do it. :)


What I mean by turning the RequestExceptionHandler into a pipeline is 
that I've overridden the original service with my own that uses a pipeline.


http://tapestry.apache.org/tapestry5/tapestry-ioc/pipeline.html

So I define my filter:

  public interface RequestExceptionFilter {

void handleRequestException(Throwable exception, 
RequestExceptionHandler handler)

throws IOException;
  }

Then I create a new RequestExceptionHandler as a pipeline:

  public static RequestExceptionHandler 
buildImprovedRequestExceptionHandler(

  ListRequestExceptionFilter configuration,
  @InjectService(RequestExceptionHandler) RequestExceptionHandler 
requestExceptionHandler,

  PipelineBuilder builder,
  Logger logger
  ) {
return builder.build(
logger,
RequestExceptionHandler.class,
RequestExceptionFilter.class,
configuration,
requestExceptionHandler
);
  }

I then contribute this to AliasOverrides to replace the default 
RequestExceptionHandler:


  public static void contributeAliasOverrides(
  ConfigurationAliasContribution configuration,
  @InjectService(ImprovedRequestExceptionHandler) 
RequestExceptionHandler requestExceptionHandler

  ) {

configuration.add(AliasContribution.create(RequestExceptionHandler.class, 
requestExceptionHandler));

  }

I can then contribute filters to the pipeline like this:

  public static void contributeImprovedRequestExceptionHandler(
  OrderedConfigurationRequestExceptionFilter configuration,
  RequestExceptionErrorFilter requestExceptionErrorFilter
  ) {
configuration.add(Error, requestExceptionErrorFilter);
  }

Where RequestExceptionErrorFilter looks like this:

  public class RequestExceptionErrorFilter
  implements RequestExceptionFilter {

private final RedirectService redirectService;
private final SecurityService securityService;
private final Logger logger;

public RequestExceptionErrorFilter(RedirectService redirectService, 
SecurityService securityService, Logger logger) {

  this.redirectService = redirectService;
  this.securityService = securityService;
  this.logger = logger;
}

public void handleRequestException(Throwable exception, 
RequestExceptionHandler handler)

throws IOException {
  if (securityService.isProductionModeEnabled()) {
logger.error(Exception during request, exception);
redirectService.sendRedirect(ErrorIndex.class, false);
  }
  else {
handler.handleRequestException(exception);
  }
}
  }

RedirectService and SecurityService are my own classes. They just make 
some things easier for me. As you can see I show an error page when I'm 
in production but invoke the next filter in the pipeline if I'm not. You 
could contribute more filters if needed.


I've been wanting to contribute a strategy filter before this one 
allowing to do different things depending on the type of exception 
thrown, but haven't had the time nor need to do so yet.


http://tapestry.apache.org/tapestry5/tapestry-ioc/strategy.html

Anyhow, hope this helps - if not, you know where to ask. :)

-Filip

On 2008-05-16 17:37, Leon Derks wrote:

Thanks Peter,

Your original question in the post is also what I would like to know.

Do you now know how to override server error pages(404, 505 etc)?
And I don't understand what Flip means with :I've turned the 
RequestExceptionHandler service into a pipeline.


Can you show me some code of how to do this?
Leon


Peter Stavrinides wrote:

Hi Leon

I posted a number of questions to the list about this topic, but got 
only a few perls. One of them was this post, particularly Filip's answer:

http://www.mail-archive.com/users@tapestry.apache.org/msg21914.html

Also see this page, for how to override Tapestry's error page with 
your own friendly error page:

http://wiki.apache.org/tapestry/Tapestry5ExceptionPage

I am not sure what you are trying to do, but would suggest you 
familiarize yourself a bit more with Tapestry's error reporting 
mechanisms, which imho are incredibly powerful and easy to use.


Hope this helps,
Peter


- Original Message -
From: Leon Derks [EMAIL PROTECTED]
To: Tapestry users users@tapestry.apache.org
Sent: Friday, 16 May, 2008 1:35:19 PM GMT +02:00 Athens, Beirut, 
Bucharest, Istanbul

Subject: T5: Exception Handling

Hello

What is the best way to handle exceptions in Tapestry 5?

I want to show some kind of general error page, when an exception occurs.

At the moment I have a onException method in my BasePage class. But 
for some reason the Error page is not returned.

What is the way in T5 to handle exceptions?

Object onException(Throwable cause) {
return new Error();
}


Re: EventLink and context from page

2008-05-17 Thread Filip S. Adamsen

What he said. So you do this:

Page class:

  @Property
  private Product product;

  public ListProduct getProducts() {
// return the products you want to show
...
  }

  // or onAddToCart(Long productId) if you feel like using EventLink
  Object onActionFromAddToCart(Long productId) {
// load the product and do whatever you need to do with it
...
// redirect to shopping cart or wherever
  }

Page template:

  t:loop t:source=products t:value=product
!-- display the product --
t:actionlink t:id=addtocart t:context=product.idAdd to 
cart/t:actionlink

...
  /t:loop

Hope that helps.

-Filip

On 2008-05-17 14:03, Robert Zeigler wrote:

Stick in a single action link.
It will take care of uniquifying its id.
Then write a single handler.
Put the instance-specific information in the context for the action 
link, and then your handler can accept that info as method parameters.


Robert

On May 17, 2008, at 5/176:51 AM , Tomasz Dziurko wrote:


You understood me very correcltly :)
But I have loop with products and each product has 'add to cart' link.
AFAIK it's not possible to use ActionLink in loop, cause every
ActionLink must have unique id and when I don't know how many items
will be in the loop it's hard do write methods connected to each
AcionLink.
PageLink, which you mentioned. seems to be created to different
purposes... so problem is still unresolved :)

-
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: Little confused

2008-05-17 Thread Filip S. Adamsen

Hi,

I've found the following pattern to work very well - at least I use it 
everywhere on several sites in production with no problems. :)


  @Property
  private Item item;

  // I have a form in my template with t:id=add
  void onPrepareFromAdd() {
if (null == item) item = new Item();
  }

  void onSuccessFromAdd() {
// go about my business with the item
...
// I'd normally return here, but since you need
// something done in onSubmit...
  }

  Object onSubmitFromAdd() {
// do what you need to do
return ...;
  }

I sometimes persist the item if needed.

Hope this helps.

-Filip

On 2008-05-17 16:01, Manuel Corrales wrote:

Hi, here is my problem. I have a bean on my java page, but i am not using
the beaneditorform component to create a new one. Acording to Alexander
book, the beaneditorform component can handle the initialization of the
bean, so you dont have to create one. As i am not using this component,
should i define the bean with a sentence like this:

private Matafuego matafuego = new Matafuego();

or should i create the new instance on the onActivate method?

I tryied the first approach, but the bean is always the same (i guess
because of the page pooling mechanism). What is the right approach to this?

Thanks very much.



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



How to override default-binding for a inherited parameter in component which is sub-class of another component

2008-05-17 Thread Yunhua Sang
Hi all,

I have a component which is a sub-class of Grid. I want to override
default-binding for parameter model in Grid, does someone know how
to do it?

I have tried creating a function: Binding defaultModel() in the new
component, but it seems never gets called.

Thanks
Yunhua

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



Re: Javascript error in datefield component

2008-05-17 Thread sparqle

I upgraded my project to 5.0.11 and I still have this problem. On Firefox 2,
the datepicker is visible, but is not aligned closely to the datefield - it
appears on the far left corner of the browser. On IE 7 it errors out, and
does not show. For my project, all I did was download the t5demo war file
from http://code.google.com/p/tapestry4nonbelievers/downloads/list, and then
removed the 5.0.10 files from the lib folder and added the 5.0.11 files.

Please help!


Yura Tkachenko wrote:
 
 Thank you Florian,
 I have updated my project to Tapestry 5.0.11 and everything works good.
 
 On Sat, Mar 29, 2008 at 4:50 PM, Ektschn [EMAIL PROTECTED] wrote:
 

 Hi Yura,

 as far as I know this is fixed in t5.0.11

 Best, Florian


 Yura Tkachenko wrote:
 
  Hi,
 
  I'm getting Javascript error when trying to use datefield component on
 my
  form. This component works properly in Firefox but it doesn't work with
  IE7.
  I'm getting js error: Object doesn't support this property or method
 on
  the line 87 in file: /assets/tapestry/corelib/components/datefield.js
  .
  85: this.datePicker = new DatePicker();
  86:
  87: this.popup = this.datePicker.create().hide().absolutize();
  ...
 
  In IE7 method hide() is undefined.
 
  I'm using Tapestry 5.0.10. Does anyone else have this problem?
 
  Thanks,
  Yura.
 
 

 --
 View this message in context:
 http://www.nabble.com/Javascript-error-in-datefield-component-tp16245060p16376547.html
 Sent from the Tapestry - User mailing list archive at Nabble.com.


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


 
 

-- 
View this message in context: 
http://www.nabble.com/Javascript-error-in-datefield-component-tp16245060p17299012.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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