RE: tapernate NonUniqueObjectException
Can't you just check in your login listener whether the user already has a valid session? Wouldn't that help? Generally, the problem seems to be, that your code executes before the page-setup involving the merge-back of properties takes place. Do you load your objects in a normal listener? Or in Page.validate()? -Original Message- From: Moritz Gmelin [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 26, 2006 11:43 PM To: users@tapestry.apache.org Subject: tapernate NonUniqueObjectException Hi List Members, I am having troubles setting up an application with tapernate. When the user is logging into my application, a Page ExtPage is injected, initialized, some persistent objects are loaded and the page is returned to the user. Those persistant object are made persistant with tapernates reconnect- update strategy. This works great while the user works inside that ExtPage or correctly loggs of. If however the user just logs in, hits the back button in the browser and logs in again, the Injection of the Page fails: NonUniqueObjectException a different object with the same identifier value was already associated with the session. While I can somehow understand why this error happens, I'd like to somehow find a way to catch it. Is there maybe a way to force tapestry to inject new instances of a page ? That will not contain any persistant objects ? Thanks for any help Moritz - 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: DatePicker error
Hi again DJ, I am just looking at the versions I have. I am using Hibernate 3.1.3. Are you using Java 1.5? I saw in the readme for hibernate that I have: xerces-2.6.2.jar (2.6.2) - SAX parser - runtime, required for JDK 1.4 So maybe the problem could be that I am using JDK 1.5... any thoughts? I will try to remove the jar and see if this makes any difference. My version of xml-apis.jar is unknown (lol) - I guess this is what you meant by the XML Parser APIs? I dont have saxpath (could that be part of your Maven installation(if you are using that?)) All these different libraries are starting to make my head spin... ;-) Thanks again! On 9/26/06, DJ Gredler [EMAIL PROTECTED] wrote: I'm using Tap4 with Hibernate 3.1.2 without a problem and I see the following XML-related JARS in my lib directory: dom4j 1.6.1, saxpath 1.0FCS, Xerces Impl 2.6.2, XML Parser APIs 2.2.1. Not sure how you would find out what the official dependencies are. On 9/26/06, Hajaansh [EMAIL PROTECTED] wrote: Ah, so that is the reason that no one answered :-) That might have been a good tip from you though! I have found a Xerces 2.6.2 jar which came with hibernate and I dont really have a clue if Tapestry (4.0) is using that one. I have also found one which came with my Java 1.5 installation. Any way to find out which Tapestry is using? I am not sure if just deleting the version that came with Hibernate would be a good idea or? Thanks for your quick response! On 9/26/06, DJ Gredler [EMAIL PROTECTED] wrote: I really have no idea, but maybe you have multiple versions of Xerces running around on your classpath, or just a single (wrong) version? These kinds of errors are always hard to debug... On 9/26/06, Hajaansh [EMAIL PROTECTED] wrote: No one knows what the problem could be? Each time a restart Tomcat it seems to be fine. Maybe it is so obvious no one is responding? On 9/19/06, Hajaansh [EMAIL PROTECTED] wrote: Sorry, the error message was formatted strangely the last time. This time I hope it is better... Any ideas anyone? Could it be how I started Tomcat? I started it with: set JAVA_OPTS=-Dorg.apache.tapestry.disable-caching=true set JPDA_ADDRESS=9045 set JPDA_TRANSPORT=dt_socket C:\Tomcat\apache-tomcat-5.5.17\bin\catalina jpda start and the error I got from the DatePicker is as follows (i hope this time the formating is not as bad as the last time...) org.apache.hivemind.ApplicationRuntimeException org.apache.xerces.parsers.XML11Configuration location: classpath:/org/apache/tapestry/form/DatePicker.jwc, line 36, column 71 31 parameter name=validators/ 32 parameter name=id property=idParameter default-value=id/ 33 34 asset name=defaultIcon path=DatePickerIcon.png/ 35 36 inject property=script type=script object= DatePicker.script / 37inject property=translatedFieldSupport object=service: tapestry.form.TranslatedFieldSupport/ 38 inject property=validatableFieldSupport object=service: tapestry.form.ValidatableFieldSupport/ 39 40/component-specification java.lang.ClassCastException org.apache.xerces.parsers.XML11Configuration Stack Trace: - org.apache.xerces.parsers.SAXParser.init(Unknown Source) - org.apache.xerces.parsers.SAXParser.init(Unknown Source) - org.apache.xerces.jaxp.SAXParserImpl.init(Unknown Source) - org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser (Unknown Source) - org.apache.tapestry.util.xml.RuleDirectedParser.constructParser ( RuleDirectedParser.java:426) - org.apache.tapestry.util.xml.RuleDirectedParser.parse( RuleDirectedParser.java:155) - org.apache.tapestry.util.xml.RuleDirectedParser.parse( RuleDirectedParser.java:130) - org.apache.tapestry.script.ScriptParser.parse( ScriptParser.java :105) - org.apache.tapestry.engine.DefaultScriptSource.parse( DefaultScriptSource.java:88) - org.apache.tapestry.engine.DefaultScriptSource.getScript( DefaultScriptSource.java:74) - $IScriptSource_10dc21a16a2.getScript($IScriptSource_10dc21a16a2.java) - org.apache.tapestry.enhance.DeferredScriptImpl.getScript( DeferredScriptImpl.java:54) - $DatePicker_699.getScript($DatePicker_699.java) - org.apache.tapestry.form.DatePicker.renderFormComponent( DatePicker.java:129) - org.apache.tapestry.form.AbstractFormComponent.renderComponent( AbstractFormComponent.java:126) - org.apache.tapestry.AbstractComponent.render( AbstractComponent.java:617) - org.apache.tapestry.AbstractComponent.renderBody( AbstractComponent.java:434) - org.apache.tapestry.form.FormSupportImpl.render( FormSupportImpl.java:486) - org.apache.tapestry.form.Form.renderComponent(Form.java:250) - org.apache.tapestry.AbstractComponent.render(
Re: tapernate NonUniqueObjectException
The problem happend when tapernates PersistanceStrategy tried to rollback its state in the injected Page. The page was injected in the form handler of the login form. Injecting the page in the pageBeginRender method of the form page, and cleaning up all persistent objects solved the problem. Thanks. M. Am 27.09.2006 um 08:29 schrieb Schulte Marcus: Can't you just check in your login listener whether the user already has a valid session? Wouldn't that help? Generally, the problem seems to be, that your code executes before the page-setup involving the merge-back of properties takes place. Do you load your objects in a normal listener? Or in Page.validate()? -Original Message- From: Moritz Gmelin [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 26, 2006 11:43 PM To: users@tapestry.apache.org Subject: tapernate NonUniqueObjectException Hi List Members, I am having troubles setting up an application with tapernate. When the user is logging into my application, a Page ExtPage is injected, initialized, some persistent objects are loaded and the page is returned to the user. Those persistant object are made persistant with tapernates reconnect- update strategy. This works great while the user works inside that ExtPage or correctly loggs of. If however the user just logs in, hits the back button in the browser and logs in again, the Injection of the Page fails: NonUniqueObjectException a different object with the same identifier value was already associated with the session. While I can somehow understand why this error happens, I'd like to somehow find a way to catch it. Is there maybe a way to force tapestry to inject new instances of a page ? That will not contain any persistant objects ? Thanks for any help Moritz - 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: DatePicker error
Thanks anyway! I will just have to try out different libs and see if the problem somehow sorts itself out ;-) It does not feel like a stable way of doing things but I guess I have no alternative... Thanks again! On 9/27/06, DJ Gredler [EMAIL PROTECTED] wrote: I'm on JDK 1.5, so that shouldn't be an issue. The saxpath jar may very well be a dependency of one of the other gazillion libraries I'm using :-) I don't know what else to suggest... On 9/27/06, Hajaansh [EMAIL PROTECTED] wrote: Hi again DJ, I am just looking at the versions I have. I am using Hibernate 3.1.3. Are you using Java 1.5? I saw in the readme for hibernate that I have: xerces-2.6.2.jar (2.6.2) - SAX parser - runtime, required for JDK 1.4 So maybe the problem could be that I am using JDK 1.5... any thoughts? I will try to remove the jar and see if this makes any difference. My version of xml-apis.jar is unknown (lol) - I guess this is what you meant by the XML Parser APIs? I dont have saxpath (could that be part of your Maven installation(if you are using that?)) All these different libraries are starting to make my head spin... ;-) Thanks again! On 9/26/06, DJ Gredler [EMAIL PROTECTED] wrote: I'm using Tap4 with Hibernate 3.1.2 without a problem and I see the following XML-related JARS in my lib directory: dom4j 1.6.1, saxpath 1.0FCS, Xerces Impl 2.6.2, XML Parser APIs 2.2.1. Not sure how you would find out what the official dependencies are. On 9/26/06, Hajaansh [EMAIL PROTECTED] wrote: Ah, so that is the reason that no one answered :-) That might have been a good tip from you though! I have found a Xerces 2.6.2 jar which came with hibernate and I dont really have a clue if Tapestry (4.0) is using that one. I have also found one which came with my Java 1.5 installation. Any way to find out which Tapestry is using? I am not sure if just deleting the version that came with Hibernate would be a good idea or? Thanks for your quick response! On 9/26/06, DJ Gredler [EMAIL PROTECTED] wrote: I really have no idea, but maybe you have multiple versions of Xerces running around on your classpath, or just a single (wrong) version? These kinds of errors are always hard to debug... On 9/26/06, Hajaansh [EMAIL PROTECTED] wrote: No one knows what the problem could be? Each time a restart Tomcat it seems to be fine. Maybe it is so obvious no one is responding? On 9/19/06, Hajaansh [EMAIL PROTECTED] wrote: Sorry, the error message was formatted strangely the last time. This time I hope it is better... Any ideas anyone? Could it be how I started Tomcat? I started it with: set JAVA_OPTS=-Dorg.apache.tapestry.disable-caching=true set JPDA_ADDRESS=9045 set JPDA_TRANSPORT=dt_socket C:\Tomcat\apache-tomcat-5.5.17\bin\catalina jpda start and the error I got from the DatePicker is as follows (i hope this time the formating is not as bad as the last time...) org.apache.hivemind.ApplicationRuntimeException org.apache.xerces.parsers.XML11Configuration location: classpath:/org/apache/tapestry/form/DatePicker.jwc, line 36, column 71 31 parameter name=validators/ 32 parameter name=id property=idParameter default-value=id/ 33 34 asset name=defaultIcon path=DatePickerIcon.png/ 35 36 inject property=script type=script object= DatePicker.script / 37inject property=translatedFieldSupport object=service: tapestry.form.TranslatedFieldSupport/ 38 inject property=validatableFieldSupport object=service: tapestry.form.ValidatableFieldSupport/ 39 40/component-specification java.lang.ClassCastException org.apache.xerces.parsers.XML11Configuration Stack Trace: - org.apache.xerces.parsers.SAXParser.init(Unknown Source) - org.apache.xerces.parsers.SAXParser.init(Unknown Source) - org.apache.xerces.jaxp.SAXParserImpl.init(Unknown Source) - org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser (Unknown Source) - org.apache.tapestry.util.xml.RuleDirectedParser.constructParser ( RuleDirectedParser.java:426) - org.apache.tapestry.util.xml.RuleDirectedParser.parse( RuleDirectedParser.java:155) - org.apache.tapestry.util.xml.RuleDirectedParser.parse( RuleDirectedParser.java:130) - org.apache.tapestry.script.ScriptParser.parse( ScriptParser.java :105) - org.apache.tapestry.engine.DefaultScriptSource.parse( DefaultScriptSource.java:88) - org.apache.tapestry.engine.DefaultScriptSource.getScript( DefaultScriptSource.java:74) - $IScriptSource_10dc21a16a2.getScript($IScriptSource_10dc21a16a2.java) -
Re: Components containing dynamic number of component
Hi Mael, thank you for your answer. Have you done this your self? In that case can you share some example codes? It is much easier to understand how it should work if I can follow the code. thanks again, Jacob Mael Caldas-2 wrote: Hi Jacob, I Think you have to work on a model that represents better your column... With the the For Component, and a little of polymorphism applied to components and its models you can do It easily. I don't think you have to work with AbstractComponent, RenderBody, or that kind of thing... A tip... always try to work with components hierarchy... When you work with Tapestry, think on Tapestry approach... the things almost are simpler than you think... ;) Mael On 9/26/06, jake123 [EMAIL PROTECTED] wrote: Hi, I am pritty new to tapestry and I am working with tapestry 4.0.2. I have a question about custom components. I have a side column in my application that has a few lines of html and then it should contain one or many components depending on where in the application I use it. my question is: How do I do this? My html file for left column look like this : html body jwcid=$content$ link href=/default/css/leftcolumn.css rel=stylesheet type=text/css / div id=leftColumn div id=innerLeftColumn !-- Login Component -- !-- Article list component -- /div /div /body /html Do I use a abstractComponent and use the renderComponent(IMarkupWriter writer, IRequestCycle cycle) and can the renderBody(writer, cycle) render only one or many components? Thank you for your patience with trivial questions and for any suggestions on how to solve my problems Jacob -- View this message in context: http://www.nabble.com/Components-containing-dynamic-number-of-component-tf2340643.html#a6514321 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Components-containing-dynamic-number-of-component-tf2340643.html#a6526232 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
EventListener called several times
Hi all, I am observing a very strange behavior with EventListener. On a first example, I have a PropertySelection component that updates an Insert component under onchange event using @EventListener annotation. Works fine. Now I have the same PropertySelection component (A), now updating another PropertySelection (B) object within the same form (instead of the Insert component). When A changes, I can see from the dojo console that in addition to the content of B (which is correctly updated), the javascript code that registers the onchange event is also executed again (this didn't happen on the example with the Insert component). As a result, it seems that the event is registered twice: when A changes again, my listener is called twice, then four times on the following change, etc Does that make any sense to you guys? extracted from the dojo console when component A changes: DEBUG: 14:47:20: Response recieved. DEBUG: 14:47:20: Received element content for id formhidden of: input type=hidden name=formids value=a,sb,c,Submit/ input type=hidden name=component value=form/ input type=hidden name=page value=Home/ input type=hidden name=service value=direct/ input type=hidden name=submitmode value=/ input type=hidden name=submitname value=/ DEBUG: 14:47:20: Received element content for id sb of: option value=0 selected=selectedChoose.../option option value=3B3/option option value=4B4/option DEBUG: 14:47:21: evaluating script: //![CDATA[ dojo.require(dojo.event); dojo.require(tapestry.*); //]] DEBUG: 14:47:21: evaluating script: //![CDATA[ tapestry.cleanConnect( dojo.byId(a), onchange, formEvent1723431748); tapestry.formEvent1723431748=function(e){ var content={beventname:onchange}; tapestry.event.buildEventProperties(e, content); if (!content[beventtarget.id]) content[beventtarget.id]=a; var validateState=tapestry.form.forms[form].validateForm; var validateForm=false; tapestry.form.setFormValidating(form, validateForm); tapestry.form.submitAsync(form, content); tapestry.form.setFormValidating(form, validateState); }; dojo.event.connect(dojo.byId(a), onchange, tapestry, formEvent1723431748); //]] Thanks for any help Ch.
Custom exception page
Can anyone help me out with a snippet of code? On my Exception.html/.page I have a simple @Insert with getError(). Here's my code, but it doesn't provide a nice traceback :( public String getError() { ExceptionDescription[] Errors = getExceptions(); String err = ; for (int i = 0; i Errors.length; i++) err += Errors[i].getMessage() + br; return err; } Any ideas? Thanks, Greg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Custom exception page
Look at tapestry's ExceptionDisplay component source. It uses something called an ExceptionAnalyzer and also displays the contents of the ExceptionDescription.getProperties(). I've got a custom exception page that writes to log4j. Here's what I use to get the text: public void logException(Throwable value) { ExceptionAnalyzer analyzer = new ExceptionAnalyzer(); ExceptionDescription[] exceptions = analyzer.analyze(value); setExceptions(exceptions); StringBuffer text = new StringBuffer(); for (ExceptionDescription exception : exceptions) { text.append(Class: + exception.getExceptionClassName() + \n); text.append(Message: + exception.getMessage() + \n); for (ExceptionProperty property : exception.getProperties()) { text.append(Property: + property.getName() + = + property.getValue() + \n); } } String[] stack = exceptions[exceptions.length-1].getStackTrace(); for (String stackItem : stack) { text.append(stackItem + \n); } log.error(text.toString()); } -Steve [EMAIL PROTECTED] wrote: Can anyone help me out with a snippet of code? On my Exception.html/.page I have a simple @Insert with getError(). Here's my code, but it doesn't provide a nice traceback :( public String getError() { ExceptionDescription[] Errors = getExceptions(); String err = ; for (int i = 0; i Errors.length; i++) err += Errors[i].getMessage() + br; return err; } Any ideas? Thanks, Greg - 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: EventListener called several times
I was running my application with caching disabled on my dev environment. If I enable caching, then guess what... it works as expected (events are sent only once when A changes). Amazing. After a closer look, it seems that the updated event registration script is sent with a different id (formEventn) when caching is disabled, thus not cleaning previously registered events. I'm really happy to have this sorted, since this looked as a show stopper for a production application. It is still a bit annoying on dev environments, but I can live with this (until jesse releases a fix ;-) Thanks for the nice work again anyway 2006/9/27, Christian Dutaret [EMAIL PROTECTED]: Hi all, I am observing a very strange behavior with EventListener. On a first example, I have a PropertySelection component that updates an Insert component under onchange event using @EventListener annotation. Works fine. Now I have the same PropertySelection component (A), now updating another PropertySelection (B) object within the same form (instead of the Insert component). When A changes, I can see from the dojo console that in addition to the content of B (which is correctly updated), the javascript code that registers the onchange event is also executed again (this didn't happen on the example with the Insert component). As a result, it seems that the event is registered twice: when A changes again, my listener is called twice, then four times on the following change, etc Does that make any sense to you guys? extracted from the dojo console when component A changes: DEBUG: 14:47:20: Response recieved. DEBUG: 14:47:20: Received element content for id formhidden of: input type=hidden name=formids value=a,sb,c,Submit/ input type=hidden name=component value=form/ input type=hidden name=page value=Home/ input type=hidden name=service value=direct/ input type=hidden name=submitmode value=/ input type=hidden name=submitname value=/ DEBUG: 14:47:20: Received element content for id sb of: option value=0 selected=selectedChoose.../option option value=3B3/option option value=4B4/option DEBUG: 14:47:21: evaluating script: //![CDATA[ dojo.require(dojo.event); dojo.require(tapestry.*); //]] DEBUG: 14:47:21: evaluating script: //![CDATA[ tapestry.cleanConnect( dojo.byId(a), onchange, formEvent1723431748); tapestry.formEvent1723431748=function(e){ var content={beventname:onchange}; tapestry.event.buildEventProperties(e, content); if (!content[beventtarget.id]) content[beventtarget.id]=a; var validateState=tapestry.form.forms[form].validateForm; var validateForm=false; tapestry.form.setFormValidating(form, validateForm); tapestry.form.submitAsync(form, content); tapestry.form.setFormValidating(form, validateState); }; dojo.event.connect(dojo.byId(a), onchange, tapestry, formEvent1723431748); //]] Thanks for any help Ch.
Re: EventListener called several times
HmmmCan you still post a bug in JIRA anyways? This sounds like a possible bug in one the services. (be as detailed as possible about what you did to have it happen, if that's possible..) On 9/27/06, Christian Dutaret [EMAIL PROTECTED] wrote: I was running my application with caching disabled on my dev environment. If I enable caching, then guess what... it works as expected (events are sent only once when A changes). Amazing. After a closer look, it seems that the updated event registration script is sent with a different id (formEventn) when caching is disabled, thus not cleaning previously registered events. I'm really happy to have this sorted, since this looked as a show stopper for a production application. It is still a bit annoying on dev environments, but I can live with this (until jesse releases a fix ;-) Thanks for the nice work again anyway 2006/9/27, Christian Dutaret [EMAIL PROTECTED]: Hi all, I am observing a very strange behavior with EventListener. On a first example, I have a PropertySelection component that updates an Insert component under onchange event using @EventListener annotation. Works fine. Now I have the same PropertySelection component (A), now updating another PropertySelection (B) object within the same form (instead of the Insert component). When A changes, I can see from the dojo console that in addition to the content of B (which is correctly updated), the javascript code that registers the onchange event is also executed again (this didn't happen on the example with the Insert component). As a result, it seems that the event is registered twice: when A changes again, my listener is called twice, then four times on the following change, etc Does that make any sense to you guys? extracted from the dojo console when component A changes: DEBUG: 14:47:20: Response recieved. DEBUG: 14:47:20: Received element content for id formhidden of: input type=hidden name=formids value=a,sb,c,Submit/ input type=hidden name=component value=form/ input type=hidden name=page value=Home/ input type=hidden name=service value=direct/ input type=hidden name=submitmode value=/ input type=hidden name=submitname value=/ DEBUG: 14:47:20: Received element content for id sb of: option value=0 selected=selectedChoose.../option option value=3B3/option option value=4B4/option DEBUG: 14:47:21: evaluating script: //![CDATA[ dojo.require(dojo.event ); dojo.require(tapestry.*); //]] DEBUG: 14:47:21: evaluating script: //![CDATA[ tapestry.cleanConnect( dojo.byId(a), onchange, formEvent1723431748); tapestry.formEvent1723431748=function(e){ var content={beventname:onchange}; tapestry.event.buildEventProperties(e, content); if (!content[beventtarget.id]) content[beventtarget.id ]=a; var validateState=tapestry.form.forms[form].validateForm; var validateForm=false; tapestry.form.setFormValidating(form, validateForm); tapestry.form.submitAsync(form, content); tapestry.form.setFormValidating(form, validateState); }; dojo.event.connect(dojo.byId(a), onchange, tapestry, formEvent1723431748); //]] Thanks for any help Ch. -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
RE: Custom exception page
Thanks Steve. So in Exception.html I could just have a span jwcid=@ExceptionDisplay exceptions=ognl:exceptionDescription / ? Thanks, Greg -Original Message- From: Steve Shucker [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 11:04 AM To: Tapestry users Subject: Re: Custom exception page Look at tapestry's ExceptionDisplay component source. It uses something called an ExceptionAnalyzer and also displays the contents of the ExceptionDescription.getProperties(). I've got a custom exception page that writes to log4j. Here's what I use to get the text: public void logException(Throwable value) { ExceptionAnalyzer analyzer = new ExceptionAnalyzer(); ExceptionDescription[] exceptions = analyzer.analyze(value); setExceptions(exceptions); StringBuffer text = new StringBuffer(); for (ExceptionDescription exception : exceptions) { text.append(Class: + exception.getExceptionClassName() + \n); text.append(Message: + exception.getMessage() + \n); for (ExceptionProperty property : exception.getProperties()) { text.append(Property: + property.getName() + = + property.getValue() + \n); } } String[] stack = exceptions[exceptions.length-1].getStackTrace(); for (String stackItem : stack) { text.append(stackItem + \n); } log.error(text.toString()); } -Steve [EMAIL PROTECTED] wrote: Can anyone help me out with a snippet of code? On my Exception.html/.page I have a simple @Insert with getError(). Here's my code, but it doesn't provide a nice traceback :( public String getError() { ExceptionDescription[] Errors = getExceptions(); String err = ; for (int i = 0; i Errors.length; i++) err += Errors[i].getMessage() + br; return err; } Any ideas? Thanks, Greg - 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: Components containing dynamic number of component
Hi Jacob, I don't have any didactic example to explain this well, but you can do this like this: For each component, you create a model, or a object that each component receives and interact with him. So, you create a component that receives a List of Objects, iterating over then, and, depending on the type, call the respective component to render. Use If component around each component and the instanceof to evaluate the condition. So, you use the component that receives the List inside your column component, and pass the List of objects to them... If you can't do, I will try to find some code that you can understand... :) Mael On 9/27/06, jake123 [EMAIL PROTECTED] wrote: Hi Mael, thank you for your answer. Have you done this your self? In that case can you share some example codes? It is much easier to understand how it should work if I can follow the code. thanks again, Jacob Mael Caldas-2 wrote: Hi Jacob, I Think you have to work on a model that represents better your column... With the the For Component, and a little of polymorphism applied to components and its models you can do It easily. I don't think you have to work with AbstractComponent, RenderBody, or that kind of thing... A tip... always try to work with components hierarchy... When you work with Tapestry, think on Tapestry approach... the things almost are simpler than you think... ;) Mael On 9/26/06, jake123 [EMAIL PROTECTED] wrote: Hi, I am pritty new to tapestry and I am working with tapestry 4.0.2. I have a question about custom components. I have a side column in my application that has a few lines of html and then it should contain one or many components depending on where in the application I use it. my question is: How do I do this? My html file for left column look like this : html body jwcid=$content$ link href=/default/css/leftcolumn.css rel=stylesheet type=text/css / div id=leftColumn div id=innerLeftColumn !-- Login Component -- !-- Article list component -- /div /div /body /html Do I use a abstractComponent and use the renderComponent(IMarkupWriter writer, IRequestCycle cycle) and can the renderBody(writer, cycle) render only one or many components? Thank you for your patience with trivial questions and for any suggestions on how to solve my problems Jacob -- View this message in context: http://www.nabble.com/Components-containing-dynamic-number-of-component-tf2340643.html#a6514321 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Components-containing-dynamic-number-of-component-tf2340643.html#a6526232 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: Custom exception page
Exactly. Then in your *.application file, put something like page name=Exception specification-path=/ErrorPage.page / and make sure that page has the API that tapestry's internal exception page has. To save you the trouble, here's tapestry's exception page class: public abstract class Exception extends BasePage implements PageDetachListener { /** Transient property */ public abstract void setExceptions(ExceptionDescription[] exceptions); public void setException(Throwable value) { ExceptionAnalyzer analyzer = new ExceptionAnalyzer(); ExceptionDescription[] exceptions = analyzer.analyze(value); setExceptions(exceptions); } } I should mention that there are other gurus on this list who can probably tell you how to make all this stuff log by properly configuring hivemind. But if you want to play with the message, my code should suit you. -Steve [EMAIL PROTECTED] wrote: Thanks Steve. So in Exception.html I could just have a span jwcid=@ExceptionDisplay exceptions=ognl:exceptionDescription / ? Thanks, Greg -Original Message- From: Steve Shucker [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 11:04 AM To: Tapestry users Subject: Re: Custom exception page Look at tapestry's ExceptionDisplay component source. It uses something called an ExceptionAnalyzer and also displays the contents of the ExceptionDescription.getProperties(). I've got a custom exception page that writes to log4j. Here's what I use to get the text: public void logException(Throwable value) { ExceptionAnalyzer analyzer = new ExceptionAnalyzer(); ExceptionDescription[] exceptions = analyzer.analyze(value); setExceptions(exceptions); StringBuffer text = new StringBuffer(); for (ExceptionDescription exception : exceptions) { text.append(Class: + exception.getExceptionClassName() + \n); text.append(Message: + exception.getMessage() + \n); for (ExceptionProperty property : exception.getProperties()) { text.append(Property: + property.getName() + = + property.getValue() + \n); } } String[] stack = exceptions[exceptions.length-1].getStackTrace(); for (String stackItem : stack) { text.append(stackItem + \n); } log.error(text.toString()); } -Steve [EMAIL PROTECTED] wrote: Can anyone help me out with a snippet of code? On my Exception.html/.page I have a simple @Insert with getError(). Here's my code, but it doesn't provide a nice traceback :( public String getError() { ExceptionDescription[] Errors = getExceptions(); String err = ; for (int i = 0; i Errors.length; i++) err += Errors[i].getMessage() + br; return err; } Any ideas? Thanks, Greg - 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: Custom exception page
Here you go, it's pretty easy to change whatever you want if you take a look at tapestrys core exception page configuration file (which you can of course override with your own contribution values): http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.error.xml?view=markup As well as the actual exception pages themselves : http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/pages/ On 9/27/06, Steve Shucker [EMAIL PROTECTED] wrote: Exactly. Then in your *.application file, put something like page name=Exception specification-path=/ErrorPage.page / and make sure that page has the API that tapestry's internal exception page has. To save you the trouble, here's tapestry's exception page class: public abstract class Exception extends BasePage implements PageDetachListener { /** Transient property */ public abstract void setExceptions(ExceptionDescription[] exceptions); public void setException(Throwable value) { ExceptionAnalyzer analyzer = new ExceptionAnalyzer(); ExceptionDescription[] exceptions = analyzer.analyze(value); setExceptions(exceptions); } } I should mention that there are other gurus on this list who can probably tell you how to make all this stuff log by properly configuring hivemind. But if you want to play with the message, my code should suit you. -Steve [EMAIL PROTECTED] wrote: Thanks Steve. So in Exception.html I could just have a span jwcid=@ExceptionDisplay exceptions=ognl:exceptionDescription / ? Thanks, Greg -Original Message- From: Steve Shucker [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 27, 2006 11:04 AM To: Tapestry users Subject: Re: Custom exception page Look at tapestry's ExceptionDisplay component source. It uses something called an ExceptionAnalyzer and also displays the contents of the ExceptionDescription.getProperties(). I've got a custom exception page that writes to log4j. Here's what I use to get the text: public void logException(Throwable value) { ExceptionAnalyzer analyzer = new ExceptionAnalyzer(); ExceptionDescription[] exceptions = analyzer.analyze(value); setExceptions(exceptions); StringBuffer text = new StringBuffer(); for (ExceptionDescription exception : exceptions) { text.append(Class: + exception.getExceptionClassName() + \n); text.append(Message: + exception.getMessage() + \n); for (ExceptionProperty property : exception.getProperties()) { text.append(Property: + property.getName() + = + property.getValue() + \n); } } String[] stack = exceptions[exceptions.length-1 ].getStackTrace(); for (String stackItem : stack) { text.append(stackItem + \n); } log.error(text.toString()); } -Steve [EMAIL PROTECTED] wrote: Can anyone help me out with a snippet of code? On my Exception.html/.page I have a simple @Insert with getError(). Here's my code, but it doesn't provide a nice traceback :( public String getError() { ExceptionDescription[] Errors = getExceptions(); String err = ; for (int i = 0; i Errors.length; i++) err += Errors[i].getMessage() + br; return err; } Any ideas? Thanks, Greg - 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] -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
Access validators from tapestry.valid
How do you access validators from tapestry.valid (e.g. tapestry.valid.UrlValidator) as opposed to tapestry.form.validator? I would like to use the UrlValidator, but I'm not sure how. (Is there a way to get validators=validators:url to work? _ Ne perdez pas de temps dans les files dattente magasinez en ligne. http://magasiner.sympatico.msn.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Jetty 6 / Tapestry 4 sample code?
Sorry for the newbie question (the FAQ for this mailing list is empty?) but I've been banging my head on this wall for a bit. I've written some small test Tapestry 4 applications and deployed to Tomcat with no trouble. But what I'd like to do is to completely embed the servlet engine in my code. Jetty seems to be a good tool for that. But I haven't been successful putting together a Jetty 6 servlet with Tapestry. I can't even tell if I'm calling the wrong methods in Jetty, or my configuration is wrong or what. So, are there any trivial examples of code with this stack? All the examples I've seen so far have been with old code and I'd rather start with the most recent releases. Thanks for any help, [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Jetty 6 / Tapestry 4 sample code?
I was able to do this recently without too much trouble by studying this code (though I use HtmlUnit as the client, rather than Selenium): http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=markup http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/JettyRunner.java?view=markup It assumes a Maven2 directory structure, but you might be able to get some ideas even if you aren't using Maven. On 9/28/06, Kevin Whitley [EMAIL PROTECTED] wrote: Sorry for the newbie question (the FAQ for this mailing list is empty?) but I've been banging my head on this wall for a bit. I've written some small test Tapestry 4 applications and deployed to Tomcat with no trouble. But what I'd like to do is to completely embed the servlet engine in my code. Jetty seems to be a good tool for that. But I haven't been successful putting together a Jetty 6 servlet with Tapestry. I can't even tell if I'm calling the wrong methods in Jetty, or my configuration is wrong or what. So, are there any trivial examples of code with this stack? All the examples I've seen so far have been with old code and I'd rather start with the most recent releases. Thanks for any help, [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Jetty 6 / Tapestry 4 sample code?
You'll find that all of the demo applications (workbench / timetracker ) in tapestry4 all use iddy bitty little jetty.xml conf files to run them off of as well. It's weird finding the right configuration at first but then copying + pasting is a cinche ;) On 9/27/06, DJ Gredler [EMAIL PROTECTED] wrote: I was able to do this recently without too much trouble by studying this code (though I use HtmlUnit as the client, rather than Selenium): http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=markup http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/JettyRunner.java?view=markup It assumes a Maven2 directory structure, but you might be able to get some ideas even if you aren't using Maven. On 9/28/06, Kevin Whitley [EMAIL PROTECTED] wrote: Sorry for the newbie question (the FAQ for this mailing list is empty?) but I've been banging my head on this wall for a bit. I've written some small test Tapestry 4 applications and deployed to Tomcat with no trouble. But what I'd like to do is to completely embed the servlet engine in my code. Jetty seems to be a good tool for that. But I haven't been successful putting together a Jetty 6 servlet with Tapestry. I can't even tell if I'm calling the wrong methods in Jetty, or my configuration is wrong or what. So, are there any trivial examples of code with this stack? All the examples I've seen so far have been with old code and I'd rather start with the most recent releases. Thanks for any help, [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
Doubt about assets
Guys, I am trying to insert some javascripts, the overlib javascript, as an asset of my page asset name=overlib path=context:/js/overlib.js/ But when I test the overlib function and open the sourecode of the generated page the corresponding script/script that should have been writen is not written. How should I include my javascripts inside a page? -- We shall go on to the end. We shall fight in France We shall fightover the seas and oceans. We shall fight with growing confidence and growing strength in the air. We shall defend our island whatever the cost may be We shall fight on beaches, we shall fight on the landing grounds, We shall fight in the fields and in the streets, We shall fight on the hills. We shall never surrender. Winston Churchill
Re: Doubt about assets
If all you are doing is serving js from your web context folder named /js/overlib.js then I would do it like this: script type=text/javascript src=/js/overlib.js/script On 9/27/06, Daniel Castro [EMAIL PROTECTED] wrote: Guys, I am trying to insert some javascripts, the overlib javascript, as an asset of my page asset name=overlib path=context:/js/overlib.js/ But when I test the overlib function and open the sourecode of the generated page the corresponding script/script that should have been writen is not written. How should I include my javascripts inside a page? -- We shall go on to the end. We shall fight in France We shall fightover the seas and oceans. We shall fight with growing confidence and growing strength in the air. We shall defend our island whatever the cost may be We shall fight on beaches, we shall fight on the landing grounds, We shall fight in the fields and in the streets, We shall fight on the hills. We shall never surrender. Winston Churchill -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com