RE: [T5] Using Autocomplete.configure to specify an afterUpdateElement function
There is indeed... Looks like the fix version is 5.0 though, which is some strange holding place where defects seem to disappear to: https://issues.apache.org/jira/browse/TAPESTRY-2234 -Original Message- From: Andreas Andreou [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2008 8:58 AM To: Tapestry users Subject: Re: [T5] Using Autocomplete.configure to specify an afterUpdateElement function i think there's already a jira for this On 7/9/08, Patrick Moriarty [EMAIL PROTECTED] wrote: Hi, Although I can subclass Autocomplete and implement the configure(JSONObject) method to specify an afterUpdateElement, the fuction I specify (as a String here) gets surrounded by double-quotes by JSONObject.toString() Thus it is not interpreted as a function. It would be nice if I could use some object, JavascriptFunction for example, which would not be quoted by toString(). protected void configure(JSONObject config) { config.put(afterUpdateElement, function (element, selectedElement) {element.blur();}); } results in the following script: new Ajax.Autocompleter(xxx, xxx:menu', '/xxx/xxx:autocomplete', {indicator:xxx:loader,afterUpdateElement:function (element, selectedElement) {element.blur();},paramName:t:input}); Should I create a JIRA issue for this? Regards, Paudi -- 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Instability in Tapestry 5.0.12-SNAPSHOT
I'm with Markus. Personally, I'm kind of shocked this is even under consideration. Versioning your package structure is a band-aid to the real problem, which is people not being able to control their class-loaders. If you deploy your Tapestry 4 app in one WAR and your Tapestry 5 app in another WAR then this should not be an issue. Per the portability section of the JavaEE spec, the classloaders of WARs should be entirely independent. In my mind, the only people this applies to are people who have deviated from the JavaEE spec, and I don't really see why we should make exceptions for them. People commonly have several differing versions of Log4J and XML parsers within their application server, there's no reason to make an exception for Tapestry. -1 for org.tapestry.apache.v5.0.12 -Original Message- From: Markus Joschko [mailto:[EMAIL PROTECTED] Sent: Monday, May 19, 2008 5:20 PM To: Tapestry users Subject: Re: Instability in Tapestry 5.0.12-SNAPSHOT Looks like I am alone but I don't like the idea of putting version numbers into package names. In the highly unlikely case that there will be a tapestry 6 (not for technical but solely for marketing reasons ;-)) it might confuse developers. Are the classes in tapestry5 still valid or not? Only developers who will run tapestry4 and 5 in one webapplication might have the problem of distinguishing between the packages. I guess that they are the minority and it might be reasonable for them to read the class comments if they are in doubt which package belongs to which tapestry version. so -1 for a tapestry5 or v5. my 2cents, Markus On Mon, May 19, 2008 at 9:58 PM, Blower, Andy [EMAIL PROTECTED] wrote: I agree. -Original Message- From: Massimo Lusetti [mailto:[EMAIL PROTECTED] Sent: 19 May 2008 16:02 To: Tapestry users Subject: Re: Instability in Tapestry 5.0.12-SNAPSHOT On Mon, May 19, 2008 at 4:57 PM, Howard Lewis Ship [EMAIL PROTECTED] wrote: The question is: would it have been better to just broadly rename org.apache.tapestry to org.apache.tapestry5? There was quite a bit of discussion back on forth among the developers on this one. I would say yes. -- Massimo http://meridio.blogspot.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] - 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: Persistence pains
Howard, I totally get the two request pattern. A user shouldn't have to decide whether to re-submit their information. Great feature of the framework. So let's say that the request scope I'm referring to would be browser round-trip scope. As people on the forum have pointed out, combinations of the back button, refreshing, spawning new browser instances (which share session information) all can create chaos for any session-interacting web application. Just seems strange that seasoned web developers who use Tapestry are baking their own persistence mechanisms. Some are even making protocol-ish marker-based activation context constructs (/editdoohickeys/d1/keyval1/keyval2/d2/keyval1/keyval2). Sounds like what most of us are requesting is to at least permit the developer to not have to persist their components in the session (something like ServletRequest.setAttribute/getAttribute instead). Now that I've thoroughly beaten it, I'll just let the dead horse decompose for a while until it starts to smell (no Eight Belles reference intended). Joel -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Saturday, May 03, 2008 5:38 PM To: Tapestry users Subject: Re: T5: Persistence pains On Fri, May 2, 2008 at 6:36 PM, Joel Wiegman [EMAIL PROTECTED] wrote: Josh, Thanks for the great suggestions. I guess I'm still befuddled as to why a web framework would resist having a request scope so dilligently. It's not resistance, it's a different mindset, one that states that URLs should stand on their own in the browser and represent data to be presented to the user (i.e., render page requests) rather than behaviors to execute (the action requests). From what you describe, your activate event handler method should be able to load whatever additional data is needed and store it in simple component fields: that's your request scope. The fact that Tapestry links action requests to page requests is a separate issue. The goal is that if the user clicks the refresh button (the other annoying thing users do, besides hit the browser back button) that there won't be unexpected side-effects (such as, for instance, re-submitting an order, re-sending an email, etc., etc.). The flash scope appears to makes some intelligent guesses as to when you want your objects removed from the session, but the back-button-example I listed is one of quite a few reasons why making such guesses is a fools game. As we all know, HTTP is a request-response, stateless protocol, but Tapestry appears to be resisting storing state in one of the most basic constructs available in HTTP... the request. Anyone know why this is? Because we can store it inside ordinary fields instead? As you illustrated, I'm sure there are quite a few elaborate ways of dancing around the issue in any application (redundant checking, re-verification, passing clearThisValue flags around, etc.). None seem very elegant though (and would probably be associated with this is why I'm doing this comments). As for your activation context suggestions, those are some neat ideas. I hadn't considered your marking suggestion. I'm a little afraid to use it though. I can see a Tapestry pattern evolving from that that yields (String... stuff) as your parameter to your onActivate with a boatload of extravagant logic. Anyway, still haven't heard a useful suggestion to get objects into a request only scope. If anyone can think of something please post! It would be interesting to see what some of these values are that can only be set inside an action request but must then span into a render request. Thanks, Joel -Original Message- From: [EMAIL PROTECTED] on behalf of Josh Canfield Sent: Fri 5/2/2008 6:31 PM To: Tapestry users Subject: Re: T5: Persistence pains I generally consider flash persistence as a way to get an object from the action request to the render request... If you're going to set it in the render request you should consider adding code that validates that your data and context match up. You could, for instance, also flash persist your id and check it against the id from the context. If they don't match then null your other properties. While some may argue that this is just poor design, what if the fields I initialize varies by product? I'd get a merging of the two products on the screen depending on what was persisted first. Storing these things in your component smells funny... but I don't know your app. If someone is coming to the page for the first time you want an empty object, if they are posting an update to the form then Tapestry is going to populate the values. If you are navigating within the page using pagelinks, but it's a form then I'd consider posting the form instead... Josh On Fri, May 2, 2008 at 2:39 PM, Joel Wiegman [EMAIL PROTECTED] wrote: Sure Howard. Quite simply, the back button. When loading a page
T5: Persistence pains
All, Maybe I'm missing something here, maybe I'm not, but I'm attempting to preserve state JUST BETWEEN REQUESTS and I'm really struggling (I know in T5 there's really two requests, but for simplicity's sake let's just call the round trip from the browser a request). My options are: 1) @Persist(session) - Obviously doesn't work well for just persisting values between requests, unless someone has come up with a reliable construct for nulling out these values whenever someone leaves the page? 2) @Persist(flash) - This is really only useful for messages and other objects that are reliably referenced once. This is NOT request-scoped persistence. 3) @Persist(client) - While I thought initially thought that this would solve all my woes, instead every link in my application now carries around an huge encoded state variable in the URL. I'm completely missing the benefit of this versus just using session persistence (enlightenment appreciated). 4) Activation context magic - While this does make for clean and nifty URLs, the hassle of constructing the identifiers for complex objects and creating the contexts for them has not proven worth it to me (hint: composite primary keys are almost unusable). Also, if your page uses more than one dynamically-sized collection of objects, then you're out of luck. PLEASE PLEASE don't interpret this as Tapestry-bashing. Tapestry has been a delight to work with compared to previous frameworks I've used. I'm just really struggling with how to do something that, IMHO, a web framework should make very simple (request-scoped persistence). Anyone solve this riddle yet? Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Persistence pains
Sure Howard. Quite simply, the back button. When loading a page with an activation context, say: http://myapp.com/editproduct/20 (where 20 is a product ID) I'll initialize some flash-persistable values on the page from the Product whose ID is 20. Now if the user clicks on the Back button and goes to a link that reuses the same screen but without a context, say: http://myapp.com/editproduct/ (let's say this page should blank out the screen so the user can enter a new product) Most of my flash-persistable values (from Product 20) will still be on the screen. While some may argue that this is just poor design, what if the fields I initialize varies by product? I'd get a merging of the two products on the screen depending on what was persisted first. Are these scenarios valid? -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, May 02, 2008 5:17 PM To: Tapestry users Subject: Re: T5: Persistence pains Could you elaborate on why the flash persistence strategy is insufficient for your needs? On Fri, May 2, 2008 at 2:00 PM, Joel Wiegman [EMAIL PROTECTED] wrote: All, Maybe I'm missing something here, maybe I'm not, but I'm attempting to preserve state JUST BETWEEN REQUESTS and I'm really struggling (I know in T5 there's really two requests, but for simplicity's sake let's just call the round trip from the browser a request). My options are: 1) @Persist(session) - Obviously doesn't work well for just persisting values between requests, unless someone has come up with a reliable construct for nulling out these values whenever someone leaves the page? 2) @Persist(flash) - This is really only useful for messages and other objects that are reliably referenced once. This is NOT request-scoped persistence. 3) @Persist(client) - While I thought initially thought that this would solve all my woes, instead every link in my application now carries around an huge encoded state variable in the URL. I'm completely missing the benefit of this versus just using session persistence (enlightenment appreciated). 4) Activation context magic - While this does make for clean and nifty URLs, the hassle of constructing the identifiers for complex objects and creating the contexts for them has not proven worth it to me (hint: composite primary keys are almost unusable). Also, if your page uses more than one dynamically-sized collection of objects, then you're out of luck. PLEASE PLEASE don't interpret this as Tapestry-bashing. Tapestry has been a delight to work with compared to previous frameworks I've used. I'm just really struggling with how to do something that, IMHO, a web framework should make very simple (request-scoped persistence). Anyone solve this riddle yet? Joel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Persistence pains
Josh, Thanks for the great suggestions. I guess I'm still befuddled as to why a web framework would resist having a request scope so dilligently. The flash scope appears to makes some intelligent guesses as to when you want your objects removed from the session, but the back-button-example I listed is one of quite a few reasons why making such guesses is a fools game. As we all know, HTTP is a request-response, stateless protocol, but Tapestry appears to be resisting storing state in one of the most basic constructs available in HTTP... the request. Anyone know why this is? As you illustrated, I'm sure there are quite a few elaborate ways of dancing around the issue in any application (redundant checking, re-verification, passing clearThisValue flags around, etc.). None seem very elegant though (and would probably be associated with this is why I'm doing this comments). As for your activation context suggestions, those are some neat ideas. I hadn't considered your marking suggestion. I'm a little afraid to use it though. I can see a Tapestry pattern evolving from that that yields (String... stuff) as your parameter to your onActivate with a boatload of extravagant logic. Anyway, still haven't heard a useful suggestion to get objects into a request only scope. If anyone can think of something please post! Thanks, Joel -Original Message- From: [EMAIL PROTECTED] on behalf of Josh Canfield Sent: Fri 5/2/2008 6:31 PM To: Tapestry users Subject: Re: T5: Persistence pains I generally consider flash persistence as a way to get an object from the action request to the render request... If you're going to set it in the render request you should consider adding code that validates that your data and context match up. You could, for instance, also flash persist your id and check it against the id from the context. If they don't match then null your other properties. While some may argue that this is just poor design, what if the fields I initialize varies by product? I'd get a merging of the two products on the screen depending on what was persisted first. Storing these things in your component smells funny... but I don't know your app. If someone is coming to the page for the first time you want an empty object, if they are posting an update to the form then Tapestry is going to populate the values. If you are navigating within the page using pagelinks, but it's a form then I'd consider posting the form instead... Josh On Fri, May 2, 2008 at 2:39 PM, Joel Wiegman [EMAIL PROTECTED] wrote: Sure Howard. Quite simply, the back button. When loading a page with an activation context, say: http://myapp.com/editproduct/20 (where 20 is a product ID) I'll initialize some flash-persistable values on the page from the Product whose ID is 20. Now if the user clicks on the Back button and goes to a link that reuses the same screen but without a context, say: http://myapp.com/editproduct/ (let's say this page should blank out the screen so the user can enter a new product) Most of my flash-persistable values (from Product 20) will still be on the screen. While some may argue that this is just poor design, what if the fields I initialize varies by product? I'd get a merging of the two products on the screen depending on what was persisted first. Are these scenarios valid? -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, May 02, 2008 5:17 PM To: Tapestry users Subject: Re: T5: Persistence pains Could you elaborate on why the flash persistence strategy is insufficient for your needs? On Fri, May 2, 2008 at 2:00 PM, Joel Wiegman [EMAIL PROTECTED] wrote: All, Maybe I'm missing something here, maybe I'm not, but I'm attempting to preserve state JUST BETWEEN REQUESTS and I'm really struggling (I know in T5 there's really two requests, but for simplicity's sake let's just call the round trip from the browser a request). My options are: 1) @Persist(session) - Obviously doesn't work well for just persisting values between requests, unless someone has come up with a reliable construct for nulling out these values whenever someone leaves the page? 2) @Persist(flash) - This is really only useful for messages and other objects that are reliably referenced once. This is NOT request-scoped persistence. 3) @Persist(client) - While I thought initially thought that this would solve all my woes, instead every link in my application now carries around an huge encoded state variable in the URL. I'm completely missing the benefit of this versus just using session persistence (enlightenment appreciated). 4) Activation context magic - While this does make for clean and nifty URLs, the hassle of constructing the identifiers for complex objects and creating the contexts for them has not proven worth it to me (hint: composite primary keys
T5: OpenQA Maven repository location changed
All, I'm sure someone has called this out already, but I noticed that OpenQA's repository (that tapestry-test relies on) has changed locations. Looks like it switched from http://maven.openqa.org to http://archiva.openqa.org/repository/releases/ . I'm guessing this would only get fixed in the next release (5.0.12)? Insert Howard Maven rant here :-) Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: page activation + components
I may be chiming in a little late on this, but if Janos is just trying to communicate activation context values to child components, isn't this what the @Parameter annotation of a component is for? http://tapestry.apache.org/tapestry5/tapestry-core/guide/parameters.html Just kick me out if I'm off base... I only skimmed the thread. -Original Message- From: Chris Lewis [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 4:27 PM To: Tapestry users Subject: Re: page activation + components I see how this whole push on/pull off environment will solve the issue, but it just seems so nasty. I mean really, how is that any simpler than dealing directly with query parameters? I point at this only to highlight that perhaps Janos has brought to light a legitimately rough edge in T5, or else there's a cleaner way to do it and we're all just missing it. I'm convinced that the event system is the way to go as it seems a natural fit, but the redirect-after-action part is rendering it useless without using @Persist! Let me share what I've put together, and maybe someone will find the missing piece. I have a working test and I'll abbreviate the code here and assume a few things: (coming in another message - i tripped the spam filter :-| ) Josh Canfield wrote: Are you trying to keep the news id out of the url? Doesn't sound like it from your response to not doing the redirect. Since that's the case, why not add it to the page context? I suppose if you were building a portal with several components then keeping track of component parameters could get unwieldy. If you were showing a news article from the news portlet, and a stock highlight from the stock portlet... At that point you're sort of building a framework on a framework. You could build your page such that it accumulated context from it's components. Push a ComponentContext object into the Environment onActivate, and setupRender in your page (env gets cleared before render phase, not sure if there is a better way than doing it in both.) Then collect component parameter mappings. onPassivate for your page would organize and return these as it's context (you might want to sort them to get consistent results) Your url might look like this: http://localhost/context/mypage/cc/news/4527/stock/MCD Then onactivate you init the ComponentContext from the url keying off the cc to grab the remaining parameters and use them as key/value for the components. The your components do something like: @Environmental private ComponentContext _compContext; void setupRender() { Long newsId = _compContext.getLong(_resources.getId()); } void onPickNewsItem(Long id) { _compContext.put(_resources.getId(), id); } Josh On Wed, Apr 30, 2008 at 5:23 AM, János Jarecsni [EMAIL PROTECTED] wrote: Hi Chris, I try to explain :) Say, you have a NewsQuote component, which shows a few lines from the 5 latest news. At the and of each quotations, there a More link. Now, when the user clicks on this link (an action link, for that matter), the NewsQuote component will set a request scope info saying that the news with ID=4527 is requested. And when it comes to the News component (it is able to show the text of a given news in full), it simply looks at this piece of info, and loads the news with id 4527 (or gets it from an app level cache :)) and renders it. Hope it tells something about what I am up to :) thx Janos 2008/4/30 Chris Lewis [EMAIL PROTECTED]: Honestly it's difficult for me to imagine a situation where I'd do that because it seems to violate a degree of encapsulation that tapestry imposes as a freeing law of the framework. The epicenter of that being that one should not think in terms of low-level idioms such as request parameters, and instead replace those with a higher level of application logic that eclipses them entirely (when possible). That's not to say that your perspective is flawed, but from the small bit of understanding I've taken from your posts I can't see why one would do what you want. The thing that I've been saying is missing here is, what are you trying to do? I don't mean technically, I mean what is the end result for the user? Understanding this is critical, but even if I don't your problem can still be solved by using a session to serve as an arbitrary holder. If you've settled on this architecture, why not write such a generic service and move on? János Jarecsni wrote: Hi, I looked everywhere for usage of request scope variables, but found nothing (maybe I'm impatient a bit :)... Is it really that unrealistic to have two components in a page, one (A) having an action link eventhandler where it would set some attribute for the request only (not the session!) and then component B could render itself according to the attribute set by component A? I think it should be a piece of cake :)
RE: JSONObject problem and Autocomplete
Just to close the thread, I see that there's an existing bug for this problem: https://issues.apache.org/jira/browse/TAPESTRY-2234 -Original Message- From: JWiegman [mailto:[EMAIL PROTECTED] Sent: Friday, April 11, 2008 1:17 PM To: users@tapestry.apache.org Subject: Re: JSONObject problem and Autocomplete Julian, Did you ever find a fix for this? I'm running into the same issue... Thanks, Joel Julian Wood wrote: I was just extending Autocomplete, and I wanted to add a callback to the config, so I override the config: protected void configure(JSONObject config) { config.put(callback, myMethod); } and in my javascript I have: function myMethod(element, entry) { console.info(element); console.info(entry); return entry; } This doesn't work because myMethod is quoted in javascript, and needs to be unquoted: new AJAX.AutoComplete('provinceState', 'provinceState:menu', '/webapp/ signup.provincestate:autocomplete', {indicator :provinceState:loader,callback:myMethod,paramName:t:input}) ; should be new AJAX.AutoComplete('provinceState', 'provinceState:menu', '/webapp/ signup.provincestate:autocomplete', {indicator :provinceState:loader,callback:myMethod,paramName:t:input}); Note the absence of quotes around myMethod. So it seems I should be able to put an object into the config which returns an unquoted string: protected void configure(JSONObject config) { config.put(callback, new JSONString() { public String toJSONString() { return myMethod; } }); } However, this errors because the allowed types for the JSONObject.put method seem restricted to these: private static final Class[] ALLOWED = new Class[] { String.class, Boolean.class, Number.class, JSONObject.class, JSONArray.class, Null.class }; This, despite the fact that the method JSONObject.valueToString(Object value) looks for an object of type JSONString. I can't extend JSONObject with my own toJSONString() impl, because JSONObject is final. Bug? All that is needed is JSONString.class in ALLOWED. Thanks, J - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/JSONObject-problem-and-Autocomplete-tp16171055p166 28158.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.11: @Persist(flash) values are not retained if validation fails
Sure... An example is below. The values field disappears from the screen if validation fails. //JAVA public class MyClass { //(assume getters and setters exist) @Persist(flash) ListString values; public void onPrepare() { //populate values with stuff } public void onValidateForm() { //possibly some form validation here } } //TML t:form //other fields with validation rules would be here div t:type=loop source=values value=selectedValue ${selectedValue} /div t:form -Original Message- From: Ted Steen [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2008 6:10 PM To: Tapestry users Subject: Re: T5.0.11: @Persist(flash) values are not retained if validation fails Could you give a simple example of the problem? 2008/4/2, Joel Wiegman [EMAIL PROTECTED]: As an addendum, I shouldn't say any field. The culprit is a List that gets iterated over in the TML. -Original Message- From: Joel Wiegman [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2008 2:20 PM To: Tapestry users Subject: T5.0.11: @Persist(flash) values are not retained if validation fails All, I've noticed that if validation fails on my page, any field annotated with @Persist(flash) is not retained when the response is rendered. Per the documentation for @Persist(flash), this doesn't appear to be expected behavior. Should I put this in JIRA? Joel - 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] -- /ted - 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.0.11: @Persist(flash) values are not retained if validation fails
All, I've noticed that if validation fails on my page, any field annotated with @Persist(flash) is not retained when the response is rendered. Per the documentation for @Persist(flash), this doesn't appear to be expected behavior. Should I put this in JIRA? Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5.0.11: @Persist(flash) values are not retained if validation fails
As an addendum, I shouldn't say any field. The culprit is a List that gets iterated over in the TML. -Original Message- From: Joel Wiegman [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2008 2:20 PM To: Tapestry users Subject: T5.0.11: @Persist(flash) values are not retained if validation fails All, I've noticed that if validation fails on my page, any field annotated with @Persist(flash) is not retained when the response is rendered. Per the documentation for @Persist(flash), this doesn't appear to be expected behavior. Should I put this in JIRA? Joel - 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.7 Validation error
componentResources.triggerEvent() appears to be broken in T5.0.11-SNAPSHOT I have the following situation: public class LayoutClass { @Component private Form editControlForm; public void onValidateFromEditControlForm() { resources.triggerEvent(formValidate, null, null); } } public class BaseClassThatUsesLayout { @Inject private LayoutClass layout; } public class SpecificPage extends BaseClassThatUsesLayout { public void onFormValidate() { System.out.println(Form validated!); } } When I upgraded from 5.0.7 to T5.0.11-SNAPSHOT the onFormValidate() is no longer called. Please advise... Thanks! -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 5:23 PM To: Tapestry users Subject: Re: T5.0.7 Validation error On Dec 28, 2007 1:44 PM, Joel Wiegman [EMAIL PROTECTED] wrote: Ouch... That change botches up my current application pretty thoroughly. I don't think the event needs to be re-named... but consider the following situation: If a form is in a layout component that other pages use via the @Component annotation (say because most of the forms look very similar and they want to re-use the presentation and validation logic), they have no way of validating their forms in the pages, because they no longer have access to the validate event from the form. You can do onValidateFromLayout() ... that is, if Form is inside Layout, then the event will bubble up from Layout to your page, and will appear to originate with Layout. Alternately, the Layout component could capture the Form's validate event and trigger a new event with a name of your choice: boolean onValidateFromForm() { _componentResources.trigger(layoutvalidate, null, null); } I tried using the onValidateFromIndividualField() technique... the behavior of that seemed inconsistent (had to submit the form twice to get the event to fire???). Huh? Are you sure your client-side validation wasn't preventing the form submission? How does one log these events to see which events are firing? That isn't really logged right now. Looks like I'll have to start validation over from ground zero if I want to upgrade to 5.0.7... Perhaps the validation doc page could be updated with advice on proper validation techniques? -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 3:25 PM To: Tapestry users Subject: Re: T5.0.7 Validation error Tapestry 5.0.7 adds a new way of validating input from the client, a validate event that is emitted from individual components and is distinct from the validate event from the form. The event handler method you already had, that was intended for cross-form validation after values are in place, is being executed too early, for each field. Sorry, unexpected consequences. Perhaps the form's event should be renamed from validate to formValidate? Change your method name from onValidate() to onValidateFromForm() (adjusting for your form's id). On Dec 28, 2007 12:02 PM, Joel Wiegman [EMAIL PROTECTED] wrote: There appears to be a bug with 5.0.7 in that any custom validation method ( onValidate(), etc. ) gets called before the HTTP values get bound to the Tapestry component. Can anyone else confirm this? -Original Message- From: Joel Wiegman [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 2:40 PM To: Tapestry users Subject: RE: T5.0.7 Validation error I'm trying to upgrade to 5.0.7 and can't get screens (that validated just fine with 5.0.6) to validate either. Will re-post once I find out more. -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 2:05 PM To: Tapestry users Subject: Re: T5.0.7 Validation error Try clearing your browser cache, you may have the old tapestry.js stuck in there. On Dec 28, 2007 10:29 AM, Marcelo Lotif [EMAIL PROTECTED] wrote: When i switch to the 5.0.7 version, the validations of my BeanEditForms doesn't work properly... I have a BEF to add a user to the database. When i click on the submit button, it must validate the fields and go to another page to show all the users on the database. If there are errors on the validation, it must stay at the same page and show the errors to the user (as expected). When i switch to 5.0.7, even if i get some errors, the page goes to the another one and the it ends up to add the user to the database with the errors. The funny thing is when i come back to the page, the errors are there... If i switch back to 5.0.6, everything works fine again. Am i missing something or this is really an error? -- Atenciosamente, Marcelo Lotif -- Howard M. Lewis Ship Creator Apache
T5: File generation
Hello all, Our application has the need to generate files. I'm interested in trying to use Tapestry to do this since we're already using T5 on the presentation layer. Has anyone extracted the Tapestry templating engine to do other processing? Something like the pseudo-code below: // BEGIN @Inject ComponentRenderer cr; MyComponent component = new MyComponent(); component.setName(Test); OutputStream os = cr.render(component); // END Can anyone point me to the right package/class to look at for something like this? Thanks! Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: File generation
The type of file doesn't really matter here. I just want to leverage the Tapestry templating engine. For example, say my TML looked like this: t:loop source=entries value=entry ENTRY NAME: ${entry.name} ENTRY ADDRESS: ${entry.address} /t:loop I'd of course need to remove the HTML validation that Tapestry does for me, but I'm guessing that's configurable? Since Tapestry supports a Stream as a return value, I'm guessing that there's some sort of support for this. MyComponent is just a representation of a POJO (might be Tapestry-annotated, might not). -Original Message- From: Chris Lewis [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 8:59 AM To: Tapestry users Subject: Re: T5: File generation I'm fuzzy on your goal. What 'files' do you want to make? You want the generated markup of a component? A page? For the record, I'm fairly sure T5 is specifically designed to avoid semantics like: MyComponent component = new MyComponent(); component.setName(Test); Components don't 'exist' like that. chris Joel Wiegman wrote: Hello all, Our application has the need to generate files. I'm interested in trying to use Tapestry to do this since we're already using T5 on the presentation layer. Has anyone extracted the Tapestry templating engine to do other processing? Something like the pseudo-code below: // BEGIN @Inject ComponentRenderer cr; MyComponent component = new MyComponent(); component.setName(Test); OutputStream os = cr.render(component); // END Can anyone point me to the right package/class to look at for something like this? Thanks! Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: File generation
Yeah, it'd be a really nice feature. Right now I'm using velocity tools to accomplish this... and velocity has a dependency on Struts. So I have JARs for three templating engines (Tapestry, Velocity, and Struts) in my WAR! :-) -Original Message- From: Chris Lewis [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 9:33 AM To: Tapestry users Subject: Re: T5: File generation You can get a reference to the server-side (dom) document, which will contain generated markup, but I am almost certain that you can't write code like you mentioned (pass a component instance into a kind of rendered). The stream return is to make different http responses easy, including binary files (images etc), xml, plain text, etc. You _may_ be able to hack your way to what you want, but I can't imagine it would be clean and I'm sure you'd have to meddle with internal classes. Good luck - I'm sure others would be interested in your progress. sincerely, chris Joel Wiegman wrote: The type of file doesn't really matter here. I just want to leverage the Tapestry templating engine. For example, say my TML looked like this: t:loop source=entries value=entry ENTRY NAME: ${entry.name} ENTRY ADDRESS: ${entry.address} /t:loop I'd of course need to remove the HTML validation that Tapestry does for me, but I'm guessing that's configurable? Since Tapestry supports a Stream as a return value, I'm guessing that there's some sort of support for this. MyComponent is just a representation of a POJO (might be Tapestry-annotated, might not). -Original Message- From: Chris Lewis [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 8:59 AM To: Tapestry users Subject: Re: T5: File generation I'm fuzzy on your goal. What 'files' do you want to make? You want the generated markup of a component? A page? For the record, I'm fairly sure T5 is specifically designed to avoid semantics like: MyComponent component = new MyComponent(); component.setName(Test); Components don't 'exist' like that. chris Joel Wiegman wrote: Hello all, Our application has the need to generate files. I'm interested in trying to use Tapestry to do this since we're already using T5 on the presentation layer. Has anyone extracted the Tapestry templating engine to do other processing? Something like the pseudo-code below: // BEGIN @Inject ComponentRenderer cr; MyComponent component = new MyComponent(); component.setName(Test); OutputStream os = cr.render(component); // END Can anyone point me to the right package/class to look at for something like this? Thanks! Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: File generation
I wouldn't think it would either, but when you use Maven to grab their tools, it brings in Struts: http://repo1.maven.org/maven2/org/apache/velocity/velocity-tools/1.3/velocity-tools-1.3.pom -Original Message- From: Christian Köberl [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 10:15 AM To: users@tapestry.apache.org Subject: RE: T5: File generation Tapestry is not the right tool to generate files - we tried this in T4 and failed. T5 is even more component-oriented. Components just don't work well for generating text files. Use Velocity or FreeMarker. Joel Wiegman-2 wrote: and velocity has a dependency on Struts. Velcity has no dependency on Struts, see http://velocity.apache.org/engine/releases/velocity-1.5/dependencies.html -- Chris -- View this message in context: http://www.nabble.com/T5%3A-File-generation-tp15758849p15760621.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: File generation
No... Not yet anyway! Ideally, barebones, I'm just looking for a way to instantiate the rendering engine in a main method. I know there's infinite flexibility when the http client/container are included, but I'd rather leave them out of it. I know this isn't a practical application for Tapestry, but it does have the capability... -Original Message- From: Fernando Padilla [mailto:[EMAIL PROTECTED] Sent: Friday, February 29, 2008 11:56 AM To: Tapestry users Subject: Re: T5: File generation The question I have is on what could you mean by generate files. If you can just have an job to hit a particular url, then you can use tapestry to generate that url. If you want tapestry to programmatically generate a page, that is conceptually possible, and I think I saw some code floating around, but I've not done it, and it's not generally used. You can also have a component capture the output of it's rendering and have it do whatever it wants with that. For example, I have a Buffer component that caches the output and puts it in memcached. You could have a component that dumps its output to a file (but it would still require an outside process to hit a url to generate the page to have the component generate itself).. Have I confused you enough yet? Joel Wiegman wrote: Hello all, Our application has the need to generate files. I'm interested in trying to use Tapestry to do this since we're already using T5 on the presentation layer. Has anyone extracted the Tapestry templating engine to do other processing? Something like the pseudo-code below: // BEGIN @Inject ComponentRenderer cr; MyComponent component = new MyComponent(); component.setName(Test); OutputStream os = cr.render(component); // END Can anyone point me to the right package/class to look at for something like this? Thanks! Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5.0.11-SNAPSHOT: Selenium upgrade
All, Anyone know of any plans to upgrade the Selenium version in tapestry-test from 0.8.1 to a more current version? I've spent all day trying to get SSL to work with it, only to find out that the version Tapestry uses (0.8.1) does not support HTTPS: http://blogs.opensymphony.com/plightbo/2006/10/selenium_rc_now_supports_ https.html Thanks, Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5.0.11-SNAPSHOT: tapestry-test suggestions
All, I'd like to suggest some improvements to the tapestry-test library. I've had to write my own custom version of these classes because some of them aren't very configurable. - Perhaps most importantly, leverage the @BeforeSuite and @AfterSuite TestNG annotations for setting up and tearing down the environment. Surefire has finally begun supporting these annotations in their most recent releases. That way one could use a single browser instance for all tests. - Allow a browser TestNG parameter to dynamically configure which browser the tests run on. That way you're able to test multiple browsers immediately and painlessly: !DOCTYPE suite SYSTEM http://testng.org/testng-1.0.dtd; suite name=seleniumTests test name=IEFunctionalTests parameter name=browser value=*iexplore/ packages package name=com.mycompany.app.functest / /packages /test test name=FireFoxFunctionalTests parameter name=browser value=*firefox/ packages package name=com.mycompany.app.functest / /packages /test /suite - A method to typeWithFullKeyEvents would greatly enhance AJAX testing, something similar to the method found here: http://blogs.atlassian.com/developer/2007/08/selenium_is_the_pain_worth_ it.html - I've found a need to configure member variables that aren't configurable, like AbstractIntegrationTestSuite.BASE_URL and JettyRunner.DEFAULT_SECURE_PORT, JettyRunner's keystore configuration, etc Perhaps these could be configured using TestNG parameters as well. I welcome any additional suggestions/criticisms of my suggestions. Once I've compiled them I will put them in JIRA. Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5.0.11-SNAPSHOT: tapestry-test suggestions
I've always been under the impression that the purpose of the TestNG parameter paradigm is that it's a hook to help you dynamically configure your tests. And since we're using TestNG... Not sure what you mean with the whole constructor idea? Surefire's the one instantiating my tests. My custom variation runs one Jetty/Selenium/client instance for all of my test executions. Works just fine (except for the whole HTTPS thing I mentioned). As far as the multiple applications... That's a tricky one... Perhaps just two different flavors of the AbstractIntegrationTestSuite with some shared code? I'd imagine most people don't need the multiple applications and would rather have just one instance of Jetty. -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Thursday, February 28, 2008 2:39 PM To: Tapestry users Subject: Re: T5.0.11-SNAPSHOT: tapestry-test suggestions I'm thinking that instead of a bunch of unrelated configuration values and constants, perhaps a single object that contains all of them, that can be passed to the constructor. BeforeSuite/AfterSuite: Have to look into this; right now, T5's tests start up a series of different applicaitions to test various odds and ends. Perhaps we could juggle it to just start/stop Jetty and leave Selenium (server and browser app) running the whole time? On Thu, Feb 28, 2008 at 11:30 AM, Joel Wiegman [EMAIL PROTECTED] wrote: All, I'd like to suggest some improvements to the tapestry-test library. I've had to write my own custom version of these classes because some of them aren't very configurable. - Perhaps most importantly, leverage the @BeforeSuite and @AfterSuite TestNG annotations for setting up and tearing down the environment. Surefire has finally begun supporting these annotations in their most recent releases. That way one could use a single browser instance for all tests. - Allow a browser TestNG parameter to dynamically configure which browser the tests run on. That way you're able to test multiple browsers immediately and painlessly: !DOCTYPE suite SYSTEM http://testng.org/testng-1.0.dtd; suite name=seleniumTests test name=IEFunctionalTests parameter name=browser value=*iexplore/ packages package name=com.mycompany.app.functest / /packages /test test name=FireFoxFunctionalTests parameter name=browser value=*firefox/ packages package name=com.mycompany.app.functest / /packages /test /suite - A method to typeWithFullKeyEvents would greatly enhance AJAX testing, something similar to the method found here: http://blogs.atlassian.com/developer/2007/08/selenium_is_the_pain_wort h_ it.html - I've found a need to configure member variables that aren't configurable, like AbstractIntegrationTestSuite.BASE_URL and JettyRunner.DEFAULT_SECURE_PORT, JettyRunner's keystore configuration, etc Perhaps these could be configured using TestNG parameters as well. I welcome any additional suggestions/criticisms of my suggestions. Once I've compiled them I will put them in JIRA. Joel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5.0.11-SNAPSHOT: pageLink rendering in SSL broken
Hello all, After upgrading to T5.0.11-SNAPSHOT, PageLink components that render SSL links do not render the correct protocol and omit the port altogether. Expected: https://myserver:9300/myapp Actual: http://myserver/myapp Running the same application over regular HTTP renders the links correctly. Can anyone confirm this? Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5.0.11-SNAPSHOT: pageLink rendering in SSL broken
That does help! I'll have to make bunches of changes (getting the build to run my integration tests (Jetty) in SSL, etc.), but should be manageable. Thanks! -Original Message- From: Filip S. Adamsen [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 26, 2008 10:11 AM To: Tapestry users Subject: Re: T5.0.11-SNAPSHOT: pageLink rendering in SSL broken Hi Joel, A @Secure annotation was implemented recently, I believe you might want to override the BaseURLSource service: http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/secure. html Hope this helps. :) -Filip Joel Wiegman skrev: Hello all, After upgrading to T5.0.11-SNAPSHOT, PageLink components that render SSL links do not render the correct protocol and omit the port altogether. Expected: https://myserver:9300/myapp Actual: http://myserver/myapp Running the same application over regular HTTP renders the links correctly. Can anyone confirm this? Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5.0.10: DateField on IE
Hello all, Can anyone confirm that the DateField component is broken in IE 6.0 (possibly 7.0) and T5.0.10? I'm getting JavaScript errors when the pop-up image is clicked. Thanks! Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5.0.10: DateField on IE
Howard, Just to complete the thread, I upgraded to the 5.0.11-SNAPSHOT release and the DateField component works as expected on IE. Joel -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Monday, February 25, 2008 3:09 PM To: Tapestry users Subject: Re: T5.0.10: DateField on IE I've done some work on it in 5.0.11, and tested with Mac Firefox 2 and Windows IE 7. I don't have access to an IE 6 right now (I need to setup yet another virtual machine). On Mon, Feb 25, 2008 at 10:30 AM, Joel Wiegman [EMAIL PROTECTED] wrote: Hello all, Can anyone confirm that the DateField component is broken in IE 6.0 (possibly 7.0) and T5.0.10? I'm getting JavaScript errors when the pop-up image is clicked. Thanks! Joel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Howard deserves praise
Can we just remove him from the list? That's not the first time he's written a very spectacularly uninformed troll. -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Monday, February 11, 2008 11:46 AM To: Tapestry users Subject: Re: Howard deserves praise Don't even bother to respond, just delete the message. Anything else just tweaks the troll. On Feb 11, 2008 8:30 AM, Davor Hrg [EMAIL PROTECTED] wrote: TROLL !! On Feb 11, 2008 4:24 PM, Emmanuel Sowah [EMAIL PROTECTED] wrote: Hi guys, Is it me, or you too have noticed an active participation of Howard in the answering of questions here on the list in recent times? In the past when Tapestry was popular his ego and pompous attitude made him feel too high to even bother to read people's request for help. But now with the rising of excellent frameworks like GWT and Wicket all offering an excellent alternative to Tapestry his ego has dropped massively and he has resorted back to basics. He started like this anyway and I'm personally glad he's going back to his roots. He deserved to be praised for turning back to the humble Howard I knew when Tapestry started in the beginning. It's rather unfortunate that competetion had to awaken him. This is a real example of the popular saying that goes Competition is a good thing, though. Having said that, I must also mention that this might be too late to save Tapestry. Looking at the traffic the past times here on the list, one can see there is a serious reduction in the use of Tapestry. And that bothers me. I persnally think Tapestry had dipped into a deep coma. And from what I know many that fall in coma ultimately come out dead. Though I'm still hoping for the best for Tapestry. I have a huge codebase written in Tapestry. I don't want to go the route like theserverside.com went by ditching Tapestry and starting all over again. Regards, Emmanuel - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5.0.10: Integer as null
I have a text box bound to a non-primitive Integer value and I keep getting the following error when I submit the form: The input value '' is not parseable as an integer value. The default NullFieldStrategy is to keep nulls as null, so I don't think I have to include that new attribute. My TML is as follows is: tr t:type=loop source=departmentTaxEntries value=currentDepartmentTaxEntry encoder=departmentTaxEncoder tdt:textField t:id=departmentId disabled=disabled value=currentDepartmentTaxEntry.departmentId size=2 maxlength=2 t:validate=maxlength=2//td /tr I'm using a DefaultPrimaryKeyEncoder to encode the values back to the server. I'm guessing between that and the fact that Howard removed the null check from the IntegerTranslator (http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src /main/java/org/apache/tapestry/internal/translator/IntegerTranslator.jav a?r1=594319r2=612962) is why I'm experiencing the issue. Bug? Jira? Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tapestry[5] - Overriding the form error messages
Not sure how stringent your requirements are, but I know with 5.0.7 the bubbles go away by setting clientValidation=false on the form component. Of course, this means that the page submits to validate... -Original Message- From: Maximilian Weißböck [mailto:[EMAIL PROTECTED] Sent: Thursday, January 31, 2008 6:15 AM To: Tapestry users Subject: AW: Tapestry[5] - Overriding the form error messages There shold be an easy way to use normal text as replacement for the popup bubbles, as we have the need to build our WebApps conforming to WAI (Web Accessibility Initiative). Any change to get this? We have WAI conformant Apps running with T3 and T4 and would very much preferr to build the next App with T5. Thx, Max -Ursprüngliche Nachricht- Von: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 30. Jänner 2008 22:26 An: Tapestry users Betreff: Re: Tapestry[5] - Overriding the form error messages Starting with 5.0.9, the validation errors appear as popup bubbles adjacent to the fields. On Jan 30, 2008 7:15 AM, Anteneh Alemayehu [EMAIL PROTECTED] wrote: Hi Everyone, I have a specific message area on the top of the page to display the eror messages. I might have more than one form per page, How can I overide the error messges from the form validation and display on the message area. Any Idea? Thank you, Anteneh -- View this message in context: http://www.nabble.com/Tapestry-5Overriding-the-form-error- messages-tp15183424p15183424.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] This email was Anti Virus checked by Astaro Security Gateway. http://www.astaro.com This email was Anti Virus checked by Astaro Security Gateway. http://www.astaro.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: TypeCoercer uses unsafe route for void to Integer
Michael, I just encountered this yesterday. I actually think this is a bug because the default NullFieldStrategy for TextFields is to leave nulls as null, but the bug is that it still goes through the type conversion hierarchy to do so (why not just return me null if you get a null?). The more interesting problem is... What if the field is a primitive int rather than an Integer? Can't do null anymore! There's an easier work around for the problem... You don't have to modify Tapestry code. Just add the following code to your app's Module: public static void contributeTypeCoercer( ConfigurationCoercionTuple configuration) { add(configuration, void.class, Integer.class, new CoercionVoid, Integer() { public Integer coerce(Void input) { return null; } }); } private static S, T void add(ConfigurationCoercionTuple configuration, ClassS sourceType, ClassT targetType, CoercionS, T coercion) { CoercionTupleS, T tuple = new CoercionTupleS, T(sourceType, targetType, coercion); configuration.add(tuple); } Hope that helps... Joel -Original Message- From: Michael Capper [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 30, 2008 8:18 AM To: users@tapestry.apache.org Subject: T5: TypeCoercer uses unsafe route for void to Integer Hi, I've got a BeanForm in my Tapestry 5.0.9 Application, with the Bean expecting some Integers as input. When I submit the form without entering any data in these fields, I get an RuntimeException in the TypeCoercerImpl (line 130), because while converting my void to Integer it uses void -- String -- Long -- Integer, and comes accross a NullPointerException in the constructor for a Long(String). It seems the TypeCoercerImpl.findOrCreateCoercion(...) method preferes this Coercion to the COERCION_NULL_TO_OBJECT, which in my case would have suited me better. To overcome this, I added a few lines in TypeCoercerImpl.coerce(...) at line 130 pre try { result = coercion.coerce(input); } catch (Exception ex) { if (input == null) { try { result = COERCION_NULL_TO_OBJECT.coerce(input); } catch (Throwable t) { throw new RuntimeException(ServiceMessages.failedCoercion( input, targetType, coercion, ex), ex); } } else throw new RuntimeException(ServiceMessages.failedCoercion( input, targetType, coercion, ex), ex); } /pre Not sure about the side-effects of this workaround, but I thought I'd post it, as it might be a bug. Greetings, M.C. - 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: Simple Module not loading [5.0.9]
Never mind... The module class was in src/test/java not src/main/java. Walks off with tail between legs -Original Message- From: Joel Wiegman [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 29, 2008 1:41 PM To: Tapestry users Subject: T5: Simple Module not loading [5.0.9] All, Let me tell you a quick story... Got an error in my app which I'm sure some of you have seen: Failure writing parameter value of component app/controllist/consignment/EditControl:departmentid: Coercion of null to type java.lang.Integer (via null -- String, String -- Long, Long -- Integer) failed: null I thought to myself... well I guess that makes sense... let me add a Module definition and contribute the coercion for nulls to Integers. So I check my web xml (abridged): context-param param-nametapestry.app-package/param-name param-valuecom.foo.web/param-value /context-param filter filter-nameapp/filter-name filter-classorg.apache.tapestry.spring.TapestrySpringFilter/filter-cl ass /filter And conclude that I need to create the following file: package com.foo.web.services; import org.apache.tapestry.ioc.Configuration; import org.apache.tapestry.ioc.services.Coercion; import org.apache.tapestry.ioc.services.CoercionTuple; public class AppModule { public static void contributeTypeCoercer( ConfigurationCoercionTuple configuration) { System.out.println(Coercion added!); add(configuration, void.class, Integer.class, new CoercionVoid, Integer() { public Integer coerce(Void input) { return null; } }); } private static S, T void add(ConfigurationCoercionTuple configuration, ClassS sourceType, ClassT targetType, CoercionS, T coercion) { CoercionTupleS, T tuple = new CoercionTupleS, T(sourceType, targetType, coercion); configuration.add(tuple); } } Problem is... I never see the System.out, so I can only assume that my module never loaded (and of course, I still get the error). Can anyone spot my flaw? I'm totally stumped. Joel - 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: Simple Module not loading [5.0.9]
All, Let me tell you a quick story... Got an error in my app which I'm sure some of you have seen: Failure writing parameter value of component app/controllist/consignment/EditControl:departmentid: Coercion of null to type java.lang.Integer (via null -- String, String -- Long, Long -- Integer) failed: null I thought to myself... well I guess that makes sense... let me add a Module definition and contribute the coercion for nulls to Integers. So I check my web xml (abridged): context-param param-nametapestry.app-package/param-name param-valuecom.foo.web/param-value /context-param filter filter-nameapp/filter-name filter-classorg.apache.tapestry.spring.TapestrySpringFilter/filter-cl ass /filter And conclude that I need to create the following file: package com.foo.web.services; import org.apache.tapestry.ioc.Configuration; import org.apache.tapestry.ioc.services.Coercion; import org.apache.tapestry.ioc.services.CoercionTuple; public class AppModule { public static void contributeTypeCoercer( ConfigurationCoercionTuple configuration) { System.out.println(Coercion added!); add(configuration, void.class, Integer.class, new CoercionVoid, Integer() { public Integer coerce(Void input) { return null; } }); } private static S, T void add(ConfigurationCoercionTuple configuration, ClassS sourceType, ClassT targetType, CoercionS, T coercion) { CoercionTupleS, T tuple = new CoercionTupleS, T(sourceType, targetType, coercion); configuration.add(tuple); } } Problem is... I never see the System.out, so I can only assume that my module never loaded (and of course, I still get the error). Can anyone spot my flaw? I'm totally stumped. Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Event order for selected and validate events
All, I've noticed that the validate event for a form fires before the selected event fires from the Submit component. IMHO, I think the selected event should fire first. Seems like I would want to know HOW the form was submitted before I validate it (in case I want to, say, skip validation on the form if a person clicks a specific button). Can anyone present a counter argument? If not I'll create a JIRA bug (or is it a feature request?). Cheers, Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5.0.7: PageTester.renderPage chokes on page URLs that have blanks
This is a known issue: https://issues.apache.org/jira/browse/TAPESTRY-1568 -Original Message- From: Franz Amador [mailto:[EMAIL PROTECTED] Sent: Thursday, January 03, 2008 2:50 PM To: Tapestry Subject: T5.0.7: PageTester.renderPage chokes on page URLs that have blanks My page unit test dies in PageTester.renderPage. The actual death is at URLChangeTracker.add(URL), line 72, namely URI resourceURI = url.toURI(); which gives a URL parsing error. The problem seems to be that my page URL has blanks: file:/C:/Documents and Settings/Franz/workspace/pi-tapestry5/src/main/webapp/AppHomeDirPage.tml because I'm using the default Eclipse workspace location. It doesn't die when I run the app, though. When I look at the URL in the debugger then, I see that the blanks have been escaped: file:/C:/Documents%20and%20Settings/Franz/workspace/pi-tapestry5/src/mai n/webapp/AppHomeDirPage.tml so it looks like the page Resource generates a different URL when run as an app (blanks escaped) than when run as a test (blanks not escaped). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5.0.7 Validation error
I'm trying to upgrade to 5.0.7 and can't get screens (that validated just fine with 5.0.6) to validate either. Will re-post once I find out more. -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 2:05 PM To: Tapestry users Subject: Re: T5.0.7 Validation error Try clearing your browser cache, you may have the old tapestry.js stuck in there. On Dec 28, 2007 10:29 AM, Marcelo Lotif [EMAIL PROTECTED] wrote: When i switch to the 5.0.7 version, the validations of my BeanEditForms doesn't work properly... I have a BEF to add a user to the database. When i click on the submit button, it must validate the fields and go to another page to show all the users on the database. If there are errors on the validation, it must stay at the same page and show the errors to the user (as expected). When i switch to 5.0.7, even if i get some errors, the page goes to the another one and the it ends up to add the user to the database with the errors. The funny thing is when i come back to the page, the errors are there... If i switch back to 5.0.6, everything works fine again. Am i missing something or this is really an error? -- Atenciosamente, Marcelo Lotif -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - 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.7 Validation error
There appears to be a bug with 5.0.7 in that any custom validation method ( onValidate(), etc. ) gets called before the HTTP values get bound to the Tapestry component. Can anyone else confirm this? -Original Message- From: Joel Wiegman [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 2:40 PM To: Tapestry users Subject: RE: T5.0.7 Validation error I'm trying to upgrade to 5.0.7 and can't get screens (that validated just fine with 5.0.6) to validate either. Will re-post once I find out more. -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 2:05 PM To: Tapestry users Subject: Re: T5.0.7 Validation error Try clearing your browser cache, you may have the old tapestry.js stuck in there. On Dec 28, 2007 10:29 AM, Marcelo Lotif [EMAIL PROTECTED] wrote: When i switch to the 5.0.7 version, the validations of my BeanEditForms doesn't work properly... I have a BEF to add a user to the database. When i click on the submit button, it must validate the fields and go to another page to show all the users on the database. If there are errors on the validation, it must stay at the same page and show the errors to the user (as expected). When i switch to 5.0.7, even if i get some errors, the page goes to the another one and the it ends up to add the user to the database with the errors. The funny thing is when i come back to the page, the errors are there... If i switch back to 5.0.6, everything works fine again. Am i missing something or this is really an error? -- Atenciosamente, Marcelo Lotif -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5.0.7 Validation error
Ouch... That change botches up my current application pretty thoroughly. I don't think the event needs to be re-named... but consider the following situation: If a form is in a layout component that other pages use via the @Component annotation (say because most of the forms look very similar and they want to re-use the presentation and validation logic), they have no way of validating their forms in the pages, because they no longer have access to the validate event from the form. I tried using the onValidateFromIndividualField() technique... the behavior of that seemed inconsistent (had to submit the form twice to get the event to fire???). How does one log these events to see which events are firing? Looks like I'll have to start validation over from ground zero if I want to upgrade to 5.0.7... Perhaps the validation doc page could be updated with advice on proper validation techniques? -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 3:25 PM To: Tapestry users Subject: Re: T5.0.7 Validation error Tapestry 5.0.7 adds a new way of validating input from the client, a validate event that is emitted from individual components and is distinct from the validate event from the form. The event handler method you already had, that was intended for cross-form validation after values are in place, is being executed too early, for each field. Sorry, unexpected consequences. Perhaps the form's event should be renamed from validate to formValidate? Change your method name from onValidate() to onValidateFromForm() (adjusting for your form's id). On Dec 28, 2007 12:02 PM, Joel Wiegman [EMAIL PROTECTED] wrote: There appears to be a bug with 5.0.7 in that any custom validation method ( onValidate(), etc. ) gets called before the HTTP values get bound to the Tapestry component. Can anyone else confirm this? -Original Message- From: Joel Wiegman [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 2:40 PM To: Tapestry users Subject: RE: T5.0.7 Validation error I'm trying to upgrade to 5.0.7 and can't get screens (that validated just fine with 5.0.6) to validate either. Will re-post once I find out more. -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, December 28, 2007 2:05 PM To: Tapestry users Subject: Re: T5.0.7 Validation error Try clearing your browser cache, you may have the old tapestry.js stuck in there. On Dec 28, 2007 10:29 AM, Marcelo Lotif [EMAIL PROTECTED] wrote: When i switch to the 5.0.7 version, the validations of my BeanEditForms doesn't work properly... I have a BEF to add a user to the database. When i click on the submit button, it must validate the fields and go to another page to show all the users on the database. If there are errors on the validation, it must stay at the same page and show the errors to the user (as expected). When i switch to 5.0.7, even if i get some errors, the page goes to the another one and the it ends up to add the user to the database with the errors. The funny thing is when i come back to the page, the errors are there... If i switch back to 5.0.6, everything works fine again. Am i missing something or this is really an error? -- Atenciosamente, Marcelo Lotif -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind - 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: Tapestry-Test
Seriously? Google webdefault.xml Put one in your /Users/justinchua/bfe/myapp/src/test/conf/ folder. :-) -Original Message- From: Angelo Chen [mailto:[EMAIL PROTECTED] Sent: Friday, December 21, 2007 4:16 AM To: users@tapestry.apache.org Subject: T5: Tapestry-Test Hi, I am trying out this Tapestry-Test, here is my simple test: public class MyTest2 extends AbstractIntegrationTestSuite { public class MyTest2 extends AbstractIntegrationTestSuite { public MyTest2() { super(src/main/webapp); } @Test public void test() { open(BASE_URL); } } and I got this error: WebApplicationContext Configuration error on src/main/webapp java.io.FileNotFoundException: /Users/justinchua/bfe/myapp/src/test/conf/webdefault.xml (No such file or directory) what I'm missing here? thanks. A.C. -- View this message in context: http://www.nabble.com/T5%3A-Tapestry-Test-tp14452455p14452455.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: Can't get Tapestry5 to work with Spring
Dave, I have Tapestry 5.0.5, Spring 2.0.4, and Sun Appserver 9 all working in harmony. Haven't really had any problems at all. Based on your post, it sounds like Tapestry is finding and initializing the beans. That's the toughest part, so if that's true, I might suggest to just simplify things a little: * Put one simple named bean in your applicationContext.xml * Then instead of using the @Service annotation, just name your member variable the same as the bean name * Make sure your @Inject annotations are in a page or component class (NOTE: this is important, because Tapestry doesn't just scan your entire classpath and look for these annotations, it only looks in the Component Packages (see here: http://tapestry.formos.com/nightly/tapestry5/tapestry-core/guide/compone nt-classes.html )). Hope that helps. Here's some sample source: beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd; bean name=serviceDao class=com.foo.ServiceDaoImpl/ /beans public class Target { @Inject private ServiceDao serviceDao; // -- NOTE CHANGE public ListString getOptions() { return dao.getOptions(); /// NPE here!! getOptions() in the dao returns a hard-coded list at this time } public void setDao(final ServiceDao _dao) { this.dao = _dao; } public ServiceDao getDao() { return dao; } } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 19, 2007 1:27 PM To: users@tapestry.apache.org Subject: Can't get Tapestry5 to work with Spring I'm new to Tapestry. I've been wanting to take a look at it for some time, and have a bit of time here at the end of the year. I've started with Howard's tutorial for Tap5 and got the first stage of that working easily. So then I created another simple page, and linked to that. Still working fine, so time to start getting into something 'real'. Since we use Spring for all our projects here I figured that should be my next step. I created an iBatis DAO that accesses one of our existing JNDI datasources, with the intent of having my page retrieve data from it for displaying. I followed the steps described here: http://tapestry.apache.org/tapestry5/tapestry-spring/, but the dao is not getting injected; I get a NPE when it comes time to access it. My logs show the initialization completing correctly, with the Spring beans being created. Is there anything missing fom this description to complete the wiring? I'm using Tapestry5.0.6, Spring2.0.1 (though I also tried 1.2.8), iBatis2.3.0.677, running in Sun Appserver8.2 Here's my web.xml: web-app display-nametapestry-tutorial1 Tapestry 5 Application/ display-name context-param !-- The only significant configuration for Tapestry 5, this informs Tapestry of where to look for pages, components and mixins. -- param-nametapestry.app-package/param-name param-valueorg.apache.tapestry.tutorial/param-value /context-param context-param param-namecontextConfigLocation/param-name param-value classpath:org/apache/tapestry/tutorial/applicationContext.xml /param-value /context-param filter filter-nameapp/filter-name !-- filter-classorg.apache.tapestry.TapestryFilter/filter-class -- filter-class org.apache.tapestry.spring.TapestrySpringFilter/filter-class /filter filter-mapping filter-nameapp/filter-name url-pattern/*/url-pattern /filter-mapping listener listener-class org.springframework.web.context.ContextLoaderListener/listener-class /listener /web-app org/apache/tapestry/tutorial/applicationContext.xml: beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd; import resource= classpath:org/apache/tapestry/tutorial/dao/applicationContext-jndi.xml / import resource= classpath:org/apache/tapestry/tutorial/dao/ibatis/applicationContext.xm l / /beans org/apache/tapestry/tutorial/dao/applicationContext-jndi.xml: beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd; bean id=serviceDataSource class=
RE: unit testing
Tony, The purpose of unit testing is to run your tests in a black box environment. If you auto-load all of the Spring configurations from your web.xml and use them, you're kind of defeating the purpose of unit testing. If you're looking for integration testing (which it sounds like you are), then you should probably look here: http://tapestry.apache.org/tapestry5/tapestry-test/ I'll assume you really do mean unit testing though. Tapestry provides very clean hooks to unit test your pages. I've implemented a variation of the techniques found on the Wiki... The main difference being that you get to use the traditional Tapestry annotations. The real power of this is that I can maintain an entirely separate Spring configuration that contains mock objects (called test-applicationContext.xml in the code below). Hope this helps, Joel Here's the code: /*** PageTestSupport.java ***/ package com.myapp.dir.pages; import org.apache.tapestry.test.PageTester; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; public abstract class PageTestSupport { protected PageTester pageTester; @BeforeTest(alwaysRun=true) protected void init() { //crucial line... Looks for a 'TestHarnessModule' in the com.myapp.dir.services package pageTester= new PageTester(com.myapp.dir, TestHarness); } @AfterTest(alwaysRun=true) protected void destroy() { pageTester.shutdown(); } } /*** TestHarnessModule.java ***/ package com.myapp.dir.services; import org.apache.tapestry.ioc.ObjectLocator; import org.apache.tapestry.ioc.ObjectProvider; import org.apache.tapestry.ioc.OrderedConfiguration; public class TestHarnessModule { // contribution master object provider public static void contributeMasterObjectProvider( OrderedConfigurationObjectProvider configuration, ObjectLocator locator) { configuration.add(spring, locator .autobuild(SpringObjectProvider.class)); } } /*** SpringObjectProvider.java ***/ package com.myapp.dir.services; import java.util.logging.Level; import java.util.logging.Logger; import org.apache.tapestry.ioc.AnnotationProvider; import org.apache.tapestry.ioc.ObjectLocator; import org.apache.tapestry.ioc.ObjectProvider; import org.apache.tapestry.ioc.annotations.Inject; import org.apache.tapestry.ioc.annotations.InjectService; import org.apache.tapestry.ioc.services.TypeCoercer; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringObjectProvider implements ObjectProvider { private TypeCoercer typeCoercer; private ApplicationContext context; private static final Logger logger = Logger.getLogger(SpringObjectProvider.class.getName()); public SpringObjectProvider(@InjectService(TypeCoercer) TypeCoercer typeCoercer) { this.typeCoercer = typeCoercer; } /** * @see org.apache.tapestry.ioc.ObjectProvider#provide(java.lang.Class, * org.apache.tapestry.ioc.AnnotationProvider, * org.apache.tapestry.ioc.ObjectLocator) */ public T T provide(ClassT objectType, AnnotationProvider annotationProvider, ObjectLocator locator) { //hack... if (objectType.getName().startsWith(org.apache.tapestry)) { return null; } Inject annotation = annotationProvider.getAnnotation(Inject.class); if (annotation == null) return null; Object obj = null; try { String[] beanNames = getSpringContext().getBeanNamesForType(objectType); if(beanNames.length 0) { //return first result obj = getSpringContext().getBean(beanNames[0]); } else { logger.info(Couldn't find a bean for type + objectType.getName()); } } catch (Exception e) { logger.log(Level.WARNING, Problem occurred when finding a bean for type + objectType.getName(), e); } T coerced = typeCoercer.coerce(obj, objectType); return coerced; } private ApplicationContext getSpringContext() { if (context == null) { context = new ClassPathXmlApplicationContext( new String[] { test-applicationContext.xml }); } return context; } }
RE: T5: Anyone using PageTester?
Using it and loving it. So great to be able to unit test the user interface in a mock container. I've tried to answer most of the posts in this forum about it. Seems like other people are using it... -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 05, 2007 2:56 PM To: Tapestry users Subject: T5: Anyone using PageTester? PageTester, Kent Tong's unit/integration testing layer for T5, is increasingly becoming difficult to maintain properly ... how many people are currently relying on it? -- Howard M. Lewis Ship TWD Consulting, Inc. Creator Apache Tapestry and Apache HiveMind - 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] PageTester tapestry-spring
Mark, Take a gander at this thread and see if it answers any of your questions: http://www.nabble.com/Using-PageTester-with-tapestry-spring-tf4508561.ht ml Let me know if you have any questions... Joel -Original Message- From: Mark Horn [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 28, 2007 10:55 AM To: users@tapestry.apache.org Subject: [T5] PageTester tapestry-spring I am using tapestry-spring to inject spring beans into my tapestry page classes, and would like to use PageTester to unit test the pages. I have reviewed the Unit Test documentation but don't see a way to get access to these beans. Can anyone offer a suggestion? [note: I have also reviewed the pages at http://wiki.apache.org/tapestry/Tapestry5SpringIntegration but can't see how these help] a simple example page class looks like: public class Products { @Inject private IProductService _service; public List getProducts() { return _service.getProducts(); } } where IProductService is a spring bean. I'm using the filter filter-nameapp/filter-name !-- Special filter that adds in a T5 IoC module derived from the Spring WebApplicationContext. -- filter-class org.apache.tapestry.spring.TapestrySpringFilter /filter-class /filter in my actual web application which provides access to the beans great.. but how do I do the same thing w/ PageTester? Thanks, -Mark - 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: The Mysteries of the ValidationTracker and the fields it decides to keep values for
Hello all, The Tapestry 5 doc on Input Validation ( http://tapestry.apache.org/tapestry5/tapestry-core/guide/validation.html ) states: Likewise, the individual fields updated by the components should also be persistent. I'm not using the @Persist annotation on any fields (but let's get past that for a second). For some reason all t:textFields still automatically retain their values upon failed validation as long as the t:validate attribute is included! I'm assuming this is because the ValidationTracker (which is persisted automatically by Tapestry) stores and re-binds the values of the text fields. I'm not too concerned with that though. My real question is this: Why only for t:textFields? For all other components (t:selects, t:dateFields, t:checkboxs, etc.) the values disappear. In the future will the values for these other components eventually be recorded and re-bound via the ValidationTracker as well? I'm just looking for consistent behavior. Should I log a JIRA issue? Thanks for any thoughts, Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: testing T5
FWIW, I haven't had any problems with TestNG, but I've been using a suite.xml. I would recommend trying that because it gives you some nice flexibility (like parameterizing your tests, grouping your tests, etc.). Documentation for using a suite XML in the POM can be found here: http://maven.apache.org/plugins/maven-surefire-plugin/ In any case, this thread doesn't have much to do with Tapestry anymore, so it probably belongs in the Maven user group... -Original Message- From: Chris Lewis [mailto:[EMAIL PROTECTED] Sent: Saturday, November 17, 2007 4:51 AM To: Tapestry users Subject: Re: T5: testing T5 Ok first things first. I made the following test: package net.godcode.t5c; import org.testng.annotations.Test; public class TestForTest { @Test public void aTest() { } } It does nothing and lives in src/test/java - this should be all I need to run a test right? If I run just this from eclipse, it passes ok. If I run mvn test, I still get the output: Running net.godcode.t5c.TestForTest Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec Running net.godcode.t5c.integration.pagelevel.rendering.pages.TestSlideShow Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.006 sec Running net.godcode.t5c.integration.pagelevel.SlideShowTest Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 I don't know why its finding test classes but not tests. The classes are probably being found by mvn b/c they live in the default hierarchy. They are annotated w/ @Test, but its like they aren't being registered as tests!? Joel Wiegman wrote: I've got the PageTester, and well as integration test (tapestry-test) functionality working with my web-app. Not too difficult but there were some hoops to jump through. First of all, you may want to check out this thread: http://www.nabble.com/Junit-4-or-TestNG-5-suite-support-tf4647280s177. ht ml Maven's Surefire plug-in doesn't support suite functionality of either Junit 4 or TestNG 5. So if you want integration tests you may have to use something similar to the Ant script that I posted. I think Howard worked around this by posting all of his tests in one monolithic class (his AbstractIntegrationTestSuite class uses the @BeforeClass and @AfterClass annotations, not @BeforeSuite and @AfterSuite): http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/sr c/ test/java/org/apache/tapestry/integration/IntegrationTests.java?view=m ar kup So I guess my advice would be to eliminate the Tapestry/PageTester from the equation altogether... Make sure Maven is able to find a basic simple test first. Another thread of mine that may be useful: http://www.nabble.com/Using-PageTester-with-tapestry-spring-tf4508561. ht ml Hope that helps, Joel -Original Message- From: Chris Lewis [mailto:[EMAIL PROTECTED] Sent: Friday, November 16, 2007 3:32 PM To: Tapestry users Subject: Re: T5: testing T5 Ok I retract part of that. I see this output in mvn test now: --- T E S T S --- Running net.godcode.t5c.integration.pagelevel.rendering.pages.TestSlideShow Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 sec Running net.godcode.t5c.integration.pagelevel.SlideShowTest Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 It seems to run, but still says that 0 tests ran If I run from eclipse I get a different exception: FAILED: testEffects java.lang.NoClassDefFoundError: javax/servlet/ServletContext .. .. I want to get a test suite together, and among other things, test for JS errors (via selenium). If anyone can point out my errors I;d be very grateful. sincerely, chris Chris Lewis wrote: I've started working on testing my components using the PageTester, partially based on the site docs and partially on the T5 source. I have a test method as follows, which mirrors how the FormTest in T5 works: @Test public void testEffects() { String appPackage = net.godcode.t5c.integration.pagelevel.rendering; String appName = ; tester = new PageTester(appPackage, appName); Document doc = tester.renderPage(TestSlideShow); } The page template for TestSlideShow uses my component like so: html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; body div t:type=gc/slideshow interval=3 divslide one/div divsecond one/div divthird one/div /div /body /html I have two issues. First, when run by mvn test, no test gets run. Second, I am able to run it through eclipse using a TestNG run config, but the test fails
RE: T5: testing software?
Anything wrong with the one that ships with T5? http://tapestry.apache.org/tapestry5/tapestry-test/ Unforutnately, it's hard-coded that you have to use Firefox for your testing (or is that 'fortunately'?), but I've been using it and it works great. -Original Message- From: Angelo Chen [mailto:[EMAIL PROTECTED] Sent: Friday, November 09, 2007 6:03 PM To: users@tapestry.apache.org Subject: T5: testing software? Hi, I'm looking for a software to automate web page testing, any good one for T5? Thanks. A.C. -- View this message in context: http://www.nabble.com/T5%3A-testing-software--tf4780586.html#a13676799 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 Error in 5.0.5 palette.js
Just tacking onto the thread that a patch is available for the problem discussed in this thread: https://issues.apache.org/jira/browse/TAPESTRY-1745 Seems like a pretty unintrusive fix... Anxiously awaiting for a committer to test and include... Howard Lewis Ship wrote: Please add this as an issue in JIRA if you have not done so already. On 8/28/07, Daniel Jue [EMAIL PROTECTED] wrote: When using the Palette component, I am getting a Javascript error in IE, Line: 183 Char: 1 Error: Expected identifier, string or number Code: 0 reorderSelected : function(movers, before) { movers.each (function(option) { this.selected.add(option, before); }.bind(this)); this.updateHidden(); this.updateButtons(); }, }; Line 183 is the line after the }; I think the extra comma after the end of the reorderSelected code block is to blame. For me it was causing an error in IE6 which prevented me from using the select button in the Palette. I removed the extra comma, but then when I highlight some items and click the select button, I get a Type Mismatch error on the comma at the end of this function: moveOption : function(option, to, atEnd) { var before = null; if (!atEnd) { var optionOrder = this.valueToOrderIndex[option.value]; var candidate = $A(to.options).find(function (o) { return this.valueToOrderIndex[o.value] optionOrder; }.bind(this)); if (candidate) before = candidate; } to.add(option, before); }, Is the T5 Palette working fine for anyone using IE? The IE Version I am testing is 6.0.2900.2180.xpsp_sp2_gdr.070227-2254 Everything works fine in Firefox, of course. -- Howard M. Lewis Ship Partner and Senior Architect at Feature50 Creator Apache Tapestry and Apache HiveMind -- View this message in context: http://www.nabble.com/T5-Error-in-5.0.5-palette.js-tf4344484.html#a13042126 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: Using PageTester with tapestry-spring
) at org.apache.tapestry.ioc.internal.ServiceBuilderMethodInvoker.createObject( ServiceBuilderMethodInvoker.java:75) ... 64 more Caused by: java.lang.UnsupportedOperationException: getAttribute() is not supported for ContextForPageTester. at org.apache.tapestry.internal.test.PageTesterContext.getAttribute( PageTesterContext.java:61) at $Context_1154558bccc.getAttribute($Context_1154558bccc.java) at $Context_1154558bccb.getAttribute($Context_1154558bccb.java) at cn.crc.spring.SpringModule.build(SpringModule.java:36) ... 69 more ... Removed 26 stack frames 2007/9/26, Joel Wiegman [EMAIL PROTECTED]: What's basically happening here is: The application module you are passing to your PageTester (via the String appName argument) does not load your Spring context. In the alternative Spring integration link you provided this string would be Spring, assuming the class is named SpringModule and that it exists in your app.services package. Hope that helps. -Original Message- From: Doublel [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 25, 2007 8:06 PM To: Tapestry users Subject: Re: Using PageTester with tapestry-spring My Application use spring2+tapestry5+hibernate3 ,it can work well in me IE or FF so,I want to use Unit Test with testNG .I followed http://tapestry.apache.org/tapestry5/tapestry-core/guide/unit-testing- pages.html configrate spring with http://wiki.apache.org/tapestry/Tapestry5SpringIntegration http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternative2 http://wiki.apache.org/tapestry/Tapestry5SpringIntegration I want to test a tapestry page, but I got Exception .IPublicDAO is my spring class in my tapestry page i use inject @Inject @SpringBean(IPublicDAO) private IPublicDAO dao; I didnot know wrong where I make. can anybody help me thanks a lot. Caused by: java.lang.RuntimeException: Error obtaining injected value for field cn.crc.pjblog.pages.BlogPostOne.pdao: No service implements the interface cn.crc.model.impl.IPublicDAO. at org.apache.tapestry.internal.services.InjectWorker.inject ( InjectWorker.java:84) at org.apache.tapestry.internal.services.InjectWorker.transform( InjectWorker.java:53) at $ComponentClassTransformWorker_114ba61b606.transform($ComponentClassTr ansformWorker_114ba61b606.java) at $ComponentClassTransformWorker_114ba61b603.transform($ComponentClassTr ansformWorker_114ba61b603.java) at org.apache.tapestry.internal.services.ComponentClassTransformerImpl.tr ansformComponentClass (ComponentClassTransformerImpl.java :131) ... 48 more Caused by: java.lang.RuntimeException: No service implements the interface cn.crc.model.impl.IPublicDAO. at org.apache.tapestry.ioc.internal.RegistryImpl.getService( RegistryImpl.java:447) at org.apache.tapestry.ioc.internal.ObjectLocatorImpl.getService( ObjectLocatorImpl.java:45) at org.apache.tapestry.ioc.services.TapestryIOCModule$2.provide( TapestryIOCModule.java:132) at $ObjectProvider_114ba61b5d4.provide($ObjectProvider_114ba61b5d4.java) at $ObjectProvider_114ba61b5ce.provide($ObjectProvider_114ba61b5ce.java) at org.apache.tapestry.internal.services.InjectWorker.inject( InjectWorker.java:80) ... 52 more ... Removed 22 stack frames 2007/9/25, Joel Wiegman [EMAIL PROTECTED]: Sure... what questions do you have? I'd rather not write 8 paragraphs and still not answer your questions... -Original Message- From: Doublel [mailto:[EMAIL PROTECTED] Sent: Monday, September 24, 2007 7:59 PM To: Tapestry users Subject: Re: Using PageTester with tapestry-spring I run into the same problem I use http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternativ e2 Can you explain more detail?? 2007/9/24, Joel Wiegman [EMAIL PROTECTED]: Ivan, I'm using PageTester with Spring integration, but you'll have to jump through a few small hoops to accomplish this. I've written a TestHarnessModule in my app dir.services directory. This module contributes the Spring services manually. My code looks very similar to what's found here: http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternat iv e1 Then, you can pass in the name of the module to your PageTester: PageTester pageTester= new PageTester(com.myapp.dir, TestHarness); IMHO, what's really neat about this is you can point your tests to a different Spring configuration that uses mocked objects, mock databases, etc. This is what we're doing and it has worked very well. Hope this helps, Joel -Original Message- From: Ivan Dubrov [mailto:[EMAIL PROTECTED] Sent: Monday, September 24, 2007 7:14 AM To: Tapestry users Subject: Using PageTester with tapestry-spring Hi, How can I use the PageTester with the Spring integration? The problem is that when PageTester creates the registry it does not adds SpringModuleDef
RE: Using PageTester with tapestry-spring
What's basically happening here is: The application module you are passing to your PageTester (via the String appName argument) does not load your Spring context. In the alternative Spring integration link you provided this string would be Spring, assuming the class is named SpringModule and that it exists in your app.services package. Hope that helps. -Original Message- From: Doublel [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 25, 2007 8:06 PM To: Tapestry users Subject: Re: Using PageTester with tapestry-spring My Application use spring2+tapestry5+hibernate3 ,it can work well in me IE or FF so,I want to use Unit Test with testNG .I followed http://tapestry.apache.org/tapestry5/tapestry-core/guide/unit-testing-pages.html configrate spring with http://wiki.apache.org/tapestry/Tapestry5SpringIntegration http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternative2 http://wiki.apache.org/tapestry/Tapestry5SpringIntegration I want to test a tapestry page, but I got Exception .IPublicDAO is my spring class in my tapestry page i use inject @Inject @SpringBean(IPublicDAO) private IPublicDAO dao; I didnot know wrong where I make. can anybody help me thanks a lot. Caused by: java.lang.RuntimeException: Error obtaining injected value for field cn.crc.pjblog.pages.BlogPostOne.pdao: No service implements the interface cn.crc.model.impl.IPublicDAO. at org.apache.tapestry.internal.services.InjectWorker.inject ( InjectWorker.java:84) at org.apache.tapestry.internal.services.InjectWorker.transform( InjectWorker.java:53) at $ComponentClassTransformWorker_114ba61b606.transform($ComponentClassTransformWorker_114ba61b606.java) at $ComponentClassTransformWorker_114ba61b603.transform($ComponentClassTransformWorker_114ba61b603.java) at org.apache.tapestry.internal.services.ComponentClassTransformerImpl.transformComponentClass (ComponentClassTransformerImpl.java :131) ... 48 more Caused by: java.lang.RuntimeException: No service implements the interface cn.crc.model.impl.IPublicDAO. at org.apache.tapestry.ioc.internal.RegistryImpl.getService( RegistryImpl.java:447) at org.apache.tapestry.ioc.internal.ObjectLocatorImpl.getService( ObjectLocatorImpl.java:45) at org.apache.tapestry.ioc.services.TapestryIOCModule$2.provide( TapestryIOCModule.java:132) at $ObjectProvider_114ba61b5d4.provide($ObjectProvider_114ba61b5d4.java) at $ObjectProvider_114ba61b5ce.provide($ObjectProvider_114ba61b5ce.java) at org.apache.tapestry.internal.services.InjectWorker.inject( InjectWorker.java:80) ... 52 more ... Removed 22 stack frames 2007/9/25, Joel Wiegman [EMAIL PROTECTED]: Sure... what questions do you have? I'd rather not write 8 paragraphs and still not answer your questions... -Original Message- From: Doublel [mailto:[EMAIL PROTECTED] Sent: Monday, September 24, 2007 7:59 PM To: Tapestry users Subject: Re: Using PageTester with tapestry-spring I run into the same problem I use http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternative2 Can you explain more detail?? 2007/9/24, Joel Wiegman [EMAIL PROTECTED]: Ivan, I'm using PageTester with Spring integration, but you'll have to jump through a few small hoops to accomplish this. I've written a TestHarnessModule in my app dir.services directory. This module contributes the Spring services manually. My code looks very similar to what's found here: http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternativ e1 Then, you can pass in the name of the module to your PageTester: PageTester pageTester= new PageTester(com.myapp.dir, TestHarness); IMHO, what's really neat about this is you can point your tests to a different Spring configuration that uses mocked objects, mock databases, etc. This is what we're doing and it has worked very well. Hope this helps, Joel -Original Message- From: Ivan Dubrov [mailto:[EMAIL PROTECTED] Sent: Monday, September 24, 2007 7:14 AM To: Tapestry users Subject: Using PageTester with tapestry-spring Hi, How can I use the PageTester with the Spring integration? The problem is that when PageTester creates the registry it does not adds SpringModuleDef to the list of modules and all my Spring services are unavailable because of this. Extending the PageTester is not possible as well, so I cannot extend it and provide additional module (like the TapestrySpringFilter does), so I have to copy-paste the complete PageTester and add a line to include SpringModuleDef module to the list. Are there any other ways that not include dumb copy-pasting? Just for clearness. How can I add an override to the services when running the tests? Creating AliasContribution's with the mode set to test, right? But what to do if I want to keep my primary module clear of test services and keep all my test services in the test module inside the src/test Maven2 hierarchy (so
T5: Event logging
One of my onPrepare() methods is getting called twice and I'm not sure where the second one is coming from. Anyone figured out a slick way of logging the events (action, prepare, submit, activate, validate, etc.) that Tapestry receives? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Event logging
Nothing overridden here... In this case, the page is submitting to itself, so I think onPrepare() being called twice is normal in that situation... once to process the form submission (before the onSuccess()) and once when a new request is made to render the page again. Nonetheless, I've spent time in the past trying to figure out what events are firing and which components are firing the events. Any logging / module decorations available for that? -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 26, 2007 1:30 PM To: Tapestry users Subject: Re: T5: Event logging There's a bit of ambiguity going on w.r.t. event handler methods that are overridden in a subclass. Is this the case? On 9/26/07, Joel Wiegman [EMAIL PROTECTED] wrote: One of my onPrepare() methods is getting called twice and I'm not sure where the second one is coming from. Anyone figured out a slick way of logging the events (action, prepare, submit, activate, validate, etc.) that Tapestry receives? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship Partner and Senior Architect at Feature50 Creator Apache Tapestry and Apache HiveMind - 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: Using PageTester with tapestry-spring
Sure... what questions do you have? I'd rather not write 8 paragraphs and still not answer your questions... -Original Message- From: Doublel [mailto:[EMAIL PROTECTED] Sent: Monday, September 24, 2007 7:59 PM To: Tapestry users Subject: Re: Using PageTester with tapestry-spring I run into the same problem I use http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternative2 Can you explain more detail?? 2007/9/24, Joel Wiegman [EMAIL PROTECTED]: Ivan, I'm using PageTester with Spring integration, but you'll have to jump through a few small hoops to accomplish this. I've written a TestHarnessModule in my app dir.services directory. This module contributes the Spring services manually. My code looks very similar to what's found here: http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternative1 Then, you can pass in the name of the module to your PageTester: PageTester pageTester= new PageTester(com.myapp.dir, TestHarness); IMHO, what's really neat about this is you can point your tests to a different Spring configuration that uses mocked objects, mock databases, etc. This is what we're doing and it has worked very well. Hope this helps, Joel -Original Message- From: Ivan Dubrov [mailto:[EMAIL PROTECTED] Sent: Monday, September 24, 2007 7:14 AM To: Tapestry users Subject: Using PageTester with tapestry-spring Hi, How can I use the PageTester with the Spring integration? The problem is that when PageTester creates the registry it does not adds SpringModuleDef to the list of modules and all my Spring services are unavailable because of this. Extending the PageTester is not possible as well, so I cannot extend it and provide additional module (like the TapestrySpringFilter does), so I have to copy-paste the complete PageTester and add a line to include SpringModuleDef module to the list. Are there any other ways that not include dumb copy-pasting? Just for clearness. How can I add an override to the services when running the tests? Creating AliasContribution's with the mode set to test, right? But what to do if I want to keep my primary module clear of test services and keep all my test services in the test module inside the src/test Maven2 hierarchy (so they even aren't included in the release build)? -- WBR, Ivan S. Dubrov - 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: Using PageTester with tapestry-spring
Ivan, I'm using PageTester with Spring integration, but you'll have to jump through a few small hoops to accomplish this. I've written a TestHarnessModule in my app dir.services directory. This module contributes the Spring services manually. My code looks very similar to what's found here: http://wiki.apache.org/tapestry/Tapestry5SpringIntegrationAlternative1 Then, you can pass in the name of the module to your PageTester: PageTester pageTester= new PageTester(com.myapp.dir, TestHarness); IMHO, what's really neat about this is you can point your tests to a different Spring configuration that uses mocked objects, mock databases, etc. This is what we're doing and it has worked very well. Hope this helps, Joel -Original Message- From: Ivan Dubrov [mailto:[EMAIL PROTECTED] Sent: Monday, September 24, 2007 7:14 AM To: Tapestry users Subject: Using PageTester with tapestry-spring Hi, How can I use the PageTester with the Spring integration? The problem is that when PageTester creates the registry it does not adds SpringModuleDef to the list of modules and all my Spring services are unavailable because of this. Extending the PageTester is not possible as well, so I cannot extend it and provide additional module (like the TapestrySpringFilter does), so I have to copy-paste the complete PageTester and add a line to include SpringModuleDef module to the list. Are there any other ways that not include dumb copy-pasting? Just for clearness. How can I add an override to the services when running the tests? Creating AliasContribution's with the mode set to test, right? But what to do if I want to keep my primary module clear of test services and keep all my test services in the test module inside the src/test Maven2 hierarchy (so they even aren't included in the release build)? -- WBR, Ivan S. Dubrov - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 Error in 5.0.5 palette.js
Did anyone find a workaround for this? Is there a JIRA defect for it? As much as I like Firefox, Internet Explorer is unfortunately the browser of choice still. Shame that the palette doesn't work with it. Daniel Jue wrote: When using the Palette component, I am getting a Javascript error in IE, Line: 183 Char: 1 Error: Expected identifier, string or number Code: 0 reorderSelected : function(movers, before) { movers.each (function(option) { this.selected.add(option, before); }.bind(this)); this.updateHidden(); this.updateButtons(); }, }; Line 183 is the line after the }; I think the extra comma after the end of the reorderSelected code block is to blame. For me it was causing an error in IE6 which prevented me from using the select button in the Palette. I removed the extra comma, but then when I highlight some items and click the select button, I get a Type Mismatch error on the comma at the end of this function: moveOption : function(option, to, atEnd) { var before = null; if (!atEnd) { var optionOrder = this.valueToOrderIndex[option.value]; var candidate = $A(to.options).find(function (o) { return this.valueToOrderIndex[o.value] optionOrder; }.bind(this)); if (candidate) before = candidate; } to.add(option, before); }, Is the T5 Palette working fine for anyone using IE? The IE Version I am testing is 6.0.2900.2180.xpsp_sp2_gdr.070227-2254 Everything works fine in Firefox, of course. -- View this message in context: http://www.nabble.com/T5-Error-in-5.0.5-palette.js-tf4344484.html#a12618996 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: Activation contexts
I'm actually seeing the behavior Marcus is referring to, where all possible matches are applied in a specific order (In my previous post, I was only trying the 3-arg method). Either way, it's not really that much of an inconvenience. As long as the behavior is predictable I can code accordingly. -Original Message- From: Nick Westgate (Work) [mailto:[EMAIL PROTECTED] Sent: Saturday, September 01, 2007 10:02 PM To: users@tapestry.apache.org Subject: Re: T5: Activation contexts It _shouldn't_ change anything, but I'm wondering why Joel is seeing different behaviour, and trying to find out if there is a problem. I studied this problem a few months ago, looked at the source code (and the Javassist generated source code) and I'm not happy with the current implementation or Howard's proposed solution unless there's more control over multiple event method calls. Short-circuiting for example. And I read Howard's blog. My comment on that post is right before yours. Although your comment was on topic, you might want to read this: http://tapestryjava.blogspot.com/2005/10/blogs-arent-for-support.html Cheers, Nick. Marcus-11 wrote: NIck, When a single method is overloaded with different parameters, the order of invocation is fewest parameters to most parameters. commented by Howard at (https://www.blogger.com/comment.g?blogID=4110180postID=7231241573208 214842 ) So, reversing the order of methods don't should change anything. Anyway, T5 should call only those methods that matches, and onActivate(), with no parameters, first. Marcus -- View this message in context: http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12445691 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: Activation contexts
Actually, it's not! Surprised I didn't think of this before my post, but all you need to do is overload the methods: public void onActivate(Integer number1, Integer number2, Integer number3) { System.out.println(Activated with + number1 + + number2 + + number3); } public void onActivate(Integer number1, Integer number2) { System.out.println(Activated with + number1 + + number2); } You can't make the values limitless, but as you can see from above, you can definitely make them optional! -Original Message- From: Nick Westgate [mailto:[EMAIL PROTECTED] Sent: Thursday, August 30, 2007 10:23 PM To: Tapestry users Subject: Re: T5: Activation contexts That is in fact the only option for now. Cheers, Nick. Josh Canfield wrote: In situations where I have had optional parameters I've ended up using an Object[] as the argument and figuring out what the values mean myself. public Object onActivate(Object[] context) { } I haven't looked closely enough at the code to determine if there is a better option. Josh On 8/30/07, Joel Wiegman [EMAIL PROTECTED] wrote: Hello all, I'm wondering if anyone has had any luck making the activation contexts of pages a little more flexible. For example, let's say I have a Sum.java page that wants to take in between 1 and 4 Integers and add them together: //is there a way to make number3 and number4 optional? Seems like Tapestry forces me to provide values for all 4 numbers. public void onActivate(Integer number1, Integer number2, Integer number3, Integer number4) //Or even make the values limitless? public void onActivate(Integer... numbers) Kind of a contrived example, but hopefully you see where I'm going with it. Anyone had any luck with making context parameters optional or limitless? Thanks, Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Activation contexts
Hrm... are you sure? I only see the correct one being called. -Original Message- From: Nick Westgate (Work) [mailto:[EMAIL PROTECTED] Sent: Friday, August 31, 2007 1:56 PM To: users@tapestry.apache.org Subject: RE: T5: Activation contexts Did you examine your log output? For: http://localhost:8080/myapp/Start/1/2/3 You'll see: Activated with 1 2 _and_ Activated with 1 2 3 If you add a no argument onActivate() that will also be called. Object[] is the best solution right now for multiple parameters. http://issues.apache.org/jira/browse/TAPESTRY-1695 Cheers, Nick. Joel Wiegman wrote: Actually, it's not! Surprised I didn't think of this before my post, but all you need to do is overload the methods: public void onActivate(Integer number1, Integer number2, Integer number3) { System.out.println(Activated with + number1 + + number2 + + number3); } public void onActivate(Integer number1, Integer number2) { System.out.println(Activated with + number1 + + number2); } You can't make the values limitless, but as you can see from above, you can definitely make them optional! -Original Message- From: Nick Westgate [mailto:[EMAIL PROTECTED] Sent: Thursday, August 30, 2007 10:23 PM To: Tapestry users Subject: Re: T5: Activation contexts That is in fact the only option for now. Cheers, Nick. Josh Canfield wrote: In situations where I have had optional parameters I've ended up using an Object[] as the argument and figuring out what the values mean myself. public Object onActivate(Object[] context) { } I haven't looked closely enough at the code to determine if there is a better option. Josh On 8/30/07, Joel Wiegman [EMAIL PROTECTED] wrote: Hello all, I'm wondering if anyone has had any luck making the activation contexts of pages a little more flexible. For example, let's say I have a Sum.java page that wants to take in between 1 and 4 Integers and add them together: //is there a way to make number3 and number4 optional? Seems like Tapestry forces me to provide values for all 4 numbers. public void onActivate(Integer number1, Integer number2, Integer number3, Integer number4) //Or even make the values limitless? public void onActivate(Integer... numbers) Kind of a contrived example, but hopefully you see where I'm going with it. Anyone had any luck with making context parameters optional or limitless? Thanks, Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-Activation-contexts-tf4356640.html#a12431309 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]
T5: Activation contexts
Hello all, I'm wondering if anyone has had any luck making the activation contexts of pages a little more flexible. For example, let's say I have a Sum.java page that wants to take in between 1 and 4 Integers and add them together: //is there a way to make number3 and number4 optional? Seems like Tapestry forces me to provide values for all 4 numbers. public void onActivate(Integer number1, Integer number2, Integer number3, Integer number4) //Or even make the values limitless? public void onActivate(Integer... numbers) Kind of a contrived example, but hopefully you see where I'm going with it. Anyone had any luck with making context parameters optional or limitless? Thanks, Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5 on JDK 1.6 or newer
Hrm... I've been running a reasonably robust production app on T5.05 and JDK 1.6 and haven't seen any hangs. I develop on Jetty but deploy to SJSAS, which runs Catalina (Tomcat's servlet container). Production is Linux and development is Windows. I also have 92 integration tests and unit tests that use the Tapestry-provided testing tools and haven't experienced any problems there either. Can you be more specific with the problem? Also, I think I've been to your blog... my good friend Josh Hicks sent me there one day when I was trying to decide if Tapestry a good choice for a UI framework. :-) -Original Message- From: Stephan Schwab [mailto:[EMAIL PROTECTED] Sent: Friday, August 24, 2007 1:01 PM To: users@tapestry.apache.org Subject: T5 on JDK 1.6 or newer We've been experiencing strange behaviour of our now growing application Savila and as well with another project we are working on. Both use Tapestry 5.0.5. Our development machines run with Mac OS X and we use JDK 1.5 that comes with it. We deploy to Linux with Sun's JDK 1.6 and Tomcat 6.0.10. Our application Savila ran fine on JDK 1.6 with Tapestry 5.x until last week when we started to experience hangs. It seems that Tomcat accepts the request, then our and Tapestry's code do something, but it never finishes. When we hit the stop button in the browser and look at the HTML we can see that it's all there. I'm not talking about form submissions, but regular pages. This behaviour either starts after the app has been idle for some time or in the middle of user actions. There is no load - just one user active. With a significantly smaller application we see the same behaviour. Two days ago we switched to Sun JDK 1.5 for our large application and since then there are no more hangs. There was a report here on the mailinglist about trouble with a javassist and using a pre-release 3.6.0.CR1. At least on the Mac with the pre-release JDK 1.6 that didn't not really solve the problem. It just shows up later. At the moment I feel that Tapestry 5.0.5 requires JDK 1.5. Stephan -- View this message in context: http://www.nabble.com/T5-on-JDK-1.6-or-newer-tf4324659.html#a12316191 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]
T5: How do I set a property on a parent component?
All, The subject pretty much says it all, but the only way I've found to get a reference to the parent component is by injecting ComponentResources and calling getContainer(). Unfortunately (for my situation), this doesn't hand me back an Object that I can cast and set properties on. Anyone have any ideas? I couldn't find an example of this in the component documentation. Thanks, Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Can't use any page name but Start
Figured this one out. I've been developing with my pages in src/main/webapp/WEB-INF/ and my components in src/main/resources. After switching my pages over to src/main/resources (as the Tapestry site instructs) I was able to effectively rename my pages to something other than Start. I don't have the intricate knowledge of Tapestry to provide a logical explanation. I just went back and verified my configuration with the Tapestry website. -Original Message- From: Alexandru Dragomir [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 13, 2007 6:22 PM To: Tapestry users Subject: Re: T5: Can't use any page name but Start I made a small test and it works . Should be fine with these files: com.my.package.root.pages.Start.java com.my.package.root.pages.admin.Test.java com.my.package.root.component.Messages.java WEB-INF/Start.html WEB-INF/admin/Test.html Both Start.html and Test.html contain the tag t:messages/ With both links /root/start and /root/admin/test works for me. Alex On 6/13/07, Joel Wiegman [EMAIL PROTECTED] wrote: Thanks for the response Alexandru. Yeah, it's all in the correct spot (keep in mind I just renamed an already-working file). My ViewStatus.html is: html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; body t:messages/ /body /html -Original Message- From: Alexandru Dragomir [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 13, 2007 12:39 PM To: Tapestry users Subject: Re: T5: Can't use any page name but Start I can think about the following : - you must have the messages declared in the html file too - make sure the html is in the right place http://tapestry.apache.org/tapestry5/tapestry-core/guide/templates.htm l - Template Location Hope it helps. Alex On 6/13/07, Joel Wiegman [EMAIL PROTECTED] wrote: All, I have an HTML file and Java file that functions perfectly with the following structure: /status/Start When I rename the HTML and Java file to something more meaningful, like: /status/ViewStatus Run a clean build and load the page, none of my embedded components are found anymore: Component com.btservices.storeportal.web.pages.status.ViewStatus does not contain an embedded component with id 'messages'. My java file, of course, has a messages component in it: package com.btservices.storeportal.web.pages.status; import com.btservices.storeportal.web.components.Messages; public class ViewStatus { @Component private Messages messages; } Completely confused! Anyone know why this would be happening? Thanks, Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Can't use any page name but Start
All, I have an HTML file and Java file that functions perfectly with the following structure: /status/Start When I rename the HTML and Java file to something more meaningful, like: /status/ViewStatus Run a clean build and load the page, none of my embedded components are found anymore: Component com.btservices.storeportal.web.pages.status.ViewStatus does not contain an embedded component with id 'messages'. My java file, of course, has a messages component in it: package com.btservices.storeportal.web.pages.status; import com.btservices.storeportal.web.components.Messages; public class ViewStatus { @Component private Messages messages; } Completely confused! Anyone know why this would be happening? Thanks, Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Can't use any page name but Start
Thanks for the response Alexandru. Yeah, it's all in the correct spot (keep in mind I just renamed an already-working file). My ViewStatus.html is: html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; body t:messages/ /body /html -Original Message- From: Alexandru Dragomir [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 13, 2007 12:39 PM To: Tapestry users Subject: Re: T5: Can't use any page name but Start I can think about the following : - you must have the messages declared in the html file too - make sure the html is in the right place http://tapestry.apache.org/tapestry5/tapestry-core/guide/templates.html - Template Location Hope it helps. Alex On 6/13/07, Joel Wiegman [EMAIL PROTECTED] wrote: All, I have an HTML file and Java file that functions perfectly with the following structure: /status/Start When I rename the HTML and Java file to something more meaningful, like: /status/ViewStatus Run a clean build and load the page, none of my embedded components are found anymore: Component com.btservices.storeportal.web.pages.status.ViewStatus does not contain an embedded component with id 'messages'. My java file, of course, has a messages component in it: package com.btservices.storeportal.web.pages.status; import com.btservices.storeportal.web.components.Messages; public class ViewStatus { @Component private Messages messages; } Completely confused! Anyone know why this would be happening? Thanks, Joel - 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: Swapping out Spring definitions
Hello all, During the execution of our end-to-end (out-of-container) unit tests, I'd like to load my service definitions as mock objects from Spring configuration files that are different from the ones defined in my container (web.xml file). Believe it or not, the Tapestry PageTester class has a hooks in there to do this. You pass in the appropriate appName argument (say testHarness) and then define the module class app-package.services.TestHarnessModule, where you're allowed to configure your services. I've figured out how to spot-override services (via the contributeAlias method), but for my unit tests I'd really just like to create the service registry from scratch using a batch of mock object Spring configuration files. Can anyone out there get me started on this path? Perhaps point me to the correct hook(s)/method name(s) to build this service registry in the module? Thanks! Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Testing - PageTester reworked... How do I use mock services now?
Otho, Any chance you could share an example of this with the community? I'm having a hard time finding an example on the T5 website. Thanks! Joel -Original Message- From: Otho [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 29, 2007 4:36 AM To: Tapestry users Subject: Re: T5: Testing - PageTester reworked... How do I use mock services now? Thanks for the answer, works perfectly now. 2007/5/28, Howard Lewis Ship [EMAIL PROTECTED]: It's a good point. What you need to do is define a module that defines your mock services, and contributes overrides into the Alias or AliasOverride service configuration, such that your mock services are used instead of the normal ones. You can specify the additional module classes when creating the page tester. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: PageTester failure
In a TestNG test, I'm calling: Document doc = tester.renderPage(status/Start); //IMPORTANT NOTE: This URL renders without error in a browser This page renders a few components, and appears to be complaining about one of them (the StoreHierarchy component). I'm using the Spring IoC and am not over-riding any services yet. The call to renderPage fails with the exception: Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.359 sec FAILURE! testStoreHierarchy(com.btservices.storeportal.pages.status.TestStart) Time elapsed: 0.766 sec FAILURE! org.apache.tapestry.ioc.internal.util.TapestryException: java.lang.ClassNotFoundException: caught an exception while obtaining a class file for com.btservices.storeportal.components.StoreHierarchy [at context:WEB-INF/status/Start.html, line 5, column 21] at org.apache.tapestry.internal.services.PageElementFactoryImpl.newComponen tElement(PageElementFactoryImpl.java:294) at $PageElementFactory_112f820fd98.newComponentElement($PageElementFactory_ 112f820fd98.java) at org.apache.tapestry.internal.services.PageLoaderProcessor.startComponent (PageLoaderProcessor.java:624) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadTemplateFo rComponent(PageLoaderProcessor.java:496) at org.apache.tapestry.internal.services.PageLoaderProcessor.workComponentQ ueue(PageLoaderProcessor.java:720) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadPage(PageL oaderProcessor.java:393) at org.apache.tapestry.internal.services.PageLoaderImpl.loadPage(PageLoader Impl.java:59) at $PageLoader_112f820fd96.loadPage($PageLoader_112f820fd96.java) at org.apache.tapestry.internal.services.PagePoolImpl.checkout(PagePoolImpl .java:63) at $PagePool_112f820fd8c.checkout($PagePool_112f820fd8c.java) at org.apache.tapestry.internal.services.RequestPageCacheImpl.getByClassNam e(RequestPageCacheImpl.java:58) at org.apache.tapestry.internal.services.RequestPageCacheImpl.get(RequestPa geCacheImpl.java:49) at $RequestPageCache_112f820fd86.get($RequestPageCache_112f820fd86.java) at $RequestPageCache_112f820fd85.get($RequestPageCache_112f820fd85.java) at org.apache.tapestry.internal.services.PageLinkHandlerImpl.handle(PageLin kHandlerImpl.java:57) at $PageLinkHandler_112f820fd7c.handle($PageLinkHandler_112f820fd7c.java) at org.apache.tapestry.internal.test.PageLinkInvoker.invoke(PageLinkInvoker .java:61) at org.apache.tapestry.test.PageTester.invoke(PageTester.java:184) at org.apache.tapestry.test.PageTester.renderPage(PageTester.java:144) at com.btservices.storeportal.pages.status.TestStart.testStoreHierarchy(Tes tStart.java:111) Please advise! Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Testing - PageTester reworked... How do I use mock services now?
You can specify the additional module classes when creating the page tester. Howard, could you go into a little more detail here? I didn't see a constructor arg or a method on PageTester for specifying additional modules. -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Sunday, May 27, 2007 7:28 PM To: Tapestry users Subject: Re: T5: Testing - PageTester reworked... How do I use mock services now? It's a good point. What you need to do is define a module that defines your mock services, and contributes overrides into the Alias or AliasOverride service configuration, such that your mock services are used instead of the normal ones. You can specify the additional module classes when creating the page tester. On 5/27/07, Otho [EMAIL PROTECTED] wrote: Hi all! I followed the TestNG example with service replacements on the Tapestry home page only to find out that PageTester was reworked and now doesn't support a map with replacements anymore. I was unable to find any documentation in the changelogs or the mailinglist about why this was changed and how to use mock services with a PageTester right now. Start page depends on a spring service and this doesn't get injected automatically. So if I want to test it I have to somehow inject a Mock in there, or did I get something wrong? Regards, Otho -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Works in Jetty but not in Tomcat
My application is working fine in Jetty but not in Tomcat. I've already followed the deployment instructions found here ( http://tapestry.apache.org/tapestry5/tomcat.html ). I confirmed that my classes are being jarred up by Maven and put into the WEB-INF/lib directory. Using JDK 1.5.0_11, and Tomcat 6.0.13 (although I've seen the same issue on Tomcat 5). Appears to be a class-loading issue. Stack trace below. Any advice would be appreciated. SEVERE: Servlet.service() for servlet default threw exception java.lang.NoSuchMethodError: com.sun.org.apache.xerces.internal.parsers.XML11Configuration.getFeature 0(Ljava/lang/String;)Z at com.sun.org.apache.xerces.internal.parsers.XIncludeAwareParserConfigurat ion.getFeature(XIncludeAwareParserConfiguration.java:278) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.reset(Abstr actSAXParser.java:2098) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.jav a:147) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Abstr actSAXParser.java:1242) at org.apache.tapestry.internal.services.TemplateParserImpl.parseTemplate(T emplateParserImpl.java:173) at $TemplateParser_112ddb2276b.parseTemplate($TemplateParser_112ddb2276b.ja va) at $TemplateParser_112ddb22764.parseTemplate($TemplateParser_112ddb22764.ja va) at org.apache.tapestry.internal.services.ComponentTemplateSourceImpl.parseT emplate(ComponentTemplateSourceImpl.java:145) at org.apache.tapestry.internal.services.ComponentTemplateSourceImpl.getTem plate(ComponentTemplateSourceImpl.java:126) at $ComponentTemplateSource_112ddb22742.getTemplate($ComponentTemplateSourc e_112ddb22742.java) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadTemplateFo rComponent(PageLoaderProcessor.java:427) at org.apache.tapestry.internal.services.PageLoaderProcessor.workComponentQ ueue(PageLoaderProcessor.java:720) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadPage(PageL oaderProcessor.java:393) at org.apache.tapestry.internal.services.PageLoaderImpl.loadPage(PageLoader Impl.java:59) at $PageLoader_112ddb2275f.loadPage($PageLoader_112ddb2275f.java) at org.apache.tapestry.internal.services.PagePoolImpl.checkout(PagePoolImpl .java:63) at $PagePool_112ddb2275e.checkout($PagePool_112ddb2275e.java) at org.apache.tapestry.internal.services.RequestPageCacheImpl.getByClassNam e(RequestPageCacheImpl.java:58) at org.apache.tapestry.internal.services.RequestPageCacheImpl.get(RequestPa geCacheImpl.java:49) at $RequestPageCache_112ddb2275d.get($RequestPageCache_112ddb2275d.java) at $RequestPageCache_112ddb22738.get($RequestPageCache_112ddb22738.java) at org.apache.tapestry.internal.services.DefaultRequestExceptionHandler.han dleRequestException(DefaultRequestExceptionHandler.java:52) at $RequestExceptionHandler_112ddb2274d.handleRequestException($RequestExce ptionHandler_112ddb2274d.java) at org.apache.tapestry.services.TapestryModule$3.service(TapestryModule.jav a:645) at $RequestHandler_112ddb22750.service($RequestHandler_112ddb22750.java) at org.apache.tapestry.internal.services.StaticFilesFilter.service(StaticFi lesFilter.java:63) at $RequestHandler_112ddb22750.service($RequestHandler_112ddb22750.java) at org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(Che ckForUpdatesFilter.java:91) at org.apache.tapestry.internal.services.CheckForUpdatesFilter$2.invoke(Che ckForUpdatesFilter.java:82) at org.apache.tapestry.ioc.internal.util.ConcurrentBarrier.withRead(Concurr entBarrier.java:77) at org.apache.tapestry.internal.services.CheckForUpdatesFilter.service(Chec kForUpdatesFilter.java:104) at $RequestHandler_112ddb22750.service($RequestHandler_112ddb22750.java) at $RequestHandler_112ddb2274a.service($RequestHandler_112ddb2274a.java) at org.apache.tapestry.services.TapestryModule$11.service(TapestryModule.ja va:1014) at $HttpServletRequestHandler_112ddb22749.service($HttpServletRequestHandle r_112ddb22749.java) at org.apache.tapestry.TapestryFilter.doFilter(TapestryFilter.java:134) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:109) at
RE: T5: Works in Jetty but not in Tomcat
Marcus, Thanks for the reply. I've been able to get it to work with mvn tomcat:run and mvn jetty:run, but not by deploying the war to a separate instance of Tomcat. I'll keep at it. It's not looking like it's a Tapestry bug... it appears to be a classloading issue involving JAXP/Xerces. Cheers, Joel -Original Message- From: Marcus [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 30, 2007 1:55 PM To: Tapestry users Subject: Re: T5: Works in Jetty but not in Tomcat Hi, For us T5 works fine with Tomcat or Jetty. mvn tomcat:run (inside app dir) or build war file and deploy: mvn war:war (inside app dir, war will be in appdir/target) Marcus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Cobertura?
Jiri, I apologize, I've gotten sidetracked on this. Since Tapestry 5 is such a moving target right now, the error that appeared to be Cobertura-related went away and was replaced by a different Tapestry-related error. Right now I'm working around it by just not covering the classes involved when I run Cobertura. I'm subscribed to the cobertura-devel list as well. If it springs up again I'll post to that list. Cheers, Joel -Original Message- From: Jiri Mares [mailto:[EMAIL PROTECTED] Sent: Friday, May 25, 2007 7:09 AM To: Tapestry users Subject: Re: T5: Cobertura? Hi Joel, is there any problem with mine request? Thanks Jiri Mares napsal(a): Hi Joel, yes, the best way would be send me (can be directly to email) the source file, class file, instrumented class file by tapestry, instrumented file by cobertura and instrumented file by cobertura tapestry, if it is possible. And of course keep it as simple as possible. Thanks Joel Wiegman napsal(a): Jiri, I know one of the Cobertura problems involved here is related to this bug: http://jira.codehaus.org/browse/MCOBERTURA-57 Obviously, this is not Cobertura but the Cobertura plug-in that Maven uses. The other appears to be an instrumentation issue which I will let you and Howard work out. If you need a sample class file please let me know and I can provide one to you (both). Cheers! Joel -Original Message- From: Jiri Mares [mailto:[EMAIL PROTECTED] Sent: Monday, May 21, 2007 2:12 AM To: Tapestry users Subject: Re: T5: Cobertura? Hi Howard, I'm developing cobertura ... can you, please, give more information where the problem is to solve it ... or show me the way how to investigate, where it is ... Thanks Jirka Howard Lewis Ship napsal(a): Sorry if I was inexact; I'm shifting gears too constantly. On 5/17/07, Joel Wiegman [EMAIL PROTECTED] wrote: I think you mean the 1.7 version of Cobertura itself, not the plugin. Version 2.0 of the plugin (which is what I'm using) uses Cobertura version 1.7. So is this a Tapestry issue or a Cobertura issue (or even a plugin issue)? Lots of class instrumentation going on! -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Thursday, May 17, 2007 12:53 PM To: Tapestry users Subject: Re: T5: Cobertura? It could be the version; I've been sticking to the 1.7 version of the plugin as 1.8 doesn't work (at least, not for Tapestry apps). On 5/17/07, Joel Wiegman [EMAIL PROTECTED] wrote: Hello all, I'm using the Cobertura (via the Maven plug-in) to execute some web app coverage tests. I'm seeing the T5 PageTester unit tests pass, but the same tests fail during the Cobertura coverage test. I end up seeing variations of java.lang.VerifyErrors and java.lang.ClassFormatErrors (example below). Not sure if this is a Cobertura problem or a Tapestry problem, but I was looking for someone to share my grief or possibly even offer a solution. Is anyone using Cobertura to test coverage of their Tapestry 5 PageTester unit tests? If so, would you mind posting the pertinent sections of your pom.xml? Many thanks! Joel Tapestry 5.0.5-SNAPSHOT JDK 6.0 Maven 2.0.6 Cobertura-Maven-Plugin 2.0 Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.797 sec FAILURE! testStoreHierarchy(com.btservices.storeportal.pages.status.TestSta r t) Time elapsed: 0.36 sec FAILURE! java.lang.VerifyError: (class: com/btservices/storeportal/pages/status/Start, method: determineStatus signature: (Lcom/btservices/storeportal/data/StoreStatusCode;)Lorg/apache/tap e str y/ Asset;) Illegal constant pool index at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructors(Class.java:1459) at org.apache.tapestry.internal.services.ReflectiveInstantiator.findC o nst ru ctor(ReflectiveInstantiator.java:65) at org.apache.tapestry.internal.services.ReflectiveInstantiator.init (Re fl ectiveInstantiator.java:53) at org.apache.tapestry.internal.services.InternalClassTransformationImpl. cr eateInstantiator(InternalClassTransformationImpl.java:1227) at org.apache.tapestry.internal.services.ComponentClassTransformerImp l .cr ea teInstantiator(ComponentClassTransformerImpl.java:151) at $ComponentClassTransformer_1129a4c95be.createInstantiator($Compone n tCl as sTransformer_1129a4c95be.java) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl. fi ndInstantiator(ComponentInstantiatorSourceImpl.java:242) at $ComponentInstantiatorSource_1129a4c95ae.findInstantiator($Compone n tIn st antiatorSource_1129a4c95ae.java) at org.apache.tapestry.internal.services.PageElementFactoryImpl.newRo o tCo mp onentElement(PageElementFactoryImpl.java
T5: Sun Java System Application Server
This may be a crazy question but, has Tapestry 5 been tested on the J2EE reference implementation (note quotes)? I've been developing on Jetty for quite a while with no problems (because it's easier), but when I tried deploying the war to our QA Sun app servers, none of the component classes could be found. I've tried the suggestions listed under http://tapestry.apache.org/tapestry5/tomcat.html to archive my classes and that still doesn't load the components. Please help! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Best practice for rendering a dynamic component
Thanks Howard! For the community, the final code-alization of this discussion ends up being: HTML: t:delegate to=typeOfFruit/ t:block id=appleBlock t:apple/ /t:block t:block id=bananaBlock t:banana/ /t:block Java: private boolean displayApple; //set this however you want to private boolean displayBanana; //set this however you want to @Inject private Block appleBlock; @Inject private Block bananaBlock; @Component private Apple apple; @Component private Banana banana; public Object getTypeOfFruit() { if (displayApple) { return appleBlock; } else if(displayBanana) { return bananaBlock; } return null; } -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 23, 2007 4:08 PM To: Tapestry users Subject: Re: T5: Best practice for rendering a dynamic component Absolutely. You can put it inside a t:block to keep it from rendering normally. On 5/23/07, Joel Wiegman [EMAIL PROTECTED] wrote: Hrm... I have the code setup as listed below, but I'm getting: org.apache.tapestry.ioc.internal.util.TapestryException: Component org.foo.pages.Start does not contain an embedded component with id 'apple'. Does it expect me to have a t:apple/ tag in the page even though I'm delegating the rendering of it? -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 23, 2007 1:41 PM To: Tapestry users Subject: Re: T5: Best practice for rendering a dynamic component The Delegate component is what you need: t:delegate to=fruit/ @Component private Apple apple; @Component private Banana banana; public Object getFruit() { if ( ... ) return apple; return banana; } With Tapestry, the construction of pages is static, fixed, unchanging, much like the construction of your classes. However, Tapestry is quite dynamic when it comes to rendering, you can choose which objects render at what time in the rendering process, which ends up being about the same thing. On 5/23/07, Joel Wiegman [EMAIL PROTECTED] wrote: Hello all, I'm interested in rendering a component template that I can selectively declare. For example, I'd like to do something like the following: MyPage.java public class MyPage { @Component private Fruit myFruit; Object onAction(String switchValue) { if(switchValue.equals(apple) { myFruit = new Apple(); } else { myFruit = new Banana(); } } } MyPage.html t:fruit/ a t:type=actionlink context=literal:appleMake me an Apple!/a I'll save you from having to read the Apple.html and Banana.html component templates. :-) Anyway, I'm pretty sure it's not this easy, and I was wondering what's the best practice for accomplishing what I'm after. Thanks! Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Best practice for rendering a dynamic component
Hello all, I'm interested in rendering a component template that I can selectively declare. For example, I'd like to do something like the following: MyPage.java public class MyPage { @Component private Fruit myFruit; Object onAction(String switchValue) { if(switchValue.equals(apple) { myFruit = new Apple(); } else { myFruit = new Banana(); } } } MyPage.html t:fruit/ a t:type=actionlink context=literal:appleMake me an Apple!/a I'll save you from having to read the Apple.html and Banana.html component templates. :-) Anyway, I'm pretty sure it's not this easy, and I was wondering what's the best practice for accomplishing what I'm after. Thanks! Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Best practice for rendering a dynamic component
Hrm... I have the code setup as listed below, but I'm getting: org.apache.tapestry.ioc.internal.util.TapestryException: Component org.foo.pages.Start does not contain an embedded component with id 'apple'. Does it expect me to have a t:apple/ tag in the page even though I'm delegating the rendering of it? -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 23, 2007 1:41 PM To: Tapestry users Subject: Re: T5: Best practice for rendering a dynamic component The Delegate component is what you need: t:delegate to=fruit/ @Component private Apple apple; @Component private Banana banana; public Object getFruit() { if ( ... ) return apple; return banana; } With Tapestry, the construction of pages is static, fixed, unchanging, much like the construction of your classes. However, Tapestry is quite dynamic when it comes to rendering, you can choose which objects render at what time in the rendering process, which ends up being about the same thing. On 5/23/07, Joel Wiegman [EMAIL PROTECTED] wrote: Hello all, I'm interested in rendering a component template that I can selectively declare. For example, I'd like to do something like the following: MyPage.java public class MyPage { @Component private Fruit myFruit; Object onAction(String switchValue) { if(switchValue.equals(apple) { myFruit = new Apple(); } else { myFruit = new Banana(); } } } MyPage.html t:fruit/ a t:type=actionlink context=literal:appleMake me an Apple!/a I'll save you from having to read the Apple.html and Banana.html component templates. :-) Anyway, I'm pretty sure it's not this easy, and I was wondering what's the best practice for accomplishing what I'm after. Thanks! Joel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Cobertura?
Jiri, I know one of the Cobertura problems involved here is related to this bug: http://jira.codehaus.org/browse/MCOBERTURA-57 Obviously, this is not Cobertura but the Cobertura plug-in that Maven uses. The other appears to be an instrumentation issue which I will let you and Howard work out. If you need a sample class file please let me know and I can provide one to you (both). Cheers! Joel -Original Message- From: Jiri Mares [mailto:[EMAIL PROTECTED] Sent: Monday, May 21, 2007 2:12 AM To: Tapestry users Subject: Re: T5: Cobertura? Hi Howard, I'm developing cobertura ... can you, please, give more information where the problem is to solve it ... or show me the way how to investigate, where it is ... Thanks Jirka Howard Lewis Ship napsal(a): Sorry if I was inexact; I'm shifting gears too constantly. On 5/17/07, Joel Wiegman [EMAIL PROTECTED] wrote: I think you mean the 1.7 version of Cobertura itself, not the plugin. Version 2.0 of the plugin (which is what I'm using) uses Cobertura version 1.7. So is this a Tapestry issue or a Cobertura issue (or even a plugin issue)? Lots of class instrumentation going on! -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Thursday, May 17, 2007 12:53 PM To: Tapestry users Subject: Re: T5: Cobertura? It could be the version; I've been sticking to the 1.7 version of the plugin as 1.8 doesn't work (at least, not for Tapestry apps). On 5/17/07, Joel Wiegman [EMAIL PROTECTED] wrote: Hello all, I'm using the Cobertura (via the Maven plug-in) to execute some web app coverage tests. I'm seeing the T5 PageTester unit tests pass, but the same tests fail during the Cobertura coverage test. I end up seeing variations of java.lang.VerifyErrors and java.lang.ClassFormatErrors (example below). Not sure if this is a Cobertura problem or a Tapestry problem, but I was looking for someone to share my grief or possibly even offer a solution. Is anyone using Cobertura to test coverage of their Tapestry 5 PageTester unit tests? If so, would you mind posting the pertinent sections of your pom.xml? Many thanks! Joel Tapestry 5.0.5-SNAPSHOT JDK 6.0 Maven 2.0.6 Cobertura-Maven-Plugin 2.0 Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.797 sec FAILURE! testStoreHierarchy(com.btservices.storeportal.pages.status.TestStar t) Time elapsed: 0.36 sec FAILURE! java.lang.VerifyError: (class: com/btservices/storeportal/pages/status/Start, method: determineStatus signature: (Lcom/btservices/storeportal/data/StoreStatusCode;)Lorg/apache/tape str y/ Asset;) Illegal constant pool index at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructors(Class.java:1459) at org.apache.tapestry.internal.services.ReflectiveInstantiator.findCo nst ru ctor(ReflectiveInstantiator.java:65) at org.apache.tapestry.internal.services.ReflectiveInstantiator.init (Re fl ectiveInstantiator.java:53) at org.apache.tapestry.internal.services.InternalClassTransformationImpl. cr eateInstantiator(InternalClassTransformationImpl.java:1227) at org.apache.tapestry.internal.services.ComponentClassTransformerImpl .cr ea teInstantiator(ComponentClassTransformerImpl.java:151) at $ComponentClassTransformer_1129a4c95be.createInstantiator($Componen tCl as sTransformer_1129a4c95be.java) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl. fi ndInstantiator(ComponentInstantiatorSourceImpl.java:242) at $ComponentInstantiatorSource_1129a4c95ae.findInstantiator($Componen tIn st antiatorSource_1129a4c95ae.java) at org.apache.tapestry.internal.services.PageElementFactoryImpl.newRoo tCo mp onentElement(PageElementFactoryImpl.java:199) at $PageElementFactory_1129a4c95c1.newRootComponentElement($PageElemen tFa ct ory_1129a4c95c1.java) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadRootC omp on ent(PageLoaderProcessor.java:408) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadPage( Pag eL oaderProcessor.java:393) at org.apache.tapestry.internal.services.PageLoaderImpl.loadPage(PageL oad er Impl.java:62) at $PageLoader_1129a4c95bf.loadPage($PageLoader_1129a4c95bf.java) at org.apache.tapestry.internal.services.PagePoolImpl.checkout(PagePoo lIm pl .java:63) at $PagePool_1129a4c95b5.checkout($PagePool_1129a4c95b5.java) at org.apache.tapestry.internal.services.RequestPageCacheImpl.getByCla ssN am e(RequestPageCacheImpl.java:58) at org.apache.tapestry.internal.services.RequestPageCacheImpl.get(Requ est
T5: PageTester problems
I'm pretty sure the PageTester/unit testing framework is in a very gelatinous state right now, but I thought posting this error might help stabilize it. I'm getting a CNFE upon the first call to PageTester.renderPage (and yes, the page compiles and displays fine when not using the PageTester). I'm using Maven to build/test. I would assume this is an internal Tapestry 5.0.5-SNAPSHOT bug. Let me know if you need any more info. Cheers! java.lang.RuntimeException: java.lang.ClassNotFoundException: caught an exception while obtaining a class file for com.btservices.storeportal.pages.status.Start at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl.fi ndClass(ComponentInstantiatorSourceImpl.java:258) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl.fi ndInstantiator(ComponentInstantiatorSourceImpl.java:240) at $ComponentInstantiatorSource_112aecf7b33.findInstantiator($ComponentInst antiatorSource_112aecf7b33.java) at org.apache.tapestry.internal.services.PageElementFactoryImpl.newRootComp onentElement(PageElementFactoryImpl.java:199) at $PageElementFactory_112aecf7b44.newRootComponentElement($PageElementFact ory_112aecf7b44.java) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadRootCompon ent(PageLoaderProcessor.java:408) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadPage(PageL oaderProcessor.java:393) at org.apache.tapestry.internal.services.PageLoaderImpl.loadPage(PageLoader Impl.java:62) at $PageLoader_112aecf7b42.loadPage($PageLoader_112aecf7b42.java) at org.apache.tapestry.internal.services.PagePoolImpl.checkout(PagePoolImpl .java:63) at $PagePool_112aecf7b38.checkout($PagePool_112aecf7b38.java) at org.apache.tapestry.internal.services.RequestPageCacheImpl.getByClassNam e(RequestPageCacheImpl.java:58) at org.apache.tapestry.internal.services.RequestPageCacheImpl.get(RequestPa geCacheImpl.java:49) at $RequestPageCache_112aecf7b32.get($RequestPageCache_112aecf7b32.java) at $RequestPageCache_112aecf7b31.get($RequestPageCache_112aecf7b31.java) at org.apache.tapestry.internal.services.PageLinkHandlerImpl.handle(PageLin kHandlerImpl.java:57) at $PageLinkHandler_112aecf7b28.handle($PageLinkHandler_112aecf7b28.java) at org.apache.tapestry.internal.test.PageLinkInvoker.invoke(PageLinkInvoker .java:61) at org.apache.tapestry.test.PageTester.invoke(PageTester.java:184) at org.apache.tapestry.test.PageTester.renderPage(PageTester.java:144) at com.btservices.storeportal.pages.status.TestStart.testStoreHierarchy(Tes tStart.java:220) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: PageTester problems
Never mind... I had a stale war in development. I needed to replace org.apache.tapestry.TapestryFilter with org.apache.tapestry.spring.TapestrySpringFilter in my web.xml. -Original Message- From: Joel Wiegman [mailto:[EMAIL PROTECTED] Sent: Monday, May 21, 2007 9:31 AM To: Tapestry users Subject: T5: PageTester problems I'm pretty sure the PageTester/unit testing framework is in a very gelatinous state right now, but I thought posting this error might help stabilize it. I'm getting a CNFE upon the first call to PageTester.renderPage (and yes, the page compiles and displays fine when not using the PageTester). I'm using Maven to build/test. I would assume this is an internal Tapestry 5.0.5-SNAPSHOT bug. Let me know if you need any more info. Cheers! java.lang.RuntimeException: java.lang.ClassNotFoundException: caught an exception while obtaining a class file for com.btservices.storeportal.pages.status.Start at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl.fi ndClass(ComponentInstantiatorSourceImpl.java:258) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl.fi ndInstantiator(ComponentInstantiatorSourceImpl.java:240) at $ComponentInstantiatorSource_112aecf7b33.findInstantiator($ComponentInst antiatorSource_112aecf7b33.java) at org.apache.tapestry.internal.services.PageElementFactoryImpl.newRootComp onentElement(PageElementFactoryImpl.java:199) at $PageElementFactory_112aecf7b44.newRootComponentElement($PageElementFact ory_112aecf7b44.java) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadRootCompon ent(PageLoaderProcessor.java:408) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadPage(PageL oaderProcessor.java:393) at org.apache.tapestry.internal.services.PageLoaderImpl.loadPage(PageLoader Impl.java:62) at $PageLoader_112aecf7b42.loadPage($PageLoader_112aecf7b42.java) at org.apache.tapestry.internal.services.PagePoolImpl.checkout(PagePoolImpl .java:63) at $PagePool_112aecf7b38.checkout($PagePool_112aecf7b38.java) at org.apache.tapestry.internal.services.RequestPageCacheImpl.getByClassNam e(RequestPageCacheImpl.java:58) at org.apache.tapestry.internal.services.RequestPageCacheImpl.get(RequestPa geCacheImpl.java:49) at $RequestPageCache_112aecf7b32.get($RequestPageCache_112aecf7b32.java) at $RequestPageCache_112aecf7b31.get($RequestPageCache_112aecf7b31.java) at org.apache.tapestry.internal.services.PageLinkHandlerImpl.handle(PageLin kHandlerImpl.java:57) at $PageLinkHandler_112aecf7b28.handle($PageLinkHandler_112aecf7b28.java) at org.apache.tapestry.internal.test.PageLinkInvoker.invoke(PageLinkInvoker .java:61) at org.apache.tapestry.test.PageTester.invoke(PageTester.java:184) at org.apache.tapestry.test.PageTester.renderPage(PageTester.java:144) at com.btservices.storeportal.pages.status.TestStart.testStoreHierarchy(Tes tStart.java:220) - 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: Cobertura?
Hello all, I'm using the Cobertura (via the Maven plug-in) to execute some web app coverage tests. I'm seeing the T5 PageTester unit tests pass, but the same tests fail during the Cobertura coverage test. I end up seeing variations of java.lang.VerifyErrors and java.lang.ClassFormatErrors (example below). Not sure if this is a Cobertura problem or a Tapestry problem, but I was looking for someone to share my grief or possibly even offer a solution. Is anyone using Cobertura to test coverage of their Tapestry 5 PageTester unit tests? If so, would you mind posting the pertinent sections of your pom.xml? Many thanks! Joel Tapestry 5.0.5-SNAPSHOT JDK 6.0 Maven 2.0.6 Cobertura-Maven-Plugin 2.0 Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.797 sec FAILURE! testStoreHierarchy(com.btservices.storeportal.pages.status.TestStart) Time elapsed: 0.36 sec FAILURE! java.lang.VerifyError: (class: com/btservices/storeportal/pages/status/Start, method: determineStatus signature: (Lcom/btservices/storeportal/data/StoreStatusCode;)Lorg/apache/tapestry/ Asset;) Illegal constant pool index at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructors(Class.java:1459) at org.apache.tapestry.internal.services.ReflectiveInstantiator.findConstru ctor(ReflectiveInstantiator.java:65) at org.apache.tapestry.internal.services.ReflectiveInstantiator.init(Refl ectiveInstantiator.java:53) at org.apache.tapestry.internal.services.InternalClassTransformationImpl.cr eateInstantiator(InternalClassTransformationImpl.java:1227) at org.apache.tapestry.internal.services.ComponentClassTransformerImpl.crea teInstantiator(ComponentClassTransformerImpl.java:151) at $ComponentClassTransformer_1129a4c95be.createInstantiator($ComponentClas sTransformer_1129a4c95be.java) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl.fi ndInstantiator(ComponentInstantiatorSourceImpl.java:242) at $ComponentInstantiatorSource_1129a4c95ae.findInstantiator($ComponentInst antiatorSource_1129a4c95ae.java) at org.apache.tapestry.internal.services.PageElementFactoryImpl.newRootComp onentElement(PageElementFactoryImpl.java:199) at $PageElementFactory_1129a4c95c1.newRootComponentElement($PageElementFact ory_1129a4c95c1.java) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadRootCompon ent(PageLoaderProcessor.java:408) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadPage(PageL oaderProcessor.java:393) at org.apache.tapestry.internal.services.PageLoaderImpl.loadPage(PageLoader Impl.java:62) at $PageLoader_1129a4c95bf.loadPage($PageLoader_1129a4c95bf.java) at org.apache.tapestry.internal.services.PagePoolImpl.checkout(PagePoolImpl .java:63) at $PagePool_1129a4c95b5.checkout($PagePool_1129a4c95b5.java) at org.apache.tapestry.internal.services.RequestPageCacheImpl.getByClassNam e(RequestPageCacheImpl.java:58) at org.apache.tapestry.internal.services.RequestPageCacheImpl.get(RequestPa geCacheImpl.java:49) at $RequestPageCache_1129a4c95ad.get($RequestPageCache_1129a4c95ad.java) at $RequestPageCache_1129a4c95ac.get($RequestPageCache_1129a4c95ac.java) at org.apache.tapestry.internal.services.PageLinkHandlerImpl.handle(PageLin kHandlerImpl.java:57) at $PageLinkHandler_1129a4c95a3.handle($PageLinkHandler_1129a4c95a3.java) at org.apache.tapestry.test.pagelevel.PageLinkInvoker.invoke(PageLinkInvoke r.java:61) at org.apache.tapestry.test.pagelevel.PageTester.invoke(PageTester.java:214 ) at org.apache.tapestry.test.pagelevel.PageTester.renderPage(PageTester.java :182) at com.btservices.storeportal.pages.status.TestStart.testStoreHierarchy(Tes tStart.java:112) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Cobertura?
I think you mean the 1.7 version of Cobertura itself, not the plugin. Version 2.0 of the plugin (which is what I'm using) uses Cobertura version 1.7. So is this a Tapestry issue or a Cobertura issue (or even a plugin issue)? Lots of class instrumentation going on! -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Thursday, May 17, 2007 12:53 PM To: Tapestry users Subject: Re: T5: Cobertura? It could be the version; I've been sticking to the 1.7 version of the plugin as 1.8 doesn't work (at least, not for Tapestry apps). On 5/17/07, Joel Wiegman [EMAIL PROTECTED] wrote: Hello all, I'm using the Cobertura (via the Maven plug-in) to execute some web app coverage tests. I'm seeing the T5 PageTester unit tests pass, but the same tests fail during the Cobertura coverage test. I end up seeing variations of java.lang.VerifyErrors and java.lang.ClassFormatErrors (example below). Not sure if this is a Cobertura problem or a Tapestry problem, but I was looking for someone to share my grief or possibly even offer a solution. Is anyone using Cobertura to test coverage of their Tapestry 5 PageTester unit tests? If so, would you mind posting the pertinent sections of your pom.xml? Many thanks! Joel Tapestry 5.0.5-SNAPSHOT JDK 6.0 Maven 2.0.6 Cobertura-Maven-Plugin 2.0 Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.797 sec FAILURE! testStoreHierarchy(com.btservices.storeportal.pages.status.TestStart) Time elapsed: 0.36 sec FAILURE! java.lang.VerifyError: (class: com/btservices/storeportal/pages/status/Start, method: determineStatus signature: (Lcom/btservices/storeportal/data/StoreStatusCode;)Lorg/apache/tapestr y/ Asset;) Illegal constant pool index at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructors(Class.java:1459) at org.apache.tapestry.internal.services.ReflectiveInstantiator.findConst ru ctor(ReflectiveInstantiator.java:65) at org.apache.tapestry.internal.services.ReflectiveInstantiator.init(Re fl ectiveInstantiator.java:53) at org.apache.tapestry.internal.services.InternalClassTransformationImpl. cr eateInstantiator(InternalClassTransformationImpl.java:1227) at org.apache.tapestry.internal.services.ComponentClassTransformerImpl.cr ea teInstantiator(ComponentClassTransformerImpl.java:151) at $ComponentClassTransformer_1129a4c95be.createInstantiator($ComponentCl as sTransformer_1129a4c95be.java) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl. fi ndInstantiator(ComponentInstantiatorSourceImpl.java:242) at $ComponentInstantiatorSource_1129a4c95ae.findInstantiator($ComponentIn st antiatorSource_1129a4c95ae.java) at org.apache.tapestry.internal.services.PageElementFactoryImpl.newRootCo mp onentElement(PageElementFactoryImpl.java:199) at $PageElementFactory_1129a4c95c1.newRootComponentElement($PageElementFa ct ory_1129a4c95c1.java) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadRootComp on ent(PageLoaderProcessor.java:408) at org.apache.tapestry.internal.services.PageLoaderProcessor.loadPage(Pag eL oaderProcessor.java:393) at org.apache.tapestry.internal.services.PageLoaderImpl.loadPage(PageLoad er Impl.java:62) at $PageLoader_1129a4c95bf.loadPage($PageLoader_1129a4c95bf.java) at org.apache.tapestry.internal.services.PagePoolImpl.checkout(PagePoolIm pl .java:63) at $PagePool_1129a4c95b5.checkout($PagePool_1129a4c95b5.java) at org.apache.tapestry.internal.services.RequestPageCacheImpl.getByClassN am e(RequestPageCacheImpl.java:58) at org.apache.tapestry.internal.services.RequestPageCacheImpl.get(Request Pa geCacheImpl.java:49) at $RequestPageCache_1129a4c95ad.get($RequestPageCache_1129a4c95ad.java) at $RequestPageCache_1129a4c95ac.get($RequestPageCache_1129a4c95ac.java) at org.apache.tapestry.internal.services.PageLinkHandlerImpl.handle(PageL in kHandlerImpl.java:57) at $PageLinkHandler_1129a4c95a3.handle($PageLinkHandler_1129a4c95a3.java) at org.apache.tapestry.test.pagelevel.PageLinkInvoker.invoke(PageLinkInvo ke r.java:61) at org.apache.tapestry.test.pagelevel.PageTester.invoke(PageTester.java:2 14 ) at org.apache.tapestry.test.pagelevel.PageTester.renderPage(PageTester.ja va :182) at com.btservices.storeportal.pages.status.TestStart.testStoreHierarchy(T es tStart.java:112) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC
T5: ContextForPageTester error
Hello all, I'm trying to get a simple PageTester working using JUnit: public class TestStoreHierarchy { private PageTester tester; @Before public void setUpStoreHierarchyTests() { tester = new PageTester(com.btservices.storeportal, app, src/main/webapp); } @Test public void testStoreHierarchy() { Document doc = tester.renderPage(status/Start); Element form = doc.getElementById(form); MapString, String fieldValues = new HashMapString, String(); assertTrue(doc.getElementById(region) == null); fieldValues.put(brand, DSW); doc = tester.submitForm(form, fieldValues); assertTrue(doc.getElementById(region) != null); } } And Tapestry 5.0.4 is throwing it's own run-time error (code found here: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/ main/java/org/apache/tapestry/test/pagelevel/ContextForPageTester.java?v iew=markup ). I'm using Spring to inject values, and it seems to have a problem with Spring's WebApplicationContext. Please advise. Thanks! HOLD YOUR BREATH [ERROR] WebApplicationContext Construction of service WebApplicationContext failed: Error invoking service builder method org.apache.tapestry.spring.SpringModule.build(Context) (at SpringModule.java:46) (for service 'WebApplicationContext'): An exception occurred obtaining the Spring WebApplicationContext: getAttribute() is not supported for ContextForPageTester. java.lang.RuntimeException: Error invoking service builder method org.apache.tapestry.spring.SpringModule.build(Context) (at SpringModule.java:46) (for service 'WebApplicationContext'): An exception occurred obtaining the Spring WebApplicationContext: getAttribute() is not supported for ContextForPageTester. at org.apache.tapestry.ioc.internal.ServiceBuilderMethodInvoker.createObjec t(ServiceBuilderMethodInvoker.java:87) at org.apache.tapestry.ioc.internal.SingletonServiceLifecycle.createService (SingletonServiceLifecycle.java:31) at org.apache.tapestry.ioc.internal.LifecycleWrappedServiceCreator.createOb ject(LifecycleWrappedServiceCreator.java:49) at org.apache.tapestry.ioc.internal.InterceptorStackBuilder.createObject(In terceptorStackBuilder.java:54) at org.apache.tapestry.ioc.internal.RecursiveServiceCreationCheckWrapper.cr eateObject(RecursiveServiceCreationCheckWrapper.java:60) at org.apache.tapestry.ioc.internal.services.JustInTimeObjectCreator.create Object(JustInTimeObjectCreator.java:61) at $WebApplicationContext_1129587b4b7._delegate($WebApplicationContext_1129 587b4b7.java) at $WebApplicationContext_1129587b4b7.getBeanDefinitionNames($WebApplicatio nContext_1129587b4b7.java) at org.apache.tapestry.spring.SpringObjectProvider.loadBeanNames(SpringObje ctProvider.java:56) at org.apache.tapestry.spring.SpringObjectProvider.provide(SpringObjectProv ider.java:80) at $ObjectProvider_1129587b4b4.provide($ObjectProvider_1129587b4b4.java) at $ObjectProvider_1129587b4b6.provide($ObjectProvider_1129587b4b6.java) at $ObjectProvider_1129587b4b1.provide($ObjectProvider_1129587b4b1.java) at org.apache.tapestry.internal.services.InjectWorker.inject(InjectWorker.j ava:80) at org.apache.tapestry.internal.services.InjectWorker.transform(InjectWorke r.java:53) at $ComponentClassTransformWorker_1129587b4e2.transform($ComponentClassTran sformWorker_1129587b4e2.java) at $ComponentClassTransformWorker_1129587b4df.transform($ComponentClassTran sformWorker_1129587b4df.java) at org.apache.tapestry.internal.services.ComponentClassTransformerImpl.tran sformComponentClass(ComponentClassTransformerImpl.java:131) at $ComponentClassTransformer_1129587b4cb.transformComponentClass($Componen tClassTransformer_1129587b4cb.java) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl.on Load(ComponentInstantiatorSourceImpl.java:177) at javassist.Loader.findClass(Loader.java:340) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl$Pa ckageAwareLoader.findClass(ComponentInstantiatorSourceImpl.java:85) at javassist.Loader.loadClass(Loader.java:311) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl.fi ndClass(ComponentInstantiatorSourceImpl.java:254) at org.apache.tapestry.internal.services.ComponentInstantiatorSourceImpl.fi ndInstantiator(ComponentInstantiatorSourceImpl.java:240) at $ComponentInstantiatorSource_1129587b4c2.findInstantiator($ComponentInst antiatorSource_1129587b4c2.java) at org.apache.tapestry.internal.services.PageElementFactoryImpl.newRootComp onentElement(PageElementFactoryImpl.java:189) at $PageElementFactory_1129587b4da.newRootComponentElement($PageElementFact
T5: Flash persistence strategy
Greetings all, I attempted to expand upon the T5 FlashDemo found here: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/ test/app1/WEB-INF/ I'm attempting to write a Messages component that can be included anywhere and show a group of messages to a user. But for some reason the messages are persisting past a single-page rendering, despite using the new flash persistence strategy (which I'm assuming is available in 5.0.4). Can anyone spot the flaw? Thanks! Messages component: @Meta(tapestry.persistence-strategy=flash) public class Messages { @Persist private ListString messages = new ArrayListString(); @Persist private String currentMessage; public ListString getMessages() { return messages; } public void addMessage(String message) { messages.add(message); } public String getCurrentMessage() { return currentMessage; } public void setCurrentMessage(String currentMessage) { this.currentMessage = currentMessage; } } Messages template: t:if test=messages xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; ul li t:type=loop source=messages value=currentMessage ${currentMessage} /li /ul /t:if - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: Flash persistence strategy
Thanks Howard. I figured I didn't need it on the currentMessage field, but I didn't want the flex response from someone saying I should try adding it. ;-) Either way, the messages field is still sticking around past a single page load. The pertinent java code that uses it is: @Component private Messages messages; Object onActionFromDownloadDistrict(String districtId) { messages.addMessage(Last successful download: District + districtId); return null; } And of course the html: t:messages/ Anything else I'm missing? Is flash persistence available in 5.0.4? -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 15, 2007 1:48 PM To: Tapestry users Subject: Re: T5: Flash persistence strategy You don't need the @Meta, you can: @Persist(flash) private ListString messages = new ArrayListString(); Also, you don't need the @Persist on the currentMessage field. On 5/15/07, Joel Wiegman [EMAIL PROTECTED] wrote: Greetings all, I attempted to expand upon the T5 FlashDemo found here: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/sr c/ test/app1/WEB-INF/ I'm attempting to write a Messages component that can be included anywhere and show a group of messages to a user. But for some reason the messages are persisting past a single-page rendering, despite using the new flash persistence strategy (which I'm assuming is available in 5.0.4). Can anyone spot the flaw? Thanks! Messages component: @Meta(tapestry.persistence-strategy=flash) public class Messages { @Persist private ListString messages = new ArrayListString(); @Persist private String currentMessage; public ListString getMessages() { return messages; } public void addMessage(String message) { messages.add(message); } public String getCurrentMessage() { return currentMessage; } public void setCurrentMessage(String currentMessage) { this.currentMessage = currentMessage; } } Messages template: t:if test=messages xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; ul li t:type=loop source=messages value=currentMessage ${currentMessage} /li /ul /t:if - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: SelectModel - a real world example
Impressive! I was injecting that value via Spring to bootstrap it. Makes sense I should have removed that... No errors now... However, the field doesn't appear to be binding on a form submission. The encoder and the model appear to be receiving and returning the correct values, the brand getter and setter appear to be getting called, and the dropdown renders correctly except that it always appears to be reset to the default value... I apologize for being so high-maintenance. If there is a working example of a T5 binding select box anywhere on the web, please point me there and I will leave you alone! Main.html t:form select t:type=select class=mint_font_black_background t:id=brand value=brand model=brandSelectModel encoder=brandValueEncoder onchange=this.form.submit(); / /t:form Main.java public class Main { @Inject @SpringBean(enterprise) private Enterprise enterprise; @Persist private Brand brand; public Brand getBrand() { return brand; } public void setBrand(Brand brand) { this.brand = brand; } public BrandSelectModel getBrandSelectModel() { return new BrandSelectModel(enterprise.getBrands()); } public BrandValueEncoder getBrandValueEncoder() { return new BrandValueEncoder(enterprise.getBrands()); } public class BrandValueEncoder implements ValueEncoderBrand { private ListBrand brands; public BrandValueEncoder(ListBrand brands) { this.brands = brands; } public String toClient(Brand brand) { return brand.getDescription(); } public Brand toValue(String string) { for(Brand brand : brands) { if(brand.getDescription().equals(string)) { return brand; } } return null; } } public class BrandSelectModel implements SelectModel { private ListBrand brands; public BrandSelectModel(ListBrand brands) { this.brands = brands; } public ListOptionGroupModel getOptionGroups() { return null; } public ListOptionModel getOptions() { ListOptionModel optionModelList = new ArrayListOptionModel(); for(Brand brand: brands) { optionModelList.add( new OptionModelImpl( brand.getDescription(), false, brand, new String[0] ) ); } return optionModelList; } } } -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Saturday, May 05, 2007 9:45 PM To: Tapestry users Subject: Re: T5: SelectModel - a real world example What annotations are on the brand field of your Main class? Something has changes that field to be read-only, which is usually a sign that a value was injected. On 5/4/07, Joel Wiegman [EMAIL PROTECTED] wrote: Still getting unintuitive errors... I've added the ValueEncoder and now when I submit the form I get the following stack trace (and yes the Main component has a setBrand(Brand) method, which from the root cause exception seems to be the cause of the problem?): [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: org.apache.tapestry.ioc.internal.util.TapestryException: Failure writing parameter value of component com.foo.pages.Main:brand: Field com.foo.pages.Main.brand is read-only. [at context:WEB-INF/Main.html, line 89, column 278] java.lang.RuntimeException: org.apache.tapestry.ioc.internal.util.TapestryException: Failure writing parameter value of component com.foo. pages.Main:brand: Field com.foo.pages.Main.brand is read-only. [at context:WEB-INF/Main.html, line 89, column 278] at org.apache.tapestry.corelib.components.Form.onAction(Form.java:356) at org.apache.tapestry.corelib.components.Form.handleComponentEvent(Form. ja va) at org.apache.tapestry.internal.structure.ComponentPageElementImpl.handle Ev ent(ComponentPageElementImpl.java:903) at org.apache.tapestry.internal.structure.ComponentPageElementImpl.trigge rE vent
RE: T5: SelectModel - a real world example
Nope... Just using the standard Jetty/Maven desktop environment. I've created and attached a simple demo if you'd like to see the problem in action. Only three small files... the HTML page, the Java file, and the Brand POJO. You'll need to change the package of the Java files to fit your application, but shouldn't need to change much else... Otherwise, I guess I'll anxiously await an example of a binding select box! Thanks for all your help Howard! -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 12:17 PM To: Tapestry users Subject: Re: T5: SelectModel - a real world example Odd that you lost your value; the field is itself persistent (@Persist). Unless you are testing on a multi-machine cluster, you shouldn't see any problems along these lines! On 5/7/07, Joel Wiegman [EMAIL PROTECTED] wrote: Impressive! I was injecting that value via Spring to bootstrap it. Makes sense I should have removed that... No errors now... However, the field doesn't appear to be binding on a form submission. The encoder and the model appear to be receiving and returning the correct values, the brand getter and setter appear to be getting called, and the dropdown renders correctly except that it always appears to be reset to the default value... I apologize for being so high-maintenance. If there is a working example of a T5 binding select box anywhere on the web, please point me there and I will leave you alone! Main.html t:form select t:type=select class=mint_font_black_background t:id=brand value=brand model=brandSelectModel encoder=brandValueEncoder onchange=this.form.submit(); / /t:form Main.java public class Main { @Inject @SpringBean(enterprise) private Enterprise enterprise; @Persist private Brand brand; public Brand getBrand() { return brand; } public void setBrand(Brand brand) { this.brand = brand; } public BrandSelectModel getBrandSelectModel() { return new BrandSelectModel(enterprise.getBrands()); } public BrandValueEncoder getBrandValueEncoder() { return new BrandValueEncoder(enterprise.getBrands()); } public class BrandValueEncoder implements ValueEncoderBrand { private ListBrand brands; public BrandValueEncoder(ListBrand brands) { this.brands = brands; } public String toClient(Brand brand) { return brand.getDescription(); } public Brand toValue(String string) { for(Brand brand : brands) { if(brand.getDescription().equals(string)) { return brand; } } return null; } } public class BrandSelectModel implements SelectModel { private ListBrand brands; public BrandSelectModel(ListBrand brands) { this.brands = brands; } public ListOptionGroupModel getOptionGroups() { return null; } public ListOptionModel getOptions() { ListOptionModel optionModelList = new ArrayListOptionModel(); for(Brand brand: brands) { optionModelList.add( new OptionModelImpl( brand.getDescription(), false, brand, new String[0] ) ); } return optionModelList; } } } -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Saturday, May 05, 2007 9:45 PM To: Tapestry users Subject: Re: T5: SelectModel - a real world example What annotations are on the brand field of your Main class? Something has changes that field to be read-only, which is usually a sign that a value was injected. On 5/4/07, Joel Wiegman [EMAIL PROTECTED] wrote: Still getting unintuitive errors... I've added the ValueEncoder and now when I submit the form I get the following stack trace (and yes the Main component has a setBrand(Brand) method, which from the root cause exception seems to be the cause of the problem?): [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: org.apache.tapestry.ioc.internal.util.TapestryException: Failure
RE: T5: SelectModel - a real world example
Eureka! Finally got it all working. What caused the drop down to not be defaulting is the fact that I declared my Brand list in two separate lists... One for the ValueEncoder and one for the SelectModel. Big no no! An equals is called on the value from the SelectModel and the value from the ValueEncoder, so if they are initialized as separate objects in separate lists the framework won't notice that they are equal (because they would point to a different memory location). I found that the framework also seems to like things better if the List of Brands is @Persisted between pages. Here's the final source code that I used to get it all working (Enjoy!): Brand.java (simple POJO): public class Brand { private String id; private String description; public Brand() {} public Brand(String id, String description) { this.id = id; this.description = description; } public String getId() { return id; } public String getDescription() { return description; } } Test.java public class Test { @Persist private Brand brand; @Persist private ListBrand brands; public Brand getBrand() { return brand; } public void setBrand(Brand brand) { this.brand = brand; } private ListBrand getBrands() { if(brands == null) { brands = new ArrayListBrand(); brands.add(new Brand(1, Brand 1)); brands.add(new Brand(2, Brand 2)); brands.add(new Brand(3, Brand 3)); brands.add(new Brand(4, Brand 4)); } return brands; } public BrandSelectModel getBrandSelectModel() { return new BrandSelectModel(getBrands()); } public BrandValueEncoder getBrandValueEncoder() { return new BrandValueEncoder(getBrands()); } public class BrandValueEncoder implements ValueEncoderBrand { private ListBrand brands; public BrandValueEncoder(ListBrand brands) { this.brands = brands; } public String toClient(Brand brand) { return brand.getDescription(); } public Brand toValue(String string) { for(Brand brand : brands) { if(brand.getDescription().equals(string)) { return brand; } } return null; } } public class BrandSelectModel implements SelectModel { private ListBrand brands; public BrandSelectModel(ListBrand brands) { this.brands = brands; } public ListOptionGroupModel getOptionGroups() { return null; } public ListOptionModel getOptions() { ListOptionModel optionModelList = new ArrayListOptionModel(); for(Brand brand: brands) { optionModelList.add( new OptionModelImpl( brand.getDescription(), false, brand, new String[0] ) ); } return optionModelList; } } } Test.html html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; t:form select t:type=select t:id=brand value=brand model=brandSelectModel encoder=brandValueEncoder onchange=this.form.submit(); / br/ t:if test=brand ${brand.description} /t:if /t:form /html -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Monday, May 07, 2007 12:17 PM To: Tapestry users Subject: Re: T5: SelectModel - a real world example Odd that you lost your value; the field is itself persistent (@Persist). Unless you are testing on a multi-machine cluster, you shouldn't see any problems along these lines! On 5/7/07, Joel Wiegman [EMAIL PROTECTED] wrote: Impressive! I was injecting that value via Spring to bootstrap it. Makes sense I should have removed that... No errors now... However, the field doesn't
T5: SelectModel - a real world example
Not to be harsh, but I don't think I've ever written a select box with constant values (Enum). Seems like even Male/Female drop downs need to be data-driven now-a-days. :- I've started to stub out a very simple real world example of a select component in T5, but it doesn't appear to be as simple as I thought it would be. A shiny nickel to anyone that can spot the flaw, because I sure can't... I'm new to Tapestry in general so I could be missing something really mundane here, but seems like it should work in my mind. Here are the players: THE ERROR [ERROR] DefaultRequestExceptionHandler Processing of request failed with uncaught exception: com.foo.data.Brand cannot be cast to java.lang.String java.lang.ClassCastException: com.foo.data.Brand cannot be cast to java.lang.String at org.apache.tapestry.corelib.components.Select$1.toClient(Select.java:62) at org.apache.tapestry.corelib.components.Select.writeOptions(Select.java:1 94) at org.apache.tapestry.corelib.components.Select.options(Select.java:169) at org.apache.tapestry.corelib.components.Select.beforeRenderTemplate(Selec t.java) Main.html (abridged) t:form select t:type=select t:id=brand value=brand model=brandSelectModel/ /t:form Main.java (abridged) package com.foo.pages; import com.foo.data.Brand; public class Main { private Brand brand; public Brand getBrand() { return brand; } public void setBrand(Brand brand) { this.brand = brand; } public BrandSelectModel getBrandSelectModel() { return new BrandSelectModel(getBrands()); } public ListBrand getBrands() { ListBrand brands = new ArrayListBrand(); brands.add(new Brand(1, Brand 1)); brands.add(new Brand(2, Brand 2)); brands.add(new Brand(3, Brand 3)); return brands; } } Brand.java (abridged) package com.foo.data; public class Brand { private String id; private String description; public Brand() {} public Brand(String id, String description) { this.id = id; this.description = description; } public String getId() { return id; } public String getDescription() { return description; } } BrandSelectModel.java package com.foo.uisupport; import com.foo.data.Brand; public class BrandSelectModel implements SelectModel { private ListBrand brands; public BrandSelectModel(ListBrand brands) { this.brands = brands; } public ListOptionGroupModel getOptionGroups() { return null; } public ListOptionModel getOptions() { ListOptionModel optionModelList = new ArrayListOptionModel(); for(Brand brand: brands) { optionModelList.add(new OptionModelImpl(brand.getDescription(), false, brand, new String[0])); } return optionModelList; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: SelectModel - a real world example
Thanks for the reply Howard. The Select component doesn't know how to create a client-side representation of a Brand (it doesn't magically know to use the id). So, then... I guess my question would be... what is the BrandSelectModel for? In that object, I'm essentially mapping a Brand's description to the Brand object. Just curious what your thoughts are on that... -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 1:42 PM To: Tapestry users Subject: Re: T5: SelectModel - a real world example In the simplest case, T5 thinks that the options in the drop down list are all strings. In your case, they are Brands. The Select component doesn't know how to create a client-side representation of a Brand (it doesn't magically know to use the id). You must provide a ValueEncoder that can convert between Brands and client-side string values. This is the encoder parameter of the Select component. On 5/4/07, Joel Wiegman [EMAIL PROTECTED] wrote: Not to be harsh, but I don't think I've ever written a select box with constant values (Enum). Seems like even Male/Female drop downs need to be data-driven now-a-days. :- I've started to stub out a very simple real world example of a select component in T5, but it doesn't appear to be as simple as I thought it would be. A shiny nickel to anyone that can spot the flaw, because I sure can't... I'm new to Tapestry in general so I could be missing something really mundane here, but seems like it should work in my mind. Here are the players: THE ERROR [ERROR] DefaultRequestExceptionHandler Processing of request failed with uncaught exception: com.foo.data.Brand cannot be cast to java.lang.String java.lang.ClassCastException: com.foo.data.Brand cannot be cast to java.lang.String at org.apache.tapestry.corelib.components.Select$1.toClient(Select.java:62) at org.apache.tapestry.corelib.components.Select.writeOptions(Select.java :1 94) at org.apache.tapestry.corelib.components.Select.options(Select.java:169) at org.apache.tapestry.corelib.components.Select.beforeRenderTemplate(Sel ec t.java) Main.html (abridged) t:form select t:type=select t:id=brand value=brand model=brandSelectModel/ /t:form Main.java (abridged) package com.foo.pages; import com.foo.data.Brand; public class Main { private Brand brand; public Brand getBrand() { return brand; } public void setBrand(Brand brand) { this.brand = brand; } public BrandSelectModel getBrandSelectModel() { return new BrandSelectModel(getBrands()); } public ListBrand getBrands() { ListBrand brands = new ArrayListBrand(); brands.add(new Brand(1, Brand 1)); brands.add(new Brand(2, Brand 2)); brands.add(new Brand(3, Brand 3)); return brands; } } Brand.java (abridged) package com.foo.data; public class Brand { private String id; private String description; public Brand() {} public Brand(String id, String description) { this.id = id; this.description = description; } public String getId() { return id; } public String getDescription() { return description; } } BrandSelectModel.java package com.foo.uisupport; import com.foo.data.Brand; public class BrandSelectModel implements SelectModel { private ListBrand brands; public BrandSelectModel(ListBrand brands) { this.brands = brands; } public ListOptionGroupModel getOptionGroups() { return null; } public ListOptionModel getOptions() { ListOptionModel optionModelList = new ArrayListOptionModel(); for(Brand brand: brands) { optionModelList.add(new OptionModelImpl(brand.getDescription(), false, brand, new String[0])); } return optionModelList; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: T5: SelectModel - a real world example
Still getting unintuitive errors... I've added the ValueEncoder and now when I submit the form I get the following stack trace (and yes the Main component has a setBrand(Brand) method, which from the root cause exception seems to be the cause of the problem?): [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: org.apache.tapestry.ioc.internal.util.TapestryException: Failure writing parameter value of component com.foo.pages.Main:brand: Field com.foo.pages.Main.brand is read-only. [at context:WEB-INF/Main.html, line 89, column 278] java.lang.RuntimeException: org.apache.tapestry.ioc.internal.util.TapestryException: Failure writing parameter value of component com.foo. pages.Main:brand: Field com.foo.pages.Main.brand is read-only. [at context:WEB-INF/Main.html, line 89, column 278] at org.apache.tapestry.corelib.components.Form.onAction(Form.java:356) at org.apache.tapestry.corelib.components.Form.handleComponentEvent(Form.ja va) at org.apache.tapestry.internal.structure.ComponentPageElementImpl.handleEv ent(ComponentPageElementImpl.java:903) at org.apache.tapestry.internal.structure.ComponentPageElementImpl.triggerE vent(ComponentPageElementImpl.java:1002) at org.apache.tapestry.internal.services.ActionLinkHandlerImpl.handle(Actio nLinkHandlerImpl.java:100) at org.apache.tapestry.internal.services.ActionLinkHandlerImpl.handle(Actio nLinkHandlerImpl.java:53) at $ActionLinkHandler_11258c2d07d.handle($ActionLinkHandler_11258c2d07d.jav a) at org.apache.tapestry.internal.services.ComponentActionDispatcher.dispatch (ComponentActionDispatcher.java:115) ... 40 more Caused by: org.apache.tapestry.ioc.internal.util.TapestryException: Failure writing parameter value of component com.foo.pages.Main:brand: Field com.foo.pages.Main.brand is read-only. [at context:WEB-INF/Main.html, line 89, column 278] at org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.wr iteParameter(InternalComponentResourcesImpl.java:223) at org.apache.tapestry.corelib.components.Select._$update_parameter_value_0 (Select.java) at org.apache.tapestry.corelib.components.Select.processSubmission(Select.j ava:238) at org.apache.tapestry.corelib.base.AbstractField.processSubmission(Abstrac tField.java:210) at org.apache.tapestry.corelib.base.AbstractField.access$100(AbstractField. java:47) at org.apache.tapestry.corelib.base.AbstractField$ProcessSubmissionAction.e xecute(AbstractField.java:116) at org.apache.tapestry.corelib.base.AbstractField$ProcessSubmissionAction.e xecute(AbstractField.java:110) at org.apache.tapestry.corelib.components.Form.onAction(Form.java:347) ... 40 more Caused by: org.apache.tapestry.ioc.internal.util.TapestryException: Field com.foo.pages.Main.brand is read-only. [at context:WEB-INF/Main. html, line 89, column 278] at org.apache.tapestry.internal.bindings.PropBinding.set(PropBinding.java:7 1) at org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.wr iteParameter(InternalComponentResourcesImpl.java:219) ... 47 more Caused by: java.lang.RuntimeException: Field com.foo.pages.Main.brand is read-only. at com.foo.pages.Main._$write_brand(Main.java) at com.foo.pages.Main.setBrand(Main.java:92) at $PropertyConduit_11258c2d0a9.set($PropertyConduit_11258c2d0a9.java) at org.apache.tapestry.internal.bindings.PropBinding.set(PropBinding.java:6 7) ... 48 more -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 2:32 PM To: Tapestry users Subject: Re: T5: SelectModel - a real world example In your OptionModel, the label is the Brand description, and the value is the Brand itself. You then supply a ValueEncoder that converts between Brands and brand ids (as strings, for the client side). If Brand is an entity object, then it may be necessary to have the ValueEncoder talk to the database or session store. On 5/4/07, Joel Wiegman [EMAIL PROTECTED] wrote: Thanks for the reply Howard. The Select component doesn't know how to create a client-side representation of a Brand (it doesn't magically know to use the id). So, then... I guess my question would be... what is the BrandSelectModel for? In that object, I'm essentially mapping a Brand's description to the Brand object. Just curious what your thoughts are on that... -Original Message- From: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Sent: Friday, May 04, 2007 1:42 PM To: Tapestry users Subject: Re: T5: SelectModel - a real world example In the simplest case, T5 thinks that the options in the drop down list are all strings. In your case, they are Brands. The Select component doesn't know how to create a client-side representation of a Brand (it doesn't magically know to use the id). You must provide a ValueEncoder