Missing output with global layouts (T5)

2008-07-24 Thread Udo Abel
I'm posting this for future searches on similiar problems:

After renaming the package of my app I had strage effects in the output:
Part of the pages where missing, depending on the follow-up tags, e.g., in the 
tml

PrintOrNor




the PrintOrNot paragraph only got printed, when the form was deleted from the 
tml. Similiar effect occurred with elements in or below the form.
When only an expansion like ${message:searchButton} was on the page, the system 
printed an expection saying that "This markup writer did not have a current 
element", but I didn't use any markup writer myself.

Finally I found that I did not rename the directory of the .tml file which was 
used as a global layout around the page. The component tmls had to be placed 
under WEB-INF/classes for jetty to find them when run under eclipse, so I 
simply forget them.

Nevertheless I think that those issues are a big downside of "convention over 
configuration" and the general design of tapestry: since almost all hooks and 
other things, like tmls, are not required, and pages are not derived from a 
base page, the system cannot tell you that they are missing / not found. Hooks 
like @SetupRender can be verified by logs, but a missing tml will not show up 
anywhere.

Regards,
Udo.

-- 
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/[EMAIL PROTECTED]

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



Re: [T4] Using differ validator on async form?

2008-07-24 Thread Andreas Andreou
Wouldn't the encode parameter of
http://tapestry.apache.org/tapestry4.1/components/form/hidden.html
help here?

On Fri, Jul 25, 2008 at 8:02 AM, Kalle Korhonen
<[EMAIL PROTECTED]> wrote:
> Ah, just answering to myself and for future reference. The form components
> don't need to do anything special to support client-side validation, but in
> my case the problem is that Hidden by default uses Datasqueezer to encode
> the value, in practice adding an uppercase S to the beginning of the value
> and thus causing the compared values to be different. You can use the hidden
> field approach together with Differ when you turn encoding off on Hidden
> component. Still; the built-in validators require a IFormComponent; at least
> for Differ it might have made more sense that you could just specify a value
> instead (but it's simple to implement your own component for this).
>
> Kalle
>
>
> On Thu, Jul 24, 2008 at 12:02 PM, Kalle Korhonen <[EMAIL PROTECTED]>
> wrote:
>
>> Is it possible to use Differ validator to validate a field shouldn't match
>> a known value? Match/Differ expects to match against a form component; just
>> any component won't do. In my case the value the value to differ against
>> cannot change (think use case where a password cannot match with a
>> username). So I just tried making the username a hidden field, then pointing
>> the differ to that component, but client side validation doesn't work in
>> that case, and the validation is only enforced on the server side (I guess
>> because Hidden doesn't support client-side validation?). If the component to
>> differ against is a normal text field, the client validation works ok, but I
>> don't want a user to be able to change the field to differ against. I
>> suppose I could hide this field from the user or do some other hack to make
>> it work, but is there a clean way to implement it?
>>
>> Kalle
>>
>



-- 
Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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



Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Martijn Brinkers
This posting also report similar problems and it was 'solved' by
disabling the statement cache.

https://jira.jboss.org/jira/browse/JBPORTAL-1287


Martijn

On Thu, 2008-07-24 at 22:57 -0700, Martijn Brinkers (List) wrote:
> Sounds to me something related to the PreparedStatement cache. Do you
> use c3po? If so did you specify hibernate.c3p0.max_statements?
> 
> Martijn 
> 
> 
> On Thu, 2008-07-24 at 23:26 -0400, Chris Lewis wrote:
> > Ok, I've figured out what exactly is causing it and how to work around
> > it. I can't say why, but perhaps a resident hibernate guru will know (it
> > may even be a know issue or gotcha). First off, the quick fix. This
> > query (and variations like load(), get(), and using the criteria api)
> > cause the problem:
> > 
> > Listing listing = (Listing)session.createQuery("from Listing lst
> > where lst.id=:id")
> > .setLong("id", Long.valueOf(sListingId)).uniqueResult();
> > 
> > This works as expected:
> > 
> > Listing listing = (Listing)session.createQuery("from Listing lst
> > where lst.id=" + sListingId)
> > .uniqueResult();
> > 
> > It seems to come down to how hibernate handles the query results when
> > the query is formed with a "raw" HQL string vs something like get(),
> > load(), the criteria api, or using query parameters as I was initially
> > doing. It also has something to do with the field being queried and
> > seems to happen only on fields that exist in each of the tables. In my
> > case the abstract super class Listing has the PK field "id", and the 2
> > subclasses also have a PK field named "id." Querying by any method other
> > than "constructed strings" leads to the issue, while querying on another
> > field in the super class, whose name is unique to that class, works fine.
> > 
> > So the BIG question is why in the world does it work the first time and
> > continue to work until the value one queries by changes?
> > 
> > I'd also like to know if anyone has seen this before, and/or if it's a
> > known issue. I'm using a slightly outdated version of hibernate
> > (3.2.2.ga) and for all I know this may be fixed in more recent versions.
> > My wrists are shot so I'll try tomorrow. If anyone knows of this or gets
> > interested/bored enough to try it, please let me know.
> > 
> > Thanks tons for all of your input.
> > 
> > Sincerely,
> > Chris Lewis
> > 
> > Chris Lewis wrote:
> > > Hello,
> > >
> > > I have a dispatcher that uses a hibernate session. The dispatcher is
> > > auto bound and receives the session in the constructor. I'm using
> > > tapestry-hibernate so that session instance is a proxy that gets the
> > > real session for the current thread (right?). Now in testing my
> > > dispatcher, I give it a url like:
> > >
> > > /MyContext/?limg=2
> > >
> > > The dispatcher looks for "limg" and if found, queries the session
> > > assuming that its value is the PK of a mapped entity. When I trigger the
> > > dispatcher for the first time it works fine. If I refresh the page,
> > > fine. If I change the value to something else, say 3, then it breaks
> > > with a org.hibernate.InstantiationException:
> > >
> > > Cannot instantiate abstract class or interface: com.mypackage.data.Listing
> > >
> > > If I change the value back to 2, the same thing happens! "Listing" is an
> > > abstract class mapped as a super class entity via:
> > >
> > > @Entity
> > > @Inheritance(strategy = InheritanceType.JOINED)
> > >
> > > Any clue what's going on here? Two things are perplexing me:
> > >
> > > 1) Querying mapped super classes is legal, and I in fact the same thing
> > > on my Index page with no problem.
> > > 2) The query works the first time, but as soon as the id changes it is
> > > forever broken until I restart the container.
> > >
> > > Thanks in advance!
> > >
> > > chris
> > >
> > >   
> > 


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



Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Martijn Brinkers (List)
Sounds to me something related to the PreparedStatement cache. Do you
use c3po? If so did you specify hibernate.c3p0.max_statements?

Martijn 


On Thu, 2008-07-24 at 23:26 -0400, Chris Lewis wrote:
> Ok, I've figured out what exactly is causing it and how to work around
> it. I can't say why, but perhaps a resident hibernate guru will know (it
> may even be a know issue or gotcha). First off, the quick fix. This
> query (and variations like load(), get(), and using the criteria api)
> cause the problem:
> 
> Listing listing = (Listing)session.createQuery("from Listing lst
> where lst.id=:id")
> .setLong("id", Long.valueOf(sListingId)).uniqueResult();
> 
> This works as expected:
> 
> Listing listing = (Listing)session.createQuery("from Listing lst
> where lst.id=" + sListingId)
> .uniqueResult();
> 
> It seems to come down to how hibernate handles the query results when
> the query is formed with a "raw" HQL string vs something like get(),
> load(), the criteria api, or using query parameters as I was initially
> doing. It also has something to do with the field being queried and
> seems to happen only on fields that exist in each of the tables. In my
> case the abstract super class Listing has the PK field "id", and the 2
> subclasses also have a PK field named "id." Querying by any method other
> than "constructed strings" leads to the issue, while querying on another
> field in the super class, whose name is unique to that class, works fine.
> 
> So the BIG question is why in the world does it work the first time and
> continue to work until the value one queries by changes?
> 
> I'd also like to know if anyone has seen this before, and/or if it's a
> known issue. I'm using a slightly outdated version of hibernate
> (3.2.2.ga) and for all I know this may be fixed in more recent versions.
> My wrists are shot so I'll try tomorrow. If anyone knows of this or gets
> interested/bored enough to try it, please let me know.
> 
> Thanks tons for all of your input.
> 
> Sincerely,
> Chris Lewis
> 
> Chris Lewis wrote:
> > Hello,
> >
> > I have a dispatcher that uses a hibernate session. The dispatcher is
> > auto bound and receives the session in the constructor. I'm using
> > tapestry-hibernate so that session instance is a proxy that gets the
> > real session for the current thread (right?). Now in testing my
> > dispatcher, I give it a url like:
> >
> > /MyContext/?limg=2
> >
> > The dispatcher looks for "limg" and if found, queries the session
> > assuming that its value is the PK of a mapped entity. When I trigger the
> > dispatcher for the first time it works fine. If I refresh the page,
> > fine. If I change the value to something else, say 3, then it breaks
> > with a org.hibernate.InstantiationException:
> >
> > Cannot instantiate abstract class or interface: com.mypackage.data.Listing
> >
> > If I change the value back to 2, the same thing happens! "Listing" is an
> > abstract class mapped as a super class entity via:
> >
> > @Entity
> > @Inheritance(strategy = InheritanceType.JOINED)
> >
> > Any clue what's going on here? Two things are perplexing me:
> >
> > 1) Querying mapped super classes is legal, and I in fact the same thing
> > on my Index page with no problem.
> > 2) The query works the first time, but as soon as the id changes it is
> > forever broken until I restart the container.
> >
> > Thanks in advance!
> >
> > chris
> >
> >   
> 


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



Re: [T4] Using differ validator on async form?

2008-07-24 Thread Kalle Korhonen
Ah, just answering to myself and for future reference. The form components
don't need to do anything special to support client-side validation, but in
my case the problem is that Hidden by default uses Datasqueezer to encode
the value, in practice adding an uppercase S to the beginning of the value
and thus causing the compared values to be different. You can use the hidden
field approach together with Differ when you turn encoding off on Hidden
component. Still; the built-in validators require a IFormComponent; at least
for Differ it might have made more sense that you could just specify a value
instead (but it's simple to implement your own component for this).

Kalle


On Thu, Jul 24, 2008 at 12:02 PM, Kalle Korhonen <[EMAIL PROTECTED]>
wrote:

> Is it possible to use Differ validator to validate a field shouldn't match
> a known value? Match/Differ expects to match against a form component; just
> any component won't do. In my case the value the value to differ against
> cannot change (think use case where a password cannot match with a
> username). So I just tried making the username a hidden field, then pointing
> the differ to that component, but client side validation doesn't work in
> that case, and the validation is only enforced on the server side (I guess
> because Hidden doesn't support client-side validation?). If the component to
> differ against is a normal text field, the client validation works ok, but I
> don't want a user to be able to change the field to differ against. I
> suppose I could hide this field from the user or do some other hack to make
> it work, but is there a clean way to implement it?
>
> Kalle
>


Re: t5components - Window

2008-07-24 Thread jgn

Maybe this would work:

You can use the t5componens/OnEvent mixin on a button or, maybe, on an
action link (I only have test this component on a textfield with the blur
event). Then, this mixin has a parameter called: onCompleteCallback, which
will call a javascript function when the ajax response finish. So, in this
javascript function you could open the window.

I mean, this would work if the idea is just to call a function on the server
side before open the window.

Hope this helps.
-- 
View this message in context: 
http://www.nabble.com/t5components---Window-tp18087605p18644933.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: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Chris Lewis
Ok, I've figured out what exactly is causing it and how to work around
it. I can't say why, but perhaps a resident hibernate guru will know (it
may even be a know issue or gotcha). First off, the quick fix. This
query (and variations like load(), get(), and using the criteria api)
cause the problem:

Listing listing = (Listing)session.createQuery("from Listing lst
where lst.id=:id")
.setLong("id", Long.valueOf(sListingId)).uniqueResult();

This works as expected:

Listing listing = (Listing)session.createQuery("from Listing lst
where lst.id=" + sListingId)
.uniqueResult();

It seems to come down to how hibernate handles the query results when
the query is formed with a "raw" HQL string vs something like get(),
load(), the criteria api, or using query parameters as I was initially
doing. It also has something to do with the field being queried and
seems to happen only on fields that exist in each of the tables. In my
case the abstract super class Listing has the PK field "id", and the 2
subclasses also have a PK field named "id." Querying by any method other
than "constructed strings" leads to the issue, while querying on another
field in the super class, whose name is unique to that class, works fine.

So the BIG question is why in the world does it work the first time and
continue to work until the value one queries by changes?

I'd also like to know if anyone has seen this before, and/or if it's a
known issue. I'm using a slightly outdated version of hibernate
(3.2.2.ga) and for all I know this may be fixed in more recent versions.
My wrists are shot so I'll try tomorrow. If anyone knows of this or gets
interested/bored enough to try it, please let me know.

Thanks tons for all of your input.

Sincerely,
Chris Lewis

Chris Lewis wrote:
> Hello,
>
> I have a dispatcher that uses a hibernate session. The dispatcher is
> auto bound and receives the session in the constructor. I'm using
> tapestry-hibernate so that session instance is a proxy that gets the
> real session for the current thread (right?). Now in testing my
> dispatcher, I give it a url like:
>
> /MyContext/?limg=2
>
> The dispatcher looks for "limg" and if found, queries the session
> assuming that its value is the PK of a mapped entity. When I trigger the
> dispatcher for the first time it works fine. If I refresh the page,
> fine. If I change the value to something else, say 3, then it breaks
> with a org.hibernate.InstantiationException:
>
> Cannot instantiate abstract class or interface: com.mypackage.data.Listing
>
> If I change the value back to 2, the same thing happens! "Listing" is an
> abstract class mapped as a super class entity via:
>
> @Entity
> @Inheritance(strategy = InheritanceType.JOINED)
>
> Any clue what's going on here? Two things are perplexing me:
>
> 1) Querying mapped super classes is legal, and I in fact the same thing
> on my Index page with no problem.
> 2) The query works the first time, but as soon as the id changes it is
> forever broken until I restart the container.
>
> Thanks in advance!
>
> chris
>
>   

-- 
http://thegodcode.net


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



Re: EagerLoad service doesn't use PerThread service correctly

2008-07-24 Thread Howard Lewis Ship
This looks like an issue ... I think EagerLoad is not compatible with
non-singleton scopes.

What does it mean to eager load a service that is, in fact, used in
multiple threads?

Ah, here's the issue; when you bind a class, not an interface, as a
service, it automatically uses singleton scope.  Only proxiable
services can have non-singleton scope, and that means an interface and
an implementation.  Tapestry should detect this and throw an
exception.

On Thu, Jul 24, 2008 at 11:01 AM, Franz Amador <[EMAIL PROTECTED]> wrote:
>
> I have an EagerLoad service that uses a PerThread service.  I expected the
> EagerLoad service to hold a reference to a proxy to the PerThread service so
> that the actual instance of the PerThread service that is used depends upon
> the thread calling the EagerLoad service.  Instead, the EagerLoad service is
> getting a reference to an actual instance of the PerThread service, not to a
> proxy, so the same instance of the PerThread service is getting used by all
> threads that call the EagerLoad service.  This surely can't be right.
> Here's a very simplified example:
>
> public class AppModule {
>public static void bind(ServiceBinder binder) {
>binder.bind(EagerLoadService.class);
>binder.bind(PerThreadService.class);
>}
> }
>
> @EagerLoad
> public class EagerLoadService {
>public EagerLoadService(PerThreadService perThreadService) {
>// prints "class PerThreadService", not a proxy class!
>System.out.println(perThreadService.getClass());
>}
> }
>
> @Scope(PERTHREAD_SCOPE)
> public class PerThreadService {
> }
>
> Is this a bug?  Am I confused about how this should work?  All help
> appreciated.
>
> --
> View this message in context: 
> http://www.nabble.com/EagerLoad-service-doesn%27t-use-PerThread-service-correctly-tp18637337p18637337.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]
>
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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



Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Chris Lewis
Thiago,

You must not have read my explanation of just how erratic this is, so
here it is again:

Quick summary of the behavior with the following urls:

1) request /LStAug/?limg=1
works

2) request /LStAug/?limg=1 (again)
works

3) request /LStAug/?limg=2
breaks

4) request /LStAug/?limg=1
breaks, where it worked before

(restart container)

1) request /LStAug/?limg=2
works

2) request /LStAug/?limg=1
breaks

3) request /LStAug/?limg=2
breaks


The same url with a certain id breaks when you switch to another one,
after having just worked. It doesn't matter which one it is. Id one will
work until you switch. Restart container. Id 2 will work until you
switch. Restart container. My relationships are text-book cases and
completely normalized. The same query - the simplest of simple selects -
works consistently as expected in pages.


Thiago H. de Paula Figueiredo wrote:
> Em Thu, 24 Jul 2008 18:14:32 -0300, Chris Lewis
> <[EMAIL PROTECTED]> escreveu:
>
>> This is occurring in a development environment on a fresh and small app
>> with a schema with a total of 6 mapped entities, 7 tables, 3 records in
>> the abstract entity's table, one user (me), and all queries working
>> completely normally in the context of pages. I can't say it's impossible
>> for this to be a data issue, but the odds of that are miniscule.
>
> I don't think so. When you have an inheritence mapping, yes, you can
> have an interface or abstract class on the top. When you query for
> your Listing class, Hibernate will create a query (typically a join
> with many tables) that will load all possible Listing instances. For
> each row in the returned ResultSet, Hibernate will try to figure out
> what is its corresponding class. When it doesn't find it, it assumes
> the row is from the searched type. In this case, Listing, an abstract
> class, thus you see that error message. So it really looks to me like
> an inheritence mapping problem or some Listing table row that doesn't
> have a matching one in the subclasses tables (JOINED_TABLE inheritence
> mapping).
>
> Please post your mappings and the generated SQL query here so we can
> check them. :)
>
> Thiago
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

-- 
http://thegodcode.net



Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Thiago H. de Paula Figueiredo
Em Thu, 24 Jul 2008 18:14:32 -0300, Chris Lewis  
<[EMAIL PROTECTED]> escreveu:



This is occurring in a development environment on a fresh and small app
with a schema with a total of 6 mapped entities, 7 tables, 3 records in
the abstract entity's table, one user (me), and all queries working
completely normally in the context of pages. I can't say it's impossible
for this to be a data issue, but the odds of that are miniscule.


I don't think so. When you have an inheritence mapping, yes, you can have  
an interface or abstract class on the top. When you query for your Listing  
class, Hibernate will create a query (typically a join with many tables)  
that will load all possible Listing instances. For each row in the  
returned ResultSet, Hibernate will try to figure out what is its  
corresponding class. When it doesn't find it, it assumes the row is from  
the searched type. In this case, Listing, an abstract class, thus you see  
that error message. So it really looks to me like an inheritence mapping  
problem or some Listing table row that doesn't have a matching one in the  
subclasses tables (JOINED_TABLE inheritence mapping).


Please post your mappings and the generated SQL query here so we can check  
them. :)


Thiago

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



RE: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Jonathan Barker

Making listing non-abstract "offends my sensibilities" but I occasionally
need to offend myself.

1) I've actually never tried. I did run into problems when joining two
hierarchies via a third relationship hierarchy. (Take two classes related by
an association where there are additional properties on the relation -
making it a class.  Now subclass everything.)  Hibernate worked
inconsistently as well.  I didn't delve far enough to elicit a pattern, but
it might be related.

2) Strange, I know.  The inconsistency I experienced was in a T5 project,
but I was executing it in a command-line utility class with Spring for
wiring things together.  I don't think your problem is T5-specific.

3) I've never had a problem with objects fetched via associations.

As a test, is there an association you can leverage?  Like "select au, li
from Author au join au.listings li where li.id = ?"

Then just ignore Author or whatever else you fetch?

Perhaps a guru on the Hibernate list can help.


> -Original Message-
> From: Chris Lewis [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 24, 2008 17:43
> To: Tapestry users
> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
> Session
> 
> I don't want to change Listing to be non-abstract, but I did try
> querying a concrete subclass and that doesn't suffer from the same
> defect. So that raises/reiterates a few questions
> 
> 1) Can't you, via HQL, query an interface or abstract class entity with
> the goal of getting a collection of all objects in a class hierarchy,
> where the actual instantiated types are correctly resolved by hibernate?
> 
> 2) Why in the world does this work if I query one specific entity - even
> subsequent requests for the same one - until I query a different one at
> which point it is permanently broken?
> 
> 3) Even though I'm not having this in my page class where I need all of
> the varying subclass entity instances in a single collection, should I
> be worried? I imagine the answer to #1 will answer this.
> 
> I haven't verified that this happens in a non-T5 context, but I'll test
> that later and share my findings.
> 
> chris
> 
> Jonathan Barker wrote:
> > Be paranoid.  Set hibernate.show_sql=true. Grab the SQL statement, and
> > execute it manually.
> >
> > Also, can you change Listing to be non-abstract - even if you never use
> it?
> >
> >
> >
> >
> >> -Original Message-
> >> From: Chris Lewis [mailto:[EMAIL PROTECTED]
> >> Sent: Thursday, July 24, 2008 15:41
> >> To: Tapestry users
> >> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
> >> Session
> >>
> >> I haven't looked at the source of hibernate (or read) to see what
> >> exactly goes on, but the erratic behavior of load() is precisely the
> >> same as this:
> >>
> >> Listing listing = (Listing)session.createQuery("from Listing
> >> where id=:id")
> >> .setLong("id", Long.parseLong(sListingId)).uniqueResult();
> >>
> >> I just replaced the load() call with this, so now the source is:
> >>
> >> public class BinaryFileDispatcher implements Dispatcher {
> >>
> >> private Session session;
> >>
> >> public BinaryFileDispatcher(Session session) {
> >> this.session = session;
> >> }
> >>
> >> public boolean dispatch(Request request, Response response)
> >> throws IOException {
> >>
> >> String sListingId = request.getParameter("limg");
> >> if(sListingId== null)
> >> return false;
> >>
> >> System.out.println("BinaryFileDispatcher.dispatch() -- " +
> >> sListingId);
> >>
> >> Listing listing = (Listing)session.createQuery("from Listing
> >> where id=:id")
> >> .setLong("id", Long.parseLong(sListingId)).uniqueResult();
> >>
> >> response.setHeader("Content-Type", "text/html");
> >>
> >> String test = "" + listing.getTitle() +
> >> "";
> >> response.setContentLength(test.length());
> >> PrintWriter writer = response.getPrintWriter("text/html");
> >> writer.append(test).flush();
> >> return true;
> >> }
> >>
> >> }
> >>
> >>
> >> Quick summary of the behavior with the following urls:
> >>
> >> 1) request /LStAug/?limg=1
> >> works
> >>
> >> 2) request /LStAug/?limg=1 (again)
> >> works
> >>
> >> 3) request /LStAug/?limg=2
> >> breaks
> >>
> >> 4) request /LStAug/?limg=1
> >> breaks, where it worked before
> >>
> >> (restart container)
> >>
> >> 1) request /LStAug/?limg=2
> >> works
> >>
> >> 2) request /LStAug/?limg=1
> >> breaks
> >>
> >> 3) request /LStAug/?limg=2
> >> breaks
> >>
> >> so strange.
> >>
> >>
> >> Jonathan Barker wrote:
> >>
> >>> I'm not sure why it WORKED.
> >>>
> >>> Session.load will try to create an instance of Listing, which it can't
> >>> because it is abstract.
> >>>
> >>> On the other hand, if you do a query, then even though you ask for a
> >>> Listing, Hibernate will look for any descendant of Listing.
> >>>
> >>> The actual object type returned will d

Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Chris Lewis
I don't want to change Listing to be non-abstract, but I did try
querying a concrete subclass and that doesn't suffer from the same
defect. So that raises/reiterates a few questions

1) Can't you, via HQL, query an interface or abstract class entity with
the goal of getting a collection of all objects in a class hierarchy,
where the actual instantiated types are correctly resolved by hibernate?

2) Why in the world does this work if I query one specific entity - even
subsequent requests for the same one - until I query a different one at
which point it is permanently broken?

3) Even though I'm not having this in my page class where I need all of
the varying subclass entity instances in a single collection, should I
be worried? I imagine the answer to #1 will answer this.

I haven't verified that this happens in a non-T5 context, but I'll test
that later and share my findings.

chris

Jonathan Barker wrote:
> Be paranoid.  Set hibernate.show_sql=true. Grab the SQL statement, and
> execute it manually.
>
> Also, can you change Listing to be non-abstract - even if you never use it?
>
>
>
>   
>> -Original Message-
>> From: Chris Lewis [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, July 24, 2008 15:41
>> To: Tapestry users
>> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
>> Session
>>
>> I haven't looked at the source of hibernate (or read) to see what
>> exactly goes on, but the erratic behavior of load() is precisely the
>> same as this:
>>
>> Listing listing = (Listing)session.createQuery("from Listing
>> where id=:id")
>> .setLong("id", Long.parseLong(sListingId)).uniqueResult();
>>
>> I just replaced the load() call with this, so now the source is:
>>
>> public class BinaryFileDispatcher implements Dispatcher {
>>
>> private Session session;
>>
>> public BinaryFileDispatcher(Session session) {
>> this.session = session;
>> }
>>
>> public boolean dispatch(Request request, Response response)
>> throws IOException {
>>
>> String sListingId = request.getParameter("limg");
>> if(sListingId== null)
>> return false;
>>
>> System.out.println("BinaryFileDispatcher.dispatch() -- " +
>> sListingId);
>>
>> Listing listing = (Listing)session.createQuery("from Listing
>> where id=:id")
>> .setLong("id", Long.parseLong(sListingId)).uniqueResult();
>>
>> response.setHeader("Content-Type", "text/html");
>>
>> String test = "" + listing.getTitle() +
>> "";
>> response.setContentLength(test.length());
>> PrintWriter writer = response.getPrintWriter("text/html");
>> writer.append(test).flush();
>> return true;
>> }
>>
>> }
>>
>>
>> Quick summary of the behavior with the following urls:
>>
>> 1) request /LStAug/?limg=1
>> works
>>
>> 2) request /LStAug/?limg=1 (again)
>> works
>>
>> 3) request /LStAug/?limg=2
>> breaks
>>
>> 4) request /LStAug/?limg=1
>> breaks, where it worked before
>>
>> (restart container)
>>
>> 1) request /LStAug/?limg=2
>> works
>>
>> 2) request /LStAug/?limg=1
>> breaks
>>
>> 3) request /LStAug/?limg=2
>> breaks
>>
>> so strange.
>>
>>
>> Jonathan Barker wrote:
>> 
>>> I'm not sure why it WORKED.
>>>
>>> Session.load will try to create an instance of Listing, which it can't
>>> because it is abstract.
>>>
>>> On the other hand, if you do a query, then even though you ask for a
>>> Listing, Hibernate will look for any descendant of Listing.
>>>
>>> The actual object type returned will depend on the actual type for any
>>> instance found. You can then cast to Listing without a problem.
>>>
>>> Get rid of load().
>>>
>>> Jonathan
>>>
>>>
>>>   
 -Original Message-
 From: Chris Lewis [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 24, 2008 14:37
 To: Tapestry users
 Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
 Session

 Hi Jonathan,

 Here is my dispatcher. As you can see it's in a very early stage so
 
>> it's
>> 
 both small and messy. The query is being done via:
 session.load(Listing.class, Long.parseLong(sListingId));

 It was being done via createQuery and uniqueResult, with the same
 
>> results.
>> 
 public class BinaryFileDispatcher implements Dispatcher {

 private Session session;

 public BinaryFileDispatcher(Session session) {
 this.session = session;
 }

 public boolean dispatch(Request request, Response response)
 throws IOException {

 String sListingId = request.getParameter("limg");
 if(sListingId== null)
 return false;

 System.out.println("BinaryFileDispatcher.dispatch() --
 
>> "
>> 
 + sListingId);
 Listing listing = (

Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Chris Lewis
I'm showing the sql and in the conditions where the query is successful
it's as it should be. When it bombs it doesn't even reach the point
where the query is executed. It's almost like it forgets its mappings...

Jonathan Barker wrote:
> Be paranoid.  Set hibernate.show_sql=true. Grab the SQL statement, and
> execute it manually.
>
> Also, can you change Listing to be non-abstract - even if you never use it?
>
>
>
>   
>> -Original Message-
>> From: Chris Lewis [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, July 24, 2008 15:41
>> To: Tapestry users
>> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
>> Session
>>
>> I haven't looked at the source of hibernate (or read) to see what
>> exactly goes on, but the erratic behavior of load() is precisely the
>> same as this:
>>
>> Listing listing = (Listing)session.createQuery("from Listing
>> where id=:id")
>> .setLong("id", Long.parseLong(sListingId)).uniqueResult();
>>
>> I just replaced the load() call with this, so now the source is:
>>
>> public class BinaryFileDispatcher implements Dispatcher {
>>
>> private Session session;
>>
>> public BinaryFileDispatcher(Session session) {
>> this.session = session;
>> }
>>
>> public boolean dispatch(Request request, Response response)
>> throws IOException {
>>
>> String sListingId = request.getParameter("limg");
>> if(sListingId== null)
>> return false;
>>
>> System.out.println("BinaryFileDispatcher.dispatch() -- " +
>> sListingId);
>>
>> Listing listing = (Listing)session.createQuery("from Listing
>> where id=:id")
>> .setLong("id", Long.parseLong(sListingId)).uniqueResult();
>>
>> response.setHeader("Content-Type", "text/html");
>>
>> String test = "" + listing.getTitle() +
>> "";
>> response.setContentLength(test.length());
>> PrintWriter writer = response.getPrintWriter("text/html");
>> writer.append(test).flush();
>> return true;
>> }
>>
>> }
>>
>>
>> Quick summary of the behavior with the following urls:
>>
>> 1) request /LStAug/?limg=1
>> works
>>
>> 2) request /LStAug/?limg=1 (again)
>> works
>>
>> 3) request /LStAug/?limg=2
>> breaks
>>
>> 4) request /LStAug/?limg=1
>> breaks, where it worked before
>>
>> (restart container)
>>
>> 1) request /LStAug/?limg=2
>> works
>>
>> 2) request /LStAug/?limg=1
>> breaks
>>
>> 3) request /LStAug/?limg=2
>> breaks
>>
>> so strange.
>>
>>
>> Jonathan Barker wrote:
>> 
>>> I'm not sure why it WORKED.
>>>
>>> Session.load will try to create an instance of Listing, which it can't
>>> because it is abstract.
>>>
>>> On the other hand, if you do a query, then even though you ask for a
>>> Listing, Hibernate will look for any descendant of Listing.
>>>
>>> The actual object type returned will depend on the actual type for any
>>> instance found. You can then cast to Listing without a problem.
>>>
>>> Get rid of load().
>>>
>>> Jonathan
>>>
>>>
>>>   
 -Original Message-
 From: Chris Lewis [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 24, 2008 14:37
 To: Tapestry users
 Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
 Session

 Hi Jonathan,

 Here is my dispatcher. As you can see it's in a very early stage so
 
>> it's
>> 
 both small and messy. The query is being done via:
 session.load(Listing.class, Long.parseLong(sListingId));

 It was being done via createQuery and uniqueResult, with the same
 
>> results.
>> 
 public class BinaryFileDispatcher implements Dispatcher {

 private Session session;

 public BinaryFileDispatcher(Session session) {
 this.session = session;
 }

 public boolean dispatch(Request request, Response response)
 throws IOException {

 String sListingId = request.getParameter("limg");
 if(sListingId== null)
 return false;

 System.out.println("BinaryFileDispatcher.dispatch() --
 
>> "
>> 
 + sListingId);
 Listing listing = (Listing)session.load(Listing.class,
 Long.parseLong(sListingId));

 response.setHeader("Content-Type", "text/html");

 String test = "" + listing.getTitle() +
 "";
 response.setContentLength(test.length());

 
>> response.getPrintWriter("text/html").append(test).flush();
>> 
 return true;
 }

 }


 Jonathan Barker wrote:

 
> Post your query and load code.
>
>
>
>   
>> -Original Message-
>> From: Chris Lewis [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, July 24, 2008 

Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Chris Lewis


Brian Lough wrote:
> Right on.  So imagine Snoopy's fist shake to the sky after being
> perforated by the Red Baron (Hibernate). . . ;-)
>
> You're dealing with alot of code layers, and potentially a data issue
> here (one instance you are trying to query could be represented
> in the schema just differently enough to cause this error).
This is occurring in a development environment on a fresh and small app
with a schema with a total of 6 mapped entities, 7 tables, 3 records in
the abstract entity's table, one user (me), and all queries working
completely normally in the context of pages. I can't say it's impossible
for this to be a data issue, but the odds of that are miniscule.
> Personally, I start with HibernateUtils unit tests to verify Hibernate
> and my
> low-level code first, then move to TapestryIOC outside the container
> to test the services for T5 use I've coded up, then the T5 pages: I don't
> do Hibernate in Dispatchers.  Again, too many layers changing
> underneath (no offense to anyone, just the way it is): plus, I code for
> multi-frameworks.
>
> Point issue: I got nuthin', except intuition screams session cache
> hold-over (Hibernate thinks you're asking for two distinct instances
> but with the
> same persistent id).  Architectural curiosity: why load in a
> dispatcher and what benefit is there?
As it turns out it doesn't make sense for what I'm writing (a binary
file dispatcher), but when I ran into this I was struck with a bolt of
"I must understand this." A realistic use however is access control, in
which you want to restrict T5-specific idioms like a "page" or "component."
>
>
> Chris Lewis wrote:
>> Padawn,
>>
>> Per your suggestion I tried the get method with the exact same results:
>>
>> Listing listing = (Listing)session.get(Listing.class,
>> Long.parseLong(sListingId));
>>
>> I also changed the dispatcher so that it uses the
>> HibernateSessionManager to get the current session explicitly on each
>> request, to no avail. I fell like something simple is evading me. My
>> dispatcher fires before the page render dispatcher, does its thing, and
>> then returns true (if handled) like any other one. Do I need to do any
>> manual hibernate cleanup? I thought this was handled by a background
>> event but I'm at a bit of a loss...
>>
>> thanks again for all the input
>>
>> snoopy dance made me laugh :-D
>>
>> Padawn wrote:
>>  
>>> Since it's just my intuition speaking, I may be off-base, but...this
>>> sounds
>>> like the beloved Hibernate Proxy and/or Cache issue, both of which
>>> SnoopyDance all-over gray concurrency areas.  Try substituting the
>>> query
>>> code for a, literally, straight get(persistentClass, databaseId);
>>> call and
>>> see if the issue is still there.  Bit of a performance it, but
>>> better to sweat that later.
>>>   
>>
>>   
>

-- 
http://thegodcode.net


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



Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Padawn


Chris Lewis-5 wrote:
> 
> Do I need to do any manual hibernate cleanup? I thought this was handled
> by a background
> event but I'm at a bit of a loss...
> 

Actually, Uber T5 folks, this raises a good question: when using an ORM
framework, are there specific gotcha's to be sensitive to when accessing the
ORM in a Dispatcher -vs- a Page?  Tapestry does so much under the covers,
there has to be something different.

Chris, as a final volley into the clouds,  I would attempt to duplicate the
error using Hibernate totally outside Tapestry first, with and without
Hibernate caching: that might clue you in.

  


-- 
View this message in context: 
http://www.nabble.com/T5.0.14-SNAPSHOT%3A-strange-behavior-Dispatcher-when-using-a-Session-tp18624780p18640399.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]



https to https

2008-07-24 Thread tapestry5

I have a secure page (https) which calls my tapestry page. when i do a
servlet call on return i get http back and not https. I read about @secure
annotation. I am using 5.0.10. I don't see @secure annotation in that pkg.

Thanks
-- 
View this message in context: 
http://www.nabble.com/https-to-https-tp18640298p18640298.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: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Brian Lough
Right on.  So imagine Snoopy's fist shake to the sky after being 
perforated by the Red Baron (Hibernate). . . ;-)


You're dealing with alot of code layers, and potentially a data issue 
here (one instance you are trying to query could be represented
in the schema just differently enough to cause this error). Personally, 
I start with HibernateUtils unit tests to verify Hibernate and my
low-level code first, then move to TapestryIOC outside the container to 
test the services for T5 use I've coded up, then the T5 pages: I don't
do Hibernate in Dispatchers.  Again, too many layers changing underneath 
(no offense to anyone, just the way it is): plus, I code for

multi-frameworks.

Point issue: I got nuthin', except intuition screams session cache 
hold-over (Hibernate thinks you're asking for two distinct instances but 
with the
same persistent id).  Architectural curiosity: why load in a dispatcher 
and what benefit is there?


Chris Lewis wrote:

Padawn,

Per your suggestion I tried the get method with the exact same results:

Listing listing = (Listing)session.get(Listing.class,
Long.parseLong(sListingId));

I also changed the dispatcher so that it uses the
HibernateSessionManager to get the current session explicitly on each
request, to no avail. I fell like something simple is evading me. My
dispatcher fires before the page render dispatcher, does its thing, and
then returns true (if handled) like any other one. Do I need to do any
manual hibernate cleanup? I thought this was handled by a background
event but I'm at a bit of a loss...

thanks again for all the input

snoopy dance made me laugh :-D

Padawn wrote:
  

Since it's just my intuition speaking, I may be off-base, but...this sounds
like the beloved Hibernate Proxy and/or Cache issue, both of which
SnoopyDance all-over gray concurrency areas.  Try substituting the query
code for a, literally, straight get(persistentClass, databaseId); call and
see if the issue is still there.  
Bit of a performance it, but better to sweat that later.
  



  


RE: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Jonathan Barker


Be paranoid.  Set hibernate.show_sql=true. Grab the SQL statement, and
execute it manually.

Also, can you change Listing to be non-abstract - even if you never use it?



> -Original Message-
> From: Chris Lewis [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 24, 2008 15:41
> To: Tapestry users
> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
> Session
> 
> I haven't looked at the source of hibernate (or read) to see what
> exactly goes on, but the erratic behavior of load() is precisely the
> same as this:
> 
> Listing listing = (Listing)session.createQuery("from Listing
> where id=:id")
> .setLong("id", Long.parseLong(sListingId)).uniqueResult();
> 
> I just replaced the load() call with this, so now the source is:
> 
> public class BinaryFileDispatcher implements Dispatcher {
> 
> private Session session;
> 
> public BinaryFileDispatcher(Session session) {
> this.session = session;
> }
> 
> public boolean dispatch(Request request, Response response)
> throws IOException {
> 
> String sListingId = request.getParameter("limg");
> if(sListingId== null)
> return false;
> 
> System.out.println("BinaryFileDispatcher.dispatch() -- " +
> sListingId);
> 
> Listing listing = (Listing)session.createQuery("from Listing
> where id=:id")
> .setLong("id", Long.parseLong(sListingId)).uniqueResult();
> 
> response.setHeader("Content-Type", "text/html");
> 
> String test = "" + listing.getTitle() +
> "";
> response.setContentLength(test.length());
> PrintWriter writer = response.getPrintWriter("text/html");
> writer.append(test).flush();
> return true;
> }
> 
> }
> 
> 
> Quick summary of the behavior with the following urls:
> 
> 1) request /LStAug/?limg=1
> works
> 
> 2) request /LStAug/?limg=1 (again)
> works
> 
> 3) request /LStAug/?limg=2
> breaks
> 
> 4) request /LStAug/?limg=1
> breaks, where it worked before
> 
> (restart container)
> 
> 1) request /LStAug/?limg=2
> works
> 
> 2) request /LStAug/?limg=1
> breaks
> 
> 3) request /LStAug/?limg=2
> breaks
> 
> so strange.
> 
> 
> Jonathan Barker wrote:
> > I'm not sure why it WORKED.
> >
> > Session.load will try to create an instance of Listing, which it can't
> > because it is abstract.
> >
> > On the other hand, if you do a query, then even though you ask for a
> > Listing, Hibernate will look for any descendant of Listing.
> >
> > The actual object type returned will depend on the actual type for any
> > instance found. You can then cast to Listing without a problem.
> >
> > Get rid of load().
> >
> > Jonathan
> >
> >
> >> -Original Message-
> >> From: Chris Lewis [mailto:[EMAIL PROTECTED]
> >> Sent: Thursday, July 24, 2008 14:37
> >> To: Tapestry users
> >> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
> >> Session
> >>
> >> Hi Jonathan,
> >>
> >> Here is my dispatcher. As you can see it's in a very early stage so
> it's
> >> both small and messy. The query is being done via:
> >> session.load(Listing.class, Long.parseLong(sListingId));
> >>
> >> It was being done via createQuery and uniqueResult, with the same
> results.
> >>
> >> public class BinaryFileDispatcher implements Dispatcher {
> >>
> >> private Session session;
> >>
> >> public BinaryFileDispatcher(Session session) {
> >> this.session = session;
> >> }
> >>
> >> public boolean dispatch(Request request, Response response)
> >> throws IOException {
> >>
> >> String sListingId = request.getParameter("limg");
> >> if(sListingId== null)
> >> return false;
> >>
> >> System.out.println("BinaryFileDispatcher.dispatch() --
> "
> >> + sListingId);
> >> Listing listing = (Listing)session.load(Listing.class,
> >> Long.parseLong(sListingId));
> >>
> >> response.setHeader("Content-Type", "text/html");
> >>
> >> String test = "" + listing.getTitle() +
> >> "";
> >> response.setContentLength(test.length());
> >>
> response.getPrintWriter("text/html").append(test).flush();
> >> return true;
> >> }
> >>
> >> }
> >>
> >>
> >> Jonathan Barker wrote:
> >>
> >>> Post your query and load code.
> >>>
> >>>
> >>>
>  -Original Message-
>  From: Chris Lewis [mailto:[EMAIL PROTECTED]
>  Sent: Thursday, July 24, 2008 13:16
>  To: Tapestry users
>  Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using
> a
>  Session
> 
>  It can't be a data issue. The records are persisted via hibernate and
>  work consistently as expected in pages. Like I said, I query the same
>  table to which the abstract class is mapped in my index page with no
>  problem at all. I also said that it works in the dispatcher for the
> 

Re: void onActivate(String ,String)

2008-07-24 Thread Josh Canfield
Phew, that's good. I was thinking it might be something harder :)

On Thu, Jul 24, 2008 at 1:33 PM, tapestry5 <[EMAIL PROTECTED]> wrote:

>
> You are right.
>
> I changed the url in the css links and script links but missed to change in
> the links of images.
>
> Its working now.
>
> Thanks.
>
>
>
> joshcanfield wrote:
> >
> > show us the urls generated for your page and the urls generated for the
> > images.
> >
> > On Thu, Jul 24, 2008 at 11:51 AM, tapestry5 <[EMAIL PROTECTED]>
> wrote:
> >
> >>
> >> I tried changing path but it still gives me same values
> >>
> >>
> >> joshcanfield wrote:
> >> >
> >> > Look at the html that your page is generating. Your image/js paths are
> >> > probably relative to the page.
> >> >
> >> > You probably have:
> >> >  images/myimage.jpg
> >> > you want
> >>  >  /images/myimage.jpg
> >> > Josh
> >> > On Thu, Jul 24, 2008 at 9:13 AM, tapestry5 <[EMAIL PROTECTED]>
> >> wrote:
> >> >
> >> >>
> >> >> When ever i use onActivate in my tapestry page i see that it is
> called
> >> >> multiple times.
> >> >>
> >> >> I am using onActivate(String ,String).
> >> >>
> >> >> In first instance it will take the right value and in the second
> >> instance
> >> >> it
> >> >> will replace the last value with my resource folder names.
> >> >>
> >> >> eg: 1st time when OnActivation(String _val1, String _val2) is called
> >> the
> >> >> value was test1/test2
> >> >> 2nd time when OnActivation(String _val1, String _val2) is called the
> >> >> value
> >> >> was test1/images
> >> >> 3rd time when OnActivation(String _val1, String _val2) is called the
> >> >> value
> >> >> was test1/js
> >> >>
> >> >> I am not sure why this is happening.
> >> >>
> >> >> Is it that i am calling a wrong method?
> >> >> Any help??
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18635295.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]
> >> >>
> >> >>
> >> >
> >> >
> >> > --
> >> > --
> >> > TheDailyTube.com. Sign up and get the best new videos on the internet
> >> > delivered fresh to your inbox.
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18638141.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]
> >>
> >>
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18639492.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]
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.


Re: void onActivate(String ,String)

2008-07-24 Thread tapestry5

You are right. 

I changed the url in the css links and script links but missed to change in
the links of images.

Its working now. 

Thanks.



joshcanfield wrote:
> 
> show us the urls generated for your page and the urls generated for the
> images.
> 
> On Thu, Jul 24, 2008 at 11:51 AM, tapestry5 <[EMAIL PROTECTED]> wrote:
> 
>>
>> I tried changing path but it still gives me same values
>>
>>
>> joshcanfield wrote:
>> >
>> > Look at the html that your page is generating. Your image/js paths are
>> > probably relative to the page.
>> >
>> > You probably have:
>> >  images/myimage.jpg
>> > you want
>>  >  /images/myimage.jpg
>> > Josh
>> > On Thu, Jul 24, 2008 at 9:13 AM, tapestry5 <[EMAIL PROTECTED]>
>> wrote:
>> >
>> >>
>> >> When ever i use onActivate in my tapestry page i see that it is called
>> >> multiple times.
>> >>
>> >> I am using onActivate(String ,String).
>> >>
>> >> In first instance it will take the right value and in the second
>> instance
>> >> it
>> >> will replace the last value with my resource folder names.
>> >>
>> >> eg: 1st time when OnActivation(String _val1, String _val2) is called
>> the
>> >> value was test1/test2
>> >> 2nd time when OnActivation(String _val1, String _val2) is called the
>> >> value
>> >> was test1/images
>> >> 3rd time when OnActivation(String _val1, String _val2) is called the
>> >> value
>> >> was test1/js
>> >>
>> >> I am not sure why this is happening.
>> >>
>> >> Is it that i am calling a wrong method?
>> >> Any help??
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18635295.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]
>> >>
>> >>
>> >
>> >
>> > --
>> > --
>> > TheDailyTube.com. Sign up and get the best new videos on the internet
>> > delivered fresh to your inbox.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18638141.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]
>>
>>
> 
> 
> -- 
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18639492.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: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Chris Lewis
Padawn,

Per your suggestion I tried the get method with the exact same results:

Listing listing = (Listing)session.get(Listing.class,
Long.parseLong(sListingId));

I also changed the dispatcher so that it uses the
HibernateSessionManager to get the current session explicitly on each
request, to no avail. I fell like something simple is evading me. My
dispatcher fires before the page render dispatcher, does its thing, and
then returns true (if handled) like any other one. Do I need to do any
manual hibernate cleanup? I thought this was handled by a background
event but I'm at a bit of a loss...

thanks again for all the input

snoopy dance made me laugh :-D

Padawn wrote:
> Since it's just my intuition speaking, I may be off-base, but...this sounds
> like the beloved Hibernate Proxy and/or Cache issue, both of which
> SnoopyDance all-over gray concurrency areas.  Try substituting the query
> code for a, literally, straight get(persistentClass, databaseId); call and
> see if the issue is still there.  
> Bit of a performance it, but better to sweat that later.
>   

-- 
http://thegodcode.net


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



Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Padawn

Since it's just my intuition speaking, I may be off-base, but...this sounds
like the beloved Hibernate Proxy and/or Cache issue, both of which
SnoopyDance all-over gray concurrency areas.  Try substituting the query
code for a, literally, straight get(persistentClass, databaseId); call and
see if the issue is still there.  
Bit of a performance it, but better to sweat that later.
-- 
View this message in context: 
http://www.nabble.com/T5.0.14-SNAPSHOT%3A-strange-behavior-Dispatcher-when-using-a-Session-tp18624780p18639009.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: void onActivate(String ,String)

2008-07-24 Thread Padawn

Event bubbling?  In 5.0.13 I have a page with two onActivate()'s, both of
which will get invoked.

.java
  1.  void onActivate(Object[] projectContext) {..} // pagelink handler with
a context of two Long ids
  2.  void onActivate(Long taskId) { ... }  // pagelink handler
with standard persistent id of object to edit

If coded such that neither handler throws an exception [purposefully], both
will always be invoked.  To use the two methods, I had to change the return
type to boolean and add this code to handler #1: 
// It's an Edit
if (projectContext.length != 2) {
return Boolean.FALSE;
} 

which allows onActivate(Long taskId) {..} to be invoked.  And

   // Handle the Add with context
   ...
  return Boolean.TRUE;

which short-circuits the processing so the onActivate(Long taskId) does NOT
get invoked.  
Not knowledgeable enough to explain why, just a FWIW from a behavior
perspective.  My guess is that since the multi-param onActivate(..) handler
exists, the magic part of Tapestry is consuming what it sees as arguments
until none are left, or the least common denominator method(argument) is
invoked.







-- 
View this message in context: 
http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18639005.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: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Chris Lewis
I haven't looked at the source of hibernate (or read) to see what
exactly goes on, but the erratic behavior of load() is precisely the
same as this:

Listing listing = (Listing)session.createQuery("from Listing
where id=:id")
.setLong("id", Long.parseLong(sListingId)).uniqueResult();

I just replaced the load() call with this, so now the source is:

public class BinaryFileDispatcher implements Dispatcher {
   
private Session session;
   
public BinaryFileDispatcher(Session session) {
this.session = session;
}
   
public boolean dispatch(Request request, Response response)
throws IOException {
   
String sListingId = request.getParameter("limg");
if(sListingId== null)
return false;
   
System.out.println("BinaryFileDispatcher.dispatch() -- " +
sListingId);
   
Listing listing = (Listing)session.createQuery("from Listing
where id=:id")
.setLong("id", Long.parseLong(sListingId)).uniqueResult();
   
response.setHeader("Content-Type", "text/html");
   
String test = "" + listing.getTitle() +
"";
response.setContentLength(test.length());
PrintWriter writer = response.getPrintWriter("text/html");
writer.append(test).flush();
return true;
}

}


Quick summary of the behavior with the following urls:

1) request /LStAug/?limg=1
works

2) request /LStAug/?limg=1 (again)
works

3) request /LStAug/?limg=2
breaks

4) request /LStAug/?limg=1
breaks, where it worked before

(restart container)

1) request /LStAug/?limg=2
works

2) request /LStAug/?limg=1
breaks

3) request /LStAug/?limg=2
breaks

so strange.


Jonathan Barker wrote:
> I'm not sure why it WORKED.
>
> Session.load will try to create an instance of Listing, which it can't
> because it is abstract.
>
> On the other hand, if you do a query, then even though you ask for a
> Listing, Hibernate will look for any descendant of Listing. 
>
> The actual object type returned will depend on the actual type for any
> instance found. You can then cast to Listing without a problem.
>
> Get rid of load().
>
> Jonathan
>
>   
>> -Original Message-
>> From: Chris Lewis [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, July 24, 2008 14:37
>> To: Tapestry users
>> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
>> Session
>>
>> Hi Jonathan,
>>
>> Here is my dispatcher. As you can see it's in a very early stage so it's
>> both small and messy. The query is being done via:
>> session.load(Listing.class, Long.parseLong(sListingId));
>>
>> It was being done via createQuery and uniqueResult, with the same results.
>>
>> public class BinaryFileDispatcher implements Dispatcher {
>>
>> private Session session;
>>
>> public BinaryFileDispatcher(Session session) {
>> this.session = session;
>> }
>>
>> public boolean dispatch(Request request, Response response)
>> throws IOException {
>>
>> String sListingId = request.getParameter("limg");
>> if(sListingId== null)
>> return false;
>>
>> System.out.println("BinaryFileDispatcher.dispatch() -- "
>> + sListingId);
>> Listing listing = (Listing)session.load(Listing.class,
>> Long.parseLong(sListingId));
>>
>> response.setHeader("Content-Type", "text/html");
>>
>> String test = "" + listing.getTitle() +
>> "";
>> response.setContentLength(test.length());
>> response.getPrintWriter("text/html").append(test).flush();
>> return true;
>> }
>>
>> }
>>
>>
>> Jonathan Barker wrote:
>> 
>>> Post your query and load code.
>>>
>>>
>>>   
 -Original Message-
 From: Chris Lewis [mailto:[EMAIL PROTECTED]
 Sent: Thursday, July 24, 2008 13:16
 To: Tapestry users
 Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
 Session

 It can't be a data issue. The records are persisted via hibernate and
 work consistently as expected in pages. Like I said, I query the same
 table to which the abstract class is mapped in my index page with no
 problem at all. I also said that it works in the dispatcher for the
 first entity I query, but any subsequent query to a _different_ entity
 throws that exception. The query is also just a read (select). Any
 
>> other
>> 
 ideas?

 thanks

 Yunhua Sang wrote:

 
> It sounds more like a data issue, check your data in database
>   
>> carefully.
>> 
> Yunhua
>
> On Wed, Jul 23, 2008 at 11:18 PM, Chris Lewis
>
>   
 <[EMAIL PROTECTED]> wrote:

 
>> Hello,
>>
>> I have a dispatcher that uses a hibernate session. The dispatcher is
>> auto bound and receives the

RE: void onActivate(String ,String)

2008-07-24 Thread Jonathan Barker

I switched over to using Assets and then in the page/component class using
@Inject 
@Path("context:/images/Logo.gif")
@Property(read=true)
private Asset _logo;

 
> -Original Message-
> From: tapestry5 [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 24, 2008 14:51
> To: users@tapestry.apache.org
> Subject: Re: void onActivate(String ,String)
> 
> 
> I tried changing path but it still gives me same values
> 
> 
> joshcanfield wrote:
> >
> > Look at the html that your page is generating. Your image/js paths are
> > probably relative to the page.
> >
> > You probably have:
> >  images/myimage.jpg
> > you want
> >  /images/myimage.jpg
> > Josh
> > On Thu, Jul 24, 2008 at 9:13 AM, tapestry5 <[EMAIL PROTECTED]>
> wrote:
> >
> >>
> >> When ever i use onActivate in my tapestry page i see that it is called
> >> multiple times.
> >>
> >> I am using onActivate(String ,String).
> >>
> >> In first instance it will take the right value and in the second
> instance
> >> it
> >> will replace the last value with my resource folder names.
> >>
> >> eg: 1st time when OnActivation(String _val1, String _val2) is called
> the
> >> value was test1/test2
> >> 2nd time when OnActivation(String _val1, String _val2) is called the
> >> value
> >> was test1/images
> >> 3rd time when OnActivation(String _val1, String _val2) is called the
> >> value
> >> was test1/js
> >>
> >> I am not sure why this is happening.
> >>
> >> Is it that i am calling a wrong method?
> >> Any help??
> >> --
> >> View this message in context:
> >> http://www.nabble.com/void-onActivate%28String-%2CString%29-
> tp18635295p18635295.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]
> >>
> >>
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
> >
> 
> --
> View this message in context: http://www.nabble.com/void-
> onActivate%28String-%2CString%29-tp18635295p18638141.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]


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



RE: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Jonathan Barker

I'm not sure why it WORKED.

Session.load will try to create an instance of Listing, which it can't
because it is abstract.

On the other hand, if you do a query, then even though you ask for a
Listing, Hibernate will look for any descendant of Listing. 

The actual object type returned will depend on the actual type for any
instance found. You can then cast to Listing without a problem.

Get rid of load().

Jonathan

> -Original Message-
> From: Chris Lewis [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 24, 2008 14:37
> To: Tapestry users
> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
> Session
> 
> Hi Jonathan,
> 
> Here is my dispatcher. As you can see it's in a very early stage so it's
> both small and messy. The query is being done via:
> session.load(Listing.class, Long.parseLong(sListingId));
> 
> It was being done via createQuery and uniqueResult, with the same results.
> 
> public class BinaryFileDispatcher implements Dispatcher {
> 
> private Session session;
> 
> public BinaryFileDispatcher(Session session) {
> this.session = session;
> }
> 
> public boolean dispatch(Request request, Response response)
> throws IOException {
> 
> String sListingId = request.getParameter("limg");
> if(sListingId== null)
> return false;
> 
> System.out.println("BinaryFileDispatcher.dispatch() -- "
> + sListingId);
> Listing listing = (Listing)session.load(Listing.class,
> Long.parseLong(sListingId));
> 
> response.setHeader("Content-Type", "text/html");
> 
> String test = "" + listing.getTitle() +
> "";
> response.setContentLength(test.length());
> response.getPrintWriter("text/html").append(test).flush();
> return true;
> }
> 
> }
> 
> 
> Jonathan Barker wrote:
> > Post your query and load code.
> >
> >
> >> -Original Message-
> >> From: Chris Lewis [mailto:[EMAIL PROTECTED]
> >> Sent: Thursday, July 24, 2008 13:16
> >> To: Tapestry users
> >> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
> >> Session
> >>
> >> It can't be a data issue. The records are persisted via hibernate and
> >> work consistently as expected in pages. Like I said, I query the same
> >> table to which the abstract class is mapped in my index page with no
> >> problem at all. I also said that it works in the dispatcher for the
> >> first entity I query, but any subsequent query to a _different_ entity
> >> throws that exception. The query is also just a read (select). Any
> other
> >> ideas?
> >>
> >> thanks
> >>
> >> Yunhua Sang wrote:
> >>
> >>> It sounds more like a data issue, check your data in database
> carefully.
> >>>
> >>> Yunhua
> >>>
> >>> On Wed, Jul 23, 2008 at 11:18 PM, Chris Lewis
> >>>
> >> <[EMAIL PROTECTED]> wrote:
> >>
>  Hello,
> 
>  I have a dispatcher that uses a hibernate session. The dispatcher is
>  auto bound and receives the session in the constructor. I'm using
>  tapestry-hibernate so that session instance is a proxy that gets the
>  real session for the current thread (right?). Now in testing my
>  dispatcher, I give it a url like:
> 
>  /MyContext/?limg=2
> 
>  The dispatcher looks for "limg" and if found, queries the session
>  assuming that its value is the PK of a mapped entity. When I trigger
> 
> >> the
> >>
>  dispatcher for the first time it works fine. If I refresh the page,
>  fine. If I change the value to something else, say 3, then it breaks
>  with a org.hibernate.InstantiationException:
> 
>  Cannot instantiate abstract class or interface:
> 
> >> com.mypackage.data.Listing
> >>
>  If I change the value back to 2, the same thing happens! "Listing" is
> 
> >> an
> >>
>  abstract class mapped as a super class entity via:
> 
>  @Entity
>  @Inheritance(strategy = InheritanceType.JOINED)
> 
>  Any clue what's going on here? Two things are perplexing me:
> 
>  1) Querying mapped super classes is legal, and I in fact the same
> thing
>  on my Index page with no problem.
>  2) The query works the first time, but as soon as the id changes it
> is
>  forever broken until I restart the container.
> 
>  Thanks in advance!
> 
>  chris
> 
>  --
>  http://thegodcode.net
> 
> 
>  -
>  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]
> >>>
> >>>
> >>>
> >>>
> >> --
> >> http://thegodcode.net
> >>
> >
> >
> >
>

[T4] Using differ validator on async form?

2008-07-24 Thread Kalle Korhonen
Is it possible to use Differ validator to validate a field shouldn't match a
known value? Match/Differ expects to match against a form component; just
any component won't do. In my case the value the value to differ against
cannot change (think use case where a password cannot match with a
username). So I just tried making the username a hidden field, then pointing
the differ to that component, but client side validation doesn't work in
that case, and the validation is only enforced on the server side (I guess
because Hidden doesn't support client-side validation?). If the component to
differ against is a normal text field, the client validation works ok, but I
don't want a user to be able to change the field to differ against. I
suppose I could hide this field from the user or do some other hack to make
it work, but is there a clean way to implement it?

Kalle


Re: void onActivate(String ,String)

2008-07-24 Thread Josh Canfield
show us the urls generated for your page and the urls generated for the
images.

On Thu, Jul 24, 2008 at 11:51 AM, tapestry5 <[EMAIL PROTECTED]> wrote:

>
> I tried changing path but it still gives me same values
>
>
> joshcanfield wrote:
> >
> > Look at the html that your page is generating. Your image/js paths are
> > probably relative to the page.
> >
> > You probably have:
> >  images/myimage.jpg
> > you want
>  >  /images/myimage.jpg
> > Josh
> > On Thu, Jul 24, 2008 at 9:13 AM, tapestry5 <[EMAIL PROTECTED]>
> wrote:
> >
> >>
> >> When ever i use onActivate in my tapestry page i see that it is called
> >> multiple times.
> >>
> >> I am using onActivate(String ,String).
> >>
> >> In first instance it will take the right value and in the second
> instance
> >> it
> >> will replace the last value with my resource folder names.
> >>
> >> eg: 1st time when OnActivation(String _val1, String _val2) is called the
> >> value was test1/test2
> >> 2nd time when OnActivation(String _val1, String _val2) is called the
> >> value
> >> was test1/images
> >> 3rd time when OnActivation(String _val1, String _val2) is called the
> >> value
> >> was test1/js
> >>
> >> I am not sure why this is happening.
> >>
> >> Is it that i am calling a wrong method?
> >> Any help??
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18635295.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]
> >>
> >>
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18638141.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]
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.


Re: void onActivate(String ,String)

2008-07-24 Thread tapestry5

I tried changing path but it still gives me same values


joshcanfield wrote:
> 
> Look at the html that your page is generating. Your image/js paths are
> probably relative to the page.
> 
> You probably have:
>  images/myimage.jpg 
> you want
>  /images/myimage.jpg 
> Josh
> On Thu, Jul 24, 2008 at 9:13 AM, tapestry5 <[EMAIL PROTECTED]> wrote:
> 
>>
>> When ever i use onActivate in my tapestry page i see that it is called
>> multiple times.
>>
>> I am using onActivate(String ,String).
>>
>> In first instance it will take the right value and in the second instance
>> it
>> will replace the last value with my resource folder names.
>>
>> eg: 1st time when OnActivation(String _val1, String _val2) is called the
>> value was test1/test2
>> 2nd time when OnActivation(String _val1, String _val2) is called the
>> value
>> was test1/images
>> 3rd time when OnActivation(String _val1, String _val2) is called the
>> value
>> was test1/js
>>
>> I am not sure why this is happening.
>>
>> Is it that i am calling a wrong method?
>> Any help??
>> --
>> View this message in context:
>> http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18635295.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]
>>
>>
> 
> 
> -- 
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18638141.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: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Chris Lewis
Hi Jonathan,

Here is my dispatcher. As you can see it's in a very early stage so it's
both small and messy. The query is being done via:
session.load(Listing.class, Long.parseLong(sListingId));

It was being done via createQuery and uniqueResult, with the same results.

public class BinaryFileDispatcher implements Dispatcher {
   
private Session session;
   
public BinaryFileDispatcher(Session session) {
this.session = session;
}
   
public boolean dispatch(Request request, Response response)
throws IOException {
   
String sListingId = request.getParameter("limg");
if(sListingId== null)
return false;
   
System.out.println("BinaryFileDispatcher.dispatch() -- "
+ sListingId);
Listing listing = (Listing)session.load(Listing.class,
Long.parseLong(sListingId));
   
response.setHeader("Content-Type", "text/html");
   
String test = "" + listing.getTitle() +
"";
response.setContentLength(test.length());
response.getPrintWriter("text/html").append(test).flush();
return true;
}

}


Jonathan Barker wrote:
> Post your query and load code.
>
>   
>> -Original Message-
>> From: Chris Lewis [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, July 24, 2008 13:16
>> To: Tapestry users
>> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
>> Session
>>
>> It can't be a data issue. The records are persisted via hibernate and
>> work consistently as expected in pages. Like I said, I query the same
>> table to which the abstract class is mapped in my index page with no
>> problem at all. I also said that it works in the dispatcher for the
>> first entity I query, but any subsequent query to a _different_ entity
>> throws that exception. The query is also just a read (select). Any other
>> ideas?
>>
>> thanks
>>
>> Yunhua Sang wrote:
>> 
>>> It sounds more like a data issue, check your data in database carefully.
>>>
>>> Yunhua
>>>
>>> On Wed, Jul 23, 2008 at 11:18 PM, Chris Lewis
>>>   
>> <[EMAIL PROTECTED]> wrote:
>> 
 Hello,

 I have a dispatcher that uses a hibernate session. The dispatcher is
 auto bound and receives the session in the constructor. I'm using
 tapestry-hibernate so that session instance is a proxy that gets the
 real session for the current thread (right?). Now in testing my
 dispatcher, I give it a url like:

 /MyContext/?limg=2

 The dispatcher looks for "limg" and if found, queries the session
 assuming that its value is the PK of a mapped entity. When I trigger
 
>> the
>> 
 dispatcher for the first time it works fine. If I refresh the page,
 fine. If I change the value to something else, say 3, then it breaks
 with a org.hibernate.InstantiationException:

 Cannot instantiate abstract class or interface:
 
>> com.mypackage.data.Listing
>> 
 If I change the value back to 2, the same thing happens! "Listing" is
 
>> an
>> 
 abstract class mapped as a super class entity via:

 @Entity
 @Inheritance(strategy = InheritanceType.JOINED)

 Any clue what's going on here? Two things are perplexing me:

 1) Querying mapped super classes is legal, and I in fact the same thing
 on my Index page with no problem.
 2) The query works the first time, but as soon as the id changes it is
 forever broken until I restart the container.

 Thanks in advance!

 chris

 --
 http://thegodcode.net


 -
 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]
>>>
>>>
>>>
>>>   
>> --
>> http://thegodcode.net
>> 
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>   

-- 
http://thegodcode.net



Re: void onActivate(String ,String)

2008-07-24 Thread Josh Canfield
Look at the html that your page is generating. Your image/js paths are
probably relative to the page.

You probably have:

you want

Josh
On Thu, Jul 24, 2008 at 9:13 AM, tapestry5 <[EMAIL PROTECTED]> wrote:

>
> When ever i use onActivate in my tapestry page i see that it is called
> multiple times.
>
> I am using onActivate(String ,String).
>
> In first instance it will take the right value and in the second instance
> it
> will replace the last value with my resource folder names.
>
> eg: 1st time when OnActivation(String _val1, String _val2) is called the
> value was test1/test2
> 2nd time when OnActivation(String _val1, String _val2) is called the value
> was test1/images
> 3rd time when OnActivation(String _val1, String _val2) is called the value
> was test1/js
>
> I am not sure why this is happening.
>
> Is it that i am calling a wrong method?
> Any help??
> --
> View this message in context:
> http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18635295.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]
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.


EagerLoad service doesn't use PerThread service correctly

2008-07-24 Thread Franz Amador

I have an EagerLoad service that uses a PerThread service.  I expected the
EagerLoad service to hold a reference to a proxy to the PerThread service so
that the actual instance of the PerThread service that is used depends upon
the thread calling the EagerLoad service.  Instead, the EagerLoad service is
getting a reference to an actual instance of the PerThread service, not to a
proxy, so the same instance of the PerThread service is getting used by all
threads that call the EagerLoad service.  This surely can't be right. 
Here's a very simplified example:

public class AppModule {
public static void bind(ServiceBinder binder) {
binder.bind(EagerLoadService.class);
binder.bind(PerThreadService.class);
}
}

@EagerLoad
public class EagerLoadService {
public EagerLoadService(PerThreadService perThreadService) {
// prints "class PerThreadService", not a proxy class!
System.out.println(perThreadService.getClass());
}
}

@Scope(PERTHREAD_SCOPE)
public class PerThreadService {
}

Is this a bug?  Am I confused about how this should work?  All help
appreciated.

-- 
View this message in context: 
http://www.nabble.com/EagerLoad-service-doesn%27t-use-PerThread-service-correctly-tp18637337p18637337.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: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Jonathan Barker
Post your query and load code.

> -Original Message-
> From: Chris Lewis [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 24, 2008 13:16
> To: Tapestry users
> Subject: Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a
> Session
> 
> It can't be a data issue. The records are persisted via hibernate and
> work consistently as expected in pages. Like I said, I query the same
> table to which the abstract class is mapped in my index page with no
> problem at all. I also said that it works in the dispatcher for the
> first entity I query, but any subsequent query to a _different_ entity
> throws that exception. The query is also just a read (select). Any other
> ideas?
> 
> thanks
> 
> Yunhua Sang wrote:
> > It sounds more like a data issue, check your data in database carefully.
> >
> > Yunhua
> >
> > On Wed, Jul 23, 2008 at 11:18 PM, Chris Lewis
> <[EMAIL PROTECTED]> wrote:
> >
> >> Hello,
> >>
> >> I have a dispatcher that uses a hibernate session. The dispatcher is
> >> auto bound and receives the session in the constructor. I'm using
> >> tapestry-hibernate so that session instance is a proxy that gets the
> >> real session for the current thread (right?). Now in testing my
> >> dispatcher, I give it a url like:
> >>
> >> /MyContext/?limg=2
> >>
> >> The dispatcher looks for "limg" and if found, queries the session
> >> assuming that its value is the PK of a mapped entity. When I trigger
> the
> >> dispatcher for the first time it works fine. If I refresh the page,
> >> fine. If I change the value to something else, say 3, then it breaks
> >> with a org.hibernate.InstantiationException:
> >>
> >> Cannot instantiate abstract class or interface:
> com.mypackage.data.Listing
> >>
> >> If I change the value back to 2, the same thing happens! "Listing" is
> an
> >> abstract class mapped as a super class entity via:
> >>
> >> @Entity
> >> @Inheritance(strategy = InheritanceType.JOINED)
> >>
> >> Any clue what's going on here? Two things are perplexing me:
> >>
> >> 1) Querying mapped super classes is legal, and I in fact the same thing
> >> on my Index page with no problem.
> >> 2) The query works the first time, but as soon as the id changes it is
> >> forever broken until I restart the container.
> >>
> >> Thanks in advance!
> >>
> >> chris
> >>
> >> --
> >> http://thegodcode.net
> >>
> >>
> >> -
> >> 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]
> >
> >
> >
> 
> --
> http://thegodcode.net



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



Re: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Chris Lewis
It can't be a data issue. The records are persisted via hibernate and
work consistently as expected in pages. Like I said, I query the same
table to which the abstract class is mapped in my index page with no
problem at all. I also said that it works in the dispatcher for the
first entity I query, but any subsequent query to a _different_ entity
throws that exception. The query is also just a read (select). Any other
ideas?

thanks

Yunhua Sang wrote:
> It sounds more like a data issue, check your data in database carefully.
>
> Yunhua
>
> On Wed, Jul 23, 2008 at 11:18 PM, Chris Lewis <[EMAIL PROTECTED]> wrote:
>   
>> Hello,
>>
>> I have a dispatcher that uses a hibernate session. The dispatcher is
>> auto bound and receives the session in the constructor. I'm using
>> tapestry-hibernate so that session instance is a proxy that gets the
>> real session for the current thread (right?). Now in testing my
>> dispatcher, I give it a url like:
>>
>> /MyContext/?limg=2
>>
>> The dispatcher looks for "limg" and if found, queries the session
>> assuming that its value is the PK of a mapped entity. When I trigger the
>> dispatcher for the first time it works fine. If I refresh the page,
>> fine. If I change the value to something else, say 3, then it breaks
>> with a org.hibernate.InstantiationException:
>>
>> Cannot instantiate abstract class or interface: com.mypackage.data.Listing
>>
>> If I change the value back to 2, the same thing happens! "Listing" is an
>> abstract class mapped as a super class entity via:
>>
>> @Entity
>> @Inheritance(strategy = InheritanceType.JOINED)
>>
>> Any clue what's going on here? Two things are perplexing me:
>>
>> 1) Querying mapped super classes is legal, and I in fact the same thing
>> on my Index page with no problem.
>> 2) The query works the first time, but as soon as the id changes it is
>> forever broken until I restart the container.
>>
>> Thanks in advance!
>>
>> chris
>>
>> --
>> http://thegodcode.net
>>
>>
>> -
>> 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]
>
>
>   

-- 
http://thegodcode.net



Re: void onActivate(String ,String)

2008-07-24 Thread Marcus
Hi,

Seach on this list for:
t5 "redirect after post"

Tapestry uses redirect-after-post design.
http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost

Marcus


Re: T5: to t:page or not to t:page?

2008-07-24 Thread Robert Zeigler

t: is absolutely critical only for two things: id, and type.

t:id or t:type clearly identify a particular tag as a reference to a  
component, either an explicit one (t:id) or implicit (t:type).   
Without one of those two things (or both), having, eg, t:page="Index"  
is meaningless.


Beyond those two attributes, nothing has to be prefixed with t:, and  
is a matter of personal preference.  Personally, I try to move as much  
as I can out of the template, although I frequently leave informal,  
html-attribute parameters in the template.


Robert

On Jul 21, 2008, at 7/219:01 AM , Thiago H. de Paula Figueiredo wrote:


Em Mon, 21 Jul 2008 06:00:33 -0300, <[EMAIL PROTECTED]> escreveu:

Can someone please explain why "t:" is required for parameters and,  
if that is the case, why is it missing in examples in the Tutorial?


AFAIK, t: exists to clearly differentiate what is a component  
parameter from what is an HTML attribute. It does more difference  
when using invisible instrumentation:


Index page

page is a PageLink parameter, so I always put t: on it. On the other  
hand, class is not a PageLink parameter, it is an attribute of the a  
tag, so it never gets a t: prefix.


Thiago

-
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 [t5]: testing for null number

2008-07-24 Thread Padawn

General test construct:
.java
public boolean myTest() {
  return (thingie != null);
}

.tml

   


or

   




photos-4 wrote:
> 
>> I notice that t:if coerces number objects (Long, Integer, etc) and  
>> tests for zero or non-zero.  I want to test for null or not null using a
>> number data  
> type. Is there any way to do this?
> 

-- 
View this message in context: 
http://www.nabble.com/re--t5-%3A-testing-for-null-number-tp18633966p18635951.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: T5.0.14-SNAPSHOT: strange behavior Dispatcher when using a Session

2008-07-24 Thread Yunhua Sang
It sounds more like a data issue, check your data in database carefully.

Yunhua

On Wed, Jul 23, 2008 at 11:18 PM, Chris Lewis <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have a dispatcher that uses a hibernate session. The dispatcher is
> auto bound and receives the session in the constructor. I'm using
> tapestry-hibernate so that session instance is a proxy that gets the
> real session for the current thread (right?). Now in testing my
> dispatcher, I give it a url like:
>
> /MyContext/?limg=2
>
> The dispatcher looks for "limg" and if found, queries the session
> assuming that its value is the PK of a mapped entity. When I trigger the
> dispatcher for the first time it works fine. If I refresh the page,
> fine. If I change the value to something else, say 3, then it breaks
> with a org.hibernate.InstantiationException:
>
> Cannot instantiate abstract class or interface: com.mypackage.data.Listing
>
> If I change the value back to 2, the same thing happens! "Listing" is an
> abstract class mapped as a super class entity via:
>
> @Entity
> @Inheritance(strategy = InheritanceType.JOINED)
>
> Any clue what's going on here? Two things are perplexing me:
>
> 1) Querying mapped super classes is legal, and I in fact the same thing
> on my Index page with no problem.
> 2) The query works the first time, but as soon as the id changes it is
> forever broken until I restart the container.
>
> Thanks in advance!
>
> chris
>
> --
> http://thegodcode.net
>
>
> -
> 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]



[T5] OT - There is a Jetty app manager?

2008-07-24 Thread Marcus
Hi,

Sorry about the off topic question...

Tomcat have your own app manager, and lambda probe is another option.
Is anyone out there using such tool with Jetty?

Thanks,

Marcus


Re: Converting type of request parameter error

2008-07-24 Thread Josh Canfield
I'm guessing that you don't want Integer.toInteger(), cause if you read the
javadoc(
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Integer.html#getInteger(java.lang.String)
you'll see that it's pulling a property from System.property with the
passed name. If the property doesn't exist it returns null, thus giving you
a null pointer.

You probably want parsetInt
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Integer.html#parseInt(java.lang.String
)

Josh

On Wed, Jul 23, 2008 at 8:43 PM, luna_guo <[EMAIL PROTECTED]> wrote:

>
> tapestry5.0.13
> @Inject
> private org.apache.tapestry5.services.Request request;
>
> String param=request.getParameter(PARAM_NAME);
> int id=coercer.coerce(param,Integer.class);
> log.debug(PARAM_NAME+" is "+param);  //it's ok, display a number.
> int id=Integer.getInteger(param.toString());  //The error message come from
> this link.because when i just set a number to id,it will goes well.
>
> the variable param is actually java.lang.String,right?So where is the error
> come from?
> Thanks a lot.it drives me nuts.
>
>
> the following is the debug message:
>
> [DEBUG] 24:40(ConstructorServiceCreator.java:createObject:50)
> Invoking constructor
> org.apache.tapestry5.internal.services.InternalRequestGlobalsImpl() (at
> InternalRequestGlobalsImpl.java:22).
>
> [ERROR]
> 24:40(DefaultRequestExceptionHandler.java:handleRequestException:45)
> Processing of request failed with uncaught exception:
> org.apache.tapestry5.runtime.ComponentEventException
>
> org.apache.tapestry5.runtime.ComponentEventException [at
> context:AbstractMessage.tml, line 47, column 97]
>at
>
> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1042)
>at
>
> org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler.handle(AjaxComponentEventRequestHandler.java:92)
>at
>
> $ComponentEventRequestHandler_11b530aa91a.handle($ComponentEventRequestHandler_11b530aa91a.java)
>at
>
> org.apache.tapestry5.internal.services.AjaxFilter.handle(AjaxFilter.java:42)
>at
>
> $ComponentEventRequestHandler_11b530aa91b.handle($ComponentEventRequestHandler_11b530aa91b.java)
>at
>
> org.apache.tapestry5.services.TapestryModule$37.handle(TapestryModule.java:1987)
>at
>
> $ComponentEventRequestHandler_11b530aa91b.handle($ComponentEventRequestHandler_11b530aa91b.java)
>at
>
> $ComponentEventRequestHandler_11b530aa884.handle($ComponentEventRequestHandler_11b530aa884.java)
>at
>
> org.apache.tapestry5.internal.services.ComponentEventDispatcher.dispatch(ComponentEventDispatcher.java:135)
>at $Dispatcher_11b530aa887.dispatch($Dispatcher_11b530aa887.java)
>at $Dispatcher_11b530aa879.dispatch($Dispatcher_11b530aa879.java)
>at
>
> org.apache.tapestry5.services.TapestryModule$12.service(TapestryModule.java:938)
>at cn.mcguo.banjia.services.AppModule$1.service(AppModule.java:23)
>at
> $RequestFilter_11b530aa878.service($RequestFilter_11b530aa878.java)
>at
> $RequestHandler_11b530aa87a.service($RequestHandler_11b530aa87a.java)
>at
>
> org.apache.tapestry5.internal.services.LocalizationFilter.service(LocalizationFilter.java:42)
>at
> $RequestHandler_11b530aa87a.service($RequestHandler_11b530aa87a.java)
>at
>
> org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:586)
>at
> $RequestHandler_11b530aa87a.service($RequestHandler_11b530aa87a.java)
>at
>
> org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
>at
> $RequestHandler_11b530aa87a.service($RequestHandler_11b530aa87a.java)
>at
>
> org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:79)
>at
> $RequestHandler_11b530aa87a.service($RequestHandler_11b530aa87a.java)
>at
>
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:93)
>at
>
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:84)
>at
>
> org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:75)
>at
>
> org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:106)
>at
> $RequestHandler_11b530aa87a.service($RequestHandler_11b530aa87a.java)
>at
> $RequestHandler_11b530aa871.service($RequestHandler_11b530aa871.java)
>at
>
> org.apache.tapestry5.services.TapestryModule$11.service(TapestryModule.java:918)
>at
>
> org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
>at
>
> $HttpServletRequestFilter_11b530aa870.service($HttpServletRequestFilter_11b530aa870.java)
>at
>
> $HttpServletRequestHandler_11b530aa872.service($HttpServletRequestHandler_11b530aa872.java)
>at
>
> $HttpServletRequestHandler_11b530

void onActivate(String ,String)

2008-07-24 Thread tapestry5

When ever i use onActivate in my tapestry page i see that it is called
multiple times.  

I am using onActivate(String ,String).

In first instance it will take the right value and in the second instance it
will replace the last value with my resource folder names.

eg: 1st time when OnActivation(String _val1, String _val2) is called the
value was test1/test2
2nd time when OnActivation(String _val1, String _val2) is called the value
was test1/images
3rd time when OnActivation(String _val1, String _val2) is called the value
was test1/js

I am not sure why this is happening.

Is it that i am calling a wrong method?
Any help??
-- 
View this message in context: 
http://www.nabble.com/void-onActivate%28String-%2CString%29-tp18635295p18635295.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: re [t5]: testing for null number

2008-07-24 Thread Marcelo Lotif
There are many threads regarding your question around the list, like this one

http://www.nabble.com/T5-if-component-tc17667375.html


On Thu, Jul 24, 2008 at 12:11 PM,  <[EMAIL PROTECTED]> wrote:
> Can someone knowledgable please comment on my query from yesterday?
>
>
>> I notice that t:if coerces number objects (Long, Integer, etc) and tests
>> for zero or
>
> non-zero.  I want to test for null or not null using a number data type. Is
> there any way
> to do this?
>
>
> Thanks,
> p.
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Atenciosamente,

Marcelo Lotif
Programador Java e Tapestry
FIEC - Federação das Indústrias do Estado do Ceará
(85) 3477-5910

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



BeanInfo FAIL onLoad

2008-07-24 Thread Udo Abel
Hi,

since I've renamed my application package I get error messages for all BeanInfo 
classes, e.g.:
FAIL onLoad org.apache.tapestry5.corelib.components.FormBeanInfo
I've recompiled all sources and cannot see where there should be a problem. Its 
the same with both, jetty 6.1.11 and tomcat 5.5.26.
Tapestry 5.0.13

Does anyone has any idea why all BeanInfo classes could be gone?

Thanks.
Udo.
-- 
Pt! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

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



Re: [T5]: Hibernate question

2008-07-24 Thread Andreas Andreou
Perhaps hibernate.cfg.xml isn't in your runtime classpath?
Are you sure your IDE includes it to the output?

On Thu, Jul 24, 2008 at 6:09 PM,  <[EMAIL PROTECTED]> wrote:
> I am following the tutorial at
>
> http://tapestry.apache.org/tapestry5/tutorial1/forms2.html
>
> but I find that the session (supposedly injected) is null. I'm not sure how
> to proceed.
>
> Could someone point me to documents/better tutorials on how to use Tapestry
> with Hibernate?
>
> Thanks,
> p.
>
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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



[T5]: Hibernate question

2008-07-24 Thread photos

I am following the tutorial at

http://tapestry.apache.org/tapestry5/tutorial1/forms2.html

but I find that the session (supposedly injected) is null. I'm not  
sure how to proceed.


Could someone point me to documents/better tutorials on how to use  
Tapestry with Hibernate?


Thanks,
p.




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



re [t5]: testing for null number

2008-07-24 Thread photos

Can someone knowledgable please comment on my query from yesterday?


I notice that t:if coerces number objects (Long, Integer, etc) and  
tests for zero or
non-zero.  I want to test for null or not null using a number data  
type. Is there any way

to do this?


Thanks,
p.




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



Re: Converting type of request parameter error

2008-07-24 Thread luna_guo

that line is this:
int id=Integer.getInteger(param.toString());  
i just convert a string to a integer ,why does it throw exception?
does the inject service request's getParameter method return a actual
String?

Thiago H. de Paula Figueiredo wrote:
> 
> Here:
> 
> Caused by: java.lang.NullPointerException
>   at cn.mcguo.banjia.components.Star.onSwitch(Star.java:61)
> 
> Thiago
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Converting-type-of-request-parameter-error-tp18624966p18630559.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: Converting type of request parameter error

2008-07-24 Thread Thiago H. de Paula Figueiredo

Here:

Caused by: java.lang.NullPointerException
at cn.mcguo.banjia.components.Star.onSwitch(Star.java:61)

Thiago

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



Re: Sending a StreamResponse on a request with parameters

2008-07-24 Thread José Paumard

Hello Marcello,

Thank you for your answer, unfortunately, the calling URL is fixed, I 
cant fiddle with it. It's a good'ol URL, that looks like that :

http://www.mydomain.com/myapp/getimage?scale=2.3

Marcelo Lotif a écrit :

Hi José,
Try to change your method signature to this:

public InputStream onActionFromStream(String myparam) throws IOException {
...
}

and then, on your url, you can call it like this:

http://localhost:8080/appname/getstring.stream/paramValue

I hope this helps you.

On Thu, Jul 24, 2008 at 7:00 AM, José Paumard <[EMAIL PROTECTED]> wrote:
  

Hello all,

I need to send a StreamResponse (namely XML, JPEG or PDF) on a particular
request with parameters.

I currently use the following solution : making a page with the right name,
getting request parameters in the classical way, through
requet.getParameter("p"),and sending the StreamResponse with the onActivate
method.

I was wondering if there is a way to get the parameters automaticaly set
using the @Parameter annotation ? Of course, when onActivate is called,
those have not been set by T5.

Thank you,

José

Here is the (simplified) code of my page :

public class GetString {

  @Inject
  private HttpServletRequest request;
public StreamResponse onActivate() {
  return new StreamResponse() {

  public String getContentType() {
  return "text/plain" ;
  }

  public InputStream getStream() throws IOException {
  String s = "My param = " + request.getParameter("myparam") ;
  ByteArrayInputStream bis = new
ByteArrayInputStream(s.getBytes()) ;
  return bis ;
  }

  public void prepareResponse(Response response) {
  }
  } ;
  }
}


-
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: Sending a StreamResponse on a request with parameters

2008-07-24 Thread Marcelo Lotif
Hi José,
Try to change your method signature to this:

public InputStream onActionFromStream(String myparam) throws IOException {
...
}

and then, on your url, you can call it like this:

http://localhost:8080/appname/getstring.stream/paramValue

I hope this helps you.

On Thu, Jul 24, 2008 at 7:00 AM, José Paumard <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I need to send a StreamResponse (namely XML, JPEG or PDF) on a particular
> request with parameters.
>
> I currently use the following solution : making a page with the right name,
> getting request parameters in the classical way, through
> requet.getParameter("p"),and sending the StreamResponse with the onActivate
> method.
>
> I was wondering if there is a way to get the parameters automaticaly set
> using the @Parameter annotation ? Of course, when onActivate is called,
> those have not been set by T5.
>
> Thank you,
>
> José
>
> Here is the (simplified) code of my page :
>
> public class GetString {
>
>   @Inject
>   private HttpServletRequest request;
> public StreamResponse onActivate() {
>   return new StreamResponse() {
>
>   public String getContentType() {
>   return "text/plain" ;
>   }
>
>   public InputStream getStream() throws IOException {
>   String s = "My param = " + request.getParameter("myparam") ;
>   ByteArrayInputStream bis = new
> ByteArrayInputStream(s.getBytes()) ;
>   return bis ;
>   }
>
>   public void prepareResponse(Response response) {
>   }
>   } ;
>   }
> }
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- 
Atenciosamente,

Marcelo Lotif
Programador Java e Tapestry
FIEC - Federação das Indústrias do Estado do Ceará
(85) 3477-5910

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



T5: Assets outside of the WebApp

2008-07-24 Thread Russell Brown
Hi,
I'm wondering if I can inject assets or better yet IncludeJavaScriptLibrary 
from outside the web app? For instance if I want to include the YUI libraries 
direct from Yahoo! rather than download and bundle them with my web app?

@IncludeJavaScriptLibrary( { 
"http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js";,
"http://yui.yahooapis.com/2.5.2/build/event/event-min.js"; })

leads to:

Render queue error in SetupRender[AjaxIncluder]: Unknown prefix for asset path 
'http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js'.

is there a prefix to say external: rather than context: of classpath: ?

Cheers

Russell


Communications on or through ioko's computer systems may be monitored or 
recorded to secure effective system operation and for other lawful purposes.

Unless otherwise agreed expressly in writing, this communication is to be 
treated as confidential and the information in it may not be used or disclosed 
except for the purpose for which it has been sent. If you have reason to 
believe that you are not the intended recipient of this communication, please 
contact the sender immediately. No employee is authorised to conclude any 
binding agreement on behalf of ioko with another party by e-mail without prior 
express written confirmation.

ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.

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



Table model values are not updated properly

2008-07-24 Thread Kameswari

As i understand, the getTableModel() function initializes table model when no
model exists in the persistent store table model. 

If some changes are made to the table model, the changed values are not
reflected in the table model. 
Tapestry uses a state save/restore mechanism to keep from having to
serialize the entire table to the session. But this doesnot seem to work
properly.

When the getTableModel() is called again, the values are not updated. Is my
understanding correct?
-- 
View this message in context: 
http://www.nabble.com/Table-model-values-are-not-updated-properly-tp18629344p18629344.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]



component rendering - how can I get the markup/output?

2008-07-24 Thread Sam Eldred
Hi All

Just wondered if anyone knows of a nice/easy way to get the rendered output
of a component after it has completed its rendering lifecycle, ie. reached
the CleanupRender phase?  I've tried two approaches so far:

> The first was to use a MarkupWriterListener to capture any content added
to the MarkupWriter.  Unfortunately this doesn't work if the added content
doesn't fire the elementDidStart/elementDidEnd methods, eg. if content is
added via write/writeRaw.

> The second was to examine the content in the MarkupWriter before and after
the component has rendered and deduce the rendered output from that.  This
does work, but the code is pretty hairy and it seems like a bit of a hack!

Anyone know of a better way to do this?  Thanks

Sam


Sending a StreamResponse on a request with parameters

2008-07-24 Thread José Paumard

Hello all,

I need to send a StreamResponse (namely XML, JPEG or PDF) on a 
particular request with parameters.


I currently use the following solution : making a page with the right 
name, getting request parameters in the classical way, through 
requet.getParameter("p"),and sending the StreamResponse with the 
onActivate method.


I was wondering if there is a way to get the parameters automaticaly set 
using the @Parameter annotation ? Of course, when onActivate is called, 
those have not been set by T5.


Thank you,

José

Here is the (simplified) code of my page :

public class GetString {

   @Inject
   private HttpServletRequest request;
  
   public StreamResponse onActivate() {

   return new StreamResponse() {

   public String getContentType() {
   return "text/plain" ;
   }

   public InputStream getStream() throws IOException {
   String s = "My param = " + request.getParameter("myparam") ;
   ByteArrayInputStream bis = new 
ByteArrayInputStream(s.getBytes()) ;

   return bis ;
   }

   public void prepareResponse(Response response) {
   }
   } ;
   }
}


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



t5: commit before calling service if parent-child referential integrity exists?

2008-07-24 Thread Angelo Chen

Hi,

I have two entity classes listed at end of this post, they have referential
integrity in the table level. in a page's onActivate a new Usr is created,
then it is passed to a service where a MsgSubject is created and its usr is
set to the instance of Usr created in the page, but this will always trigger
a referential constraint violation that Usr does not exist in the table:

simplified code:

@Inject private MyService myService;

// code #1
@CommitAfter
public Class onActivate(String id) {

Usr usr = new Usr();
session.save(usr);
myService.addMsgSubj(usr);  // new usr does not exist in 
the table
exception

}

To solve the above problem, I remove the c3p0 pooling from hibernate
configuration, it works, that means the code is ok, it's just this hibernate
pooling that make the newly added usr not visible to the others even they
are in the same transaction.

putting back the c3p0 pooling and added a commit solve the problem:

// code #2
@CommitAfter
public Class onActivate(String id) {

Usr usr = new Usr();
session.save(usr);
sessionManager.commit();// this make the 
myService.addMsgSubj(usr);  

}

is it a must to commit so that objects are visible to services even they
are in the same transaction? any idea?

Thanks
p.s. actually code #1 works if I did not do a commit in a dispatcher:
public boolean dispatch(Request request, Response response) throws
IOException {
  PageLog log = new PageLog();
  sessionManager.getSession().save(log);
  sessionManager.commit();
  return false;
  }


public class Usr  {

private Long id;
private List messageTopics = new ArrayList();
@Id @GeneratedValue
public Long getId() {
return id;
}

@OneToMany(mappedBy="usr")
@OrderBy("date_last desc") 
public List getMessageTopics() {
return messageTopics;
}

public void setMessageTopics(List messageTopics) {
this.messageTopics = messageTopics;
}
}


public class MsgSubject {

private Long id;
private Usr usr;

@Id
@GeneratedValue
public Long getId() {
return id;
}

private void setId(Long id) {
this.id = id;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="usr_id")
public Usr getUsr() {
return usr;
}

public void setUsr(Usr usr) {
this.usr = usr;
}

}


-- 
View this message in context: 
http://www.nabble.com/t5%3A-commit-before-calling-service-if-parent-child-referential-integrity-exists--tp18628394p18628394.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]