Re: T5: onActivate exception query

2008-08-29 Thread Sven Homburg
i think that solution is a bit "dangerous",
if you do some refectorings.
eg: move the page Administration in another package
or the application context is changed

2008/8/29 <[EMAIL PROTECTED]>

> Hi,
>
> I was just about to reply and say I solved it.  Missing slash in the
> location.href.  The following works:
>
>  onclick="location.href='/Administration';"/>
>
> thanks for your help.
>
>
> p.
>
>
> Quoting Martijn Brinkers <[EMAIL PROTECTED]>:
>
>  I'm not sure but I thinks it's a similar problem. It looks like
>> Administration is interpreted as the context.
>>
>> If you want to cancel the page it's easier to use the t5Component Button
>> component.
>>
>> Add t5Component jar to you project (see
>> http://code.google.com/p/tapestry5-components/) and add this to
>> the .tml:
>>
>> > t:event="cancel">Cancel
>>
>>
>> And add an event handler in your page:
>>
>> protected Object onCancel()
>> {
>>  return Administration.class; // The Page to redirect to
>> }
>>
>>
>> Martijn Brinkers
>>
>>
>> On Fri, 2008-08-29 at 12:09 +0100, [EMAIL PROTECTED] wrote:
>>
>>> Thanks for the fast reply Martijn; that fixed the GIF asset.
>>>
>>> However, I am still having problems with the Cancel button. I can
>>> reference the Administration page as an asset, but obviously it then
>>> does not get processed by Tapestry.
>>>
>>> Thoughts, anyone?
>>>
>>>  >>  onclick="location.href='Administration';"/>
>>>
>>>
>>> p.
>>>
>>>
>>> Quoting Martijn Brinkers <[EMAIL PROTECTED]>:
>>>
>>> > I think the following happens
>>> >
>>> > The gif is requested by your page because of the IMG so the GET for the
>>> > IMG looks something like
>>> >
>>> > http://YOUR_DOMAIN/YOUR_PAGE/bl_red_hundred.gif
>>> >
>>> > Now you page assumes this is your activation context and tries to
>>> > convert it to int (which it's not).
>>> >
>>> > I think you can solve this by adding an image Asset. Another option I
>>> > think would be to not request the image relative to your page but from
>>> > for example the /images subir (make sure the request if relative with
>>> > respect to you app root and not absolute).
>>> >
>>> > I guess the other problem is related.
>>> >
>>> > Martijn Brinkers
>>> >
>>> > On Fri, 2008-08-29 at 11:23 +0100, [EMAIL PROTECTED] wrote:
>>> >> I don't quite understand why the following does not work and produces:
>>> >>
>>> >> TapestryModule.RequestExceptionHandler Processing of request failed
>>> >> with uncaught exception: Exception in method
>>> >> uk.bl.dportal.pages.EditUser.onActivate(int) (at EditUser.java:40),
>>> >> parameter #1: Coercion of bl_red_hundred.gif to type java.lang.Integer
>>> >> (via String --> Long, Long --> Integer) failed: For input string:
>>> >> "bl_red_hundred.gif"
>>> >> org.apache.tapestry5.runtime.ComponentEventException: Exception in
>>> >> method uk.bl.dportal.pages.EditUser.onActivate(int) (at
>>> >> EditUser.java:40), parameter #1: Coercion of bl_red_hundred.gif to
>>> >> type java.lang.Integer (via String --> Long, Long --> Integer) failed:
>>> >> For input string: "bl_red_hundred.gif"
>>> >>  at
>>> >>
>>>  
>>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1054)
>>> >> ...
>>> >>
>>> >>
>>> >> I have a template which containes a reference to a gif used in the
>>> >> banner (BLTemplate.tml):
>>> >>
>>> >> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>>> >>  
>>> >>  Digital Portal: ${heading}
>>> >>  
>>> >>  
>>> >>  
>>> >>  
>>> >>  
>>> >>  
>>> >>  ${title}
>>> >>  
>>> >>
>>> >>  
>>> >>  
>>> >>  
>>> >> ...
>>> >>
>>> >>
>>> >> This template is used for all my pages (in this case EditUser.tml):
>>> >>
>>> >> >> >>  t:title="literal:Edit
>>> User Details"
>>> >>  xmlns:t="
>>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>>> >>  
>>> >>  Edit user details.
>>> >> ...
>>> >>
>>> >>
>>> >> This page is called from a link produced by the Grid component (in
>>> >> ManageUsers.tml):
>>> >>
>>> >>  >> >> t:exclude="id,password" t:row="listItem">
>>> >>  
>>> >>  >> t:context="listItem.id">
>>> >>  ${listItem.userName}
>>> >>  
>>> >>  
>>> >>  
>>> >>
>>> >>
>>> >> and EditUser.java has an onActivate with a parameter:
>>> >>
>>> >>  public void onActivate(int id)
>>> >>  {
>>> >>  Query query = session.createQuery("from User where id =
>>> '"+id+"'");
>>> >>  List result = query.list();
>>> >>  user = (User)result.get(0);
>>> >>  }
>>> >>
>>> >>
>>> >> Why is the GIF name being passed in initially?  The page still works,
>>> >> so the id is being set to that given by the link from

Re: T5: onActivate exception query

2008-08-29 Thread photos

Hi,

I was just about to reply and say I solved it.  Missing slash in the  
location.href.  The following works:


onclick="location.href='/Administration';"/>


thanks for your help.

p.


Quoting Martijn Brinkers <[EMAIL PROTECTED]>:


I'm not sure but I thinks it's a similar problem. It looks like
Administration is interpreted as the context.

If you want to cancel the page it's easier to use the t5Component Button
component.

Add t5Component jar to you project (see
http://code.google.com/p/tapestry5-components/) and add this to
the .tml:

Cancel


And add an event handler in your page:

protected Object onCancel()
{
  return Administration.class; // The Page to redirect to
}


Martijn Brinkers


On Fri, 2008-08-29 at 12:09 +0100, [EMAIL PROTECTED] wrote:

Thanks for the fast reply Martijn; that fixed the GIF asset.

However, I am still having problems with the Cancel button. I can
reference the Administration page as an asset, but obviously it then
does not get processed by Tapestry.

Thoughts, anyone?

  


p.


Quoting Martijn Brinkers <[EMAIL PROTECTED]>:

> I think the following happens
>
> The gif is requested by your page because of the IMG so the GET for the
> IMG looks something like
>
> http://YOUR_DOMAIN/YOUR_PAGE/bl_red_hundred.gif
>
> Now you page assumes this is your activation context and tries to
> convert it to int (which it's not).
>
> I think you can solve this by adding an image Asset. Another option I
> think would be to not request the image relative to your page but from
> for example the /images subir (make sure the request if relative with
> respect to you app root and not absolute).
>
> I guess the other problem is related.
>
> Martijn Brinkers
>
> On Fri, 2008-08-29 at 11:23 +0100, [EMAIL PROTECTED] wrote:
>> I don't quite understand why the following does not work and produces:
>>
>> TapestryModule.RequestExceptionHandler Processing of request failed
>> with uncaught exception: Exception in method
>> uk.bl.dportal.pages.EditUser.onActivate(int) (at EditUser.java:40),
>> parameter #1: Coercion of bl_red_hundred.gif to type java.lang.Integer
>> (via String --> Long, Long --> Integer) failed: For input string:
>> "bl_red_hundred.gif"
>> org.apache.tapestry5.runtime.ComponentEventException: Exception in
>> method uk.bl.dportal.pages.EditUser.onActivate(int) (at
>> EditUser.java:40), parameter #1: Coercion of bl_red_hundred.gif to
>> type java.lang.Integer (via String --> Long, Long --> Integer) failed:
>> For input string: "bl_red_hundred.gif"
>>at
>>   
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1054)

>> ...
>>
>>
>> I have a template which containes a reference to a gif used in the
>> banner (BLTemplate.tml):
>>
>> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>>  
>>  Digital Portal: ${heading}
>>  
>>  
>>  
>>
>>
>>
>>${title}
>>  
>>
>>
>>  
>>
>> ...
>>
>>
>> This template is used for all my pages (in this case EditUser.tml):
>>
>> >t:title="literal:Edit User 
Details"
>>
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>>  
>>  Edit user details.
>> ...
>>
>>
>> This page is called from a link produced by the Grid component (in
>> ManageUsers.tml):
>>
>>> t:exclude="id,password" t:row="listItem">
>>
>>
>>${listItem.userName}
>>
>>
>>
>>
>>
>> and EditUser.java has an onActivate with a parameter:
>>
>>public void onActivate(int id)
>>{
>>Query query = session.createQuery("from User where id = 
'"+id+"'");
>>List result = query.list();
>>user = (User)result.get(0);
>>}
>>
>>
>> Why is the GIF name being passed in initially?  The page still works,
>> so the id is being set to that given by the link from ManageUsers.tml.
>> The exception is generated but it continues on to display the page.
>>
>> However, I have a Cancel button on the EditUser page, and when I press
>> that the whole lot fails with a coercion error, this time trying to
>> take the name of the page from the Cancel button and pass it as a
>> parameter:
>>
>> (EditUser.tml):
>>
>> > onclick="location.href='Administration';"/>
>>
>>
>> producing exception:
>>
>> Exception in method uk.bl.dportal.pages.EditUser.onActivate(int) (at
>> EditUser.java:36), parameter #1: Coercion of Administration to type
>> java.lang.Integer (via String --> Long, Long --> Integer) failed: For
>> input string: "Administration"
>>
>>
>> What is going on and why does this happen? It's only happening for
>> this page which has an onActivate with a parameter. All my other pa

Re: T5: onActivate exception query

2008-08-29 Thread Martijn Brinkers
I'm not sure but I thinks it's a similar problem. It looks like
Administration is interpreted as the context.

If you want to cancel the page it's easier to use the t5Component Button
component.

Add t5Component jar to you project (see
http://code.google.com/p/tapestry5-components/) and add this to
the .tml:

Cancel


And add an event handler in your page:

protected Object onCancel()
{
  return Administration.class; // The Page to redirect to
}


Martijn Brinkers


On Fri, 2008-08-29 at 12:09 +0100, [EMAIL PROTECTED] wrote:
> Thanks for the fast reply Martijn; that fixed the GIF asset.
> 
> However, I am still having problems with the Cancel button. I can  
> reference the Administration page as an asset, but obviously it then  
> does not get processed by Tapestry.
> 
> Thoughts, anyone?
> 
>  onclick="location.href='Administration';"/>
> 
> 
> p.
> 
> 
> Quoting Martijn Brinkers <[EMAIL PROTECTED]>:
> 
> > I think the following happens
> >
> > The gif is requested by your page because of the IMG so the GET for the
> > IMG looks something like
> >
> > http://YOUR_DOMAIN/YOUR_PAGE/bl_red_hundred.gif
> >
> > Now you page assumes this is your activation context and tries to
> > convert it to int (which it's not).
> >
> > I think you can solve this by adding an image Asset. Another option I
> > think would be to not request the image relative to your page but from
> > for example the /images subir (make sure the request if relative with
> > respect to you app root and not absolute).
> >
> > I guess the other problem is related.
> >
> > Martijn Brinkers
> >
> > On Fri, 2008-08-29 at 11:23 +0100, [EMAIL PROTECTED] wrote:
> >> I don't quite understand why the following does not work and produces:
> >>
> >> TapestryModule.RequestExceptionHandler Processing of request failed
> >> with uncaught exception: Exception in method
> >> uk.bl.dportal.pages.EditUser.onActivate(int) (at EditUser.java:40),
> >> parameter #1: Coercion of bl_red_hundred.gif to type java.lang.Integer
> >> (via String --> Long, Long --> Integer) failed: For input string:
> >> "bl_red_hundred.gif"
> >> org.apache.tapestry5.runtime.ComponentEventException: Exception in
> >> method uk.bl.dportal.pages.EditUser.onActivate(int) (at
> >> EditUser.java:40), parameter #1: Coercion of bl_red_hundred.gif to
> >> type java.lang.Integer (via String --> Long, Long --> Integer) failed:
> >> For input string: "bl_red_hundred.gif"
> >>at
> >> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1054)
> >> ...
> >>
> >>
> >> I have a template which containes a reference to a gif used in the
> >> banner (BLTemplate.tml):
> >>
> >> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
> >>  
> >>  Digital Portal: ${heading}
> >>  
> >>  
> >>  
> >>
> >>
> >>
> >>${title}
> >>  
> >>
> >>
> >>  
> >>
> >> ...
> >>
> >>
> >> This template is used for all my pages (in this case EditUser.tml):
> >>
> >>  >>t:title="literal:Edit User 
> >> Details"
> >>
> >> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
> >>  
> >>  Edit user details.
> >> ...
> >>
> >>
> >> This page is called from a link produced by the Grid component (in
> >> ManageUsers.tml):
> >>
> >> >> t:exclude="id,password" t:row="listItem">
> >>
> >> >> t:context="listItem.id">
> >>${listItem.userName}
> >>
> >>
> >>
> >>
> >>
> >> and EditUser.java has an onActivate with a parameter:
> >>
> >>public void onActivate(int id)
> >>{
> >>Query query = session.createQuery("from User where id = 
> >> '"+id+"'");
> >>List result = query.list();
> >>user = (User)result.get(0);
> >>}
> >>
> >>
> >> Why is the GIF name being passed in initially?  The page still works,
> >> so the id is being set to that given by the link from ManageUsers.tml.
> >> The exception is generated but it continues on to display the page.
> >>
> >> However, I have a Cancel button on the EditUser page, and when I press
> >> that the whole lot fails with a coercion error, this time trying to
> >> take the name of the page from the Cancel button and pass it as a
> >> parameter:
> >>
> >> (EditUser.tml):
> >>
> >>  >> onclick="location.href='Administration';"/>
> >>
> >>
> >> producing exception:
> >>
> >> Exception in method uk.bl.dportal.pages.EditUser.onActivate(int) (at
> >> EditUser.java:36), parameter #1: Coercion of Administration to type
> >> java.lang.Integer (via String --> Long, Long --> Integer) failed: For
> >> input string: "Administration"
> >>
> >>
> >> What is going on and why does this happen? It's only happening f

Re: T5: onActivate exception query

2008-08-29 Thread Thiago H. de Paula Figueiredo

Em Fri, 29 Aug 2008 07:23:48 -0300, <[EMAIL PROTECTED]> escreveu:





Something that works wonderfully with any kind of resource (imagens, CSS,  
etc) is to use the asset prefix:


alt="bl" />


It works regardless of where your template is and what URL it has.

Thiago

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



Re: T5: onActivate exception query

2008-08-29 Thread photos

Thanks for the fast reply Martijn; that fixed the GIF asset.

However, I am still having problems with the Cancel button. I can  
reference the Administration page as an asset, but obviously it then  
does not get processed by Tapestry.


Thoughts, anyone?

 


p.


Quoting Martijn Brinkers <[EMAIL PROTECTED]>:


I think the following happens

The gif is requested by your page because of the IMG so the GET for the
IMG looks something like

http://YOUR_DOMAIN/YOUR_PAGE/bl_red_hundred.gif

Now you page assumes this is your activation context and tries to
convert it to int (which it's not).

I think you can solve this by adding an image Asset. Another option I
think would be to not request the image relative to your page but from
for example the /images subir (make sure the request if relative with
respect to you app root and not absolute).

I guess the other problem is related.

Martijn Brinkers

On Fri, 2008-08-29 at 11:23 +0100, [EMAIL PROTECTED] wrote:

I don't quite understand why the following does not work and produces:

TapestryModule.RequestExceptionHandler Processing of request failed
with uncaught exception: Exception in method
uk.bl.dportal.pages.EditUser.onActivate(int) (at EditUser.java:40),
parameter #1: Coercion of bl_red_hundred.gif to type java.lang.Integer
(via String --> Long, Long --> Integer) failed: For input string:
"bl_red_hundred.gif"
org.apache.tapestry5.runtime.ComponentEventException: Exception in
method uk.bl.dportal.pages.EditUser.onActivate(int) (at
EditUser.java:40), parameter #1: Coercion of bl_red_hundred.gif to
type java.lang.Integer (via String --> Long, Long --> Integer) failed:
For input string: "bl_red_hundred.gif"
at
org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1054)
...


I have a template which containes a reference to a gif used in the
banner (BLTemplate.tml):

http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
 
 Digital Portal: ${heading}
 
 
 


 	

${title}
 


 

...


This template is used for all my pages (in this case EditUser.tml):

http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
 
 Edit user details.
...


This page is called from a link produced by the Grid component (in
ManageUsers.tml):




${listItem.userName}





and EditUser.java has an onActivate with a parameter:

public void onActivate(int id)
{
Query query = session.createQuery("from User where id = 
'"+id+"'");
List result = query.list();
user = (User)result.get(0);
}


Why is the GIF name being passed in initially?  The page still works,
so the id is being set to that given by the link from ManageUsers.tml.
The exception is generated but it continues on to display the page.

However, I have a Cancel button on the EditUser page, and when I press
that the whole lot fails with a coercion error, this time trying to
take the name of the page from the Cancel button and pass it as a
parameter:

(EditUser.tml):




producing exception:

Exception in method uk.bl.dportal.pages.EditUser.onActivate(int) (at
EditUser.java:36), parameter #1: Coercion of Administration to type
java.lang.Integer (via String --> Long, Long --> Integer) failed: For
input string: "Administration"


What is going on and why does this happen? It's only happening for
this page which has an onActivate with a parameter. All my other pages
work as expected.

thanks,
p.




-
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: T5: onActivate exception query

2008-08-29 Thread Martijn Brinkers
I think the following happens

The gif is requested by your page because of the IMG so the GET for the
IMG looks something like

http://YOUR_DOMAIN/YOUR_PAGE/bl_red_hundred.gif

Now you page assumes this is your activation context and tries to
convert it to int (which it's not).

I think you can solve this by adding an image Asset. Another option I
think would be to not request the image relative to your page but from
for example the /images subir (make sure the request if relative with
respect to you app root and not absolute).

I guess the other problem is related.

Martijn Brinkers

On Fri, 2008-08-29 at 11:23 +0100, [EMAIL PROTECTED] wrote:
> I don't quite understand why the following does not work and produces:
> 
> TapestryModule.RequestExceptionHandler Processing of request failed  
> with uncaught exception: Exception in method  
> uk.bl.dportal.pages.EditUser.onActivate(int) (at EditUser.java:40),  
> parameter #1: Coercion of bl_red_hundred.gif to type java.lang.Integer  
> (via String --> Long, Long --> Integer) failed: For input string:  
> "bl_red_hundred.gif"
> org.apache.tapestry5.runtime.ComponentEventException: Exception in  
> method uk.bl.dportal.pages.EditUser.onActivate(int) (at  
> EditUser.java:40), parameter #1: Coercion of bl_red_hundred.gif to  
> type java.lang.Integer (via String --> Long, Long --> Integer) failed:  
> For input string: "bl_red_hundred.gif"
>   at  
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1054)
> ...
> 
> 
> I have a template which containes a reference to a gif used in the  
> banner (BLTemplate.tml):
> 
> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>  
>  Digital Portal: ${heading}
>  
>  
>  
>   
>   
>   
>   ${title}
>  
> 
>   
>  
>   
> ...
> 
> 
> This template is used for all my pages (in this case EditUser.tml):
> 
>t:title="literal:Edit User 
> Details"
>   
> xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>  
>  Edit user details.
> ...
> 
> 
> This page is called from a link produced by the Grid component (in  
> ManageUsers.tml):
> 
>t:exclude="id,password" t:row="listItem">
>   
>t:context="listItem.id">
>   ${listItem.userName}
>   
>   
>   
> 
> 
> and EditUser.java has an onActivate with a parameter:
> 
>   public void onActivate(int id)
>   {
>   Query query = session.createQuery("from User where id = 
> '"+id+"'");
>   List result = query.list();
>   user = (User)result.get(0);
>   }
> 
> 
> Why is the GIF name being passed in initially?  The page still works,  
> so the id is being set to that given by the link from ManageUsers.tml.  
> The exception is generated but it continues on to display the page.
> 
> However, I have a Cancel button on the EditUser page, and when I press  
> that the whole lot fails with a coercion error, this time trying to  
> take the name of the page from the Cancel button and pass it as a  
> parameter:
> 
> (EditUser.tml):
> 
>  onclick="location.href='Administration';"/>
> 
> 
> producing exception:
> 
> Exception in method uk.bl.dportal.pages.EditUser.onActivate(int) (at  
> EditUser.java:36), parameter #1: Coercion of Administration to type  
> java.lang.Integer (via String --> Long, Long --> Integer) failed: For  
> input string: "Administration"
> 
> 
> What is going on and why does this happen? It's only happening for  
> this page which has an onActivate with a parameter. All my other pages  
> work as expected.
> 
> thanks,
> p.
> 
> 
> 
> 
> -
> 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]