Re: Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid.
Hello Thank you all for your great support! I am using Tapestry 5.2.6. I just found out something what causes this issue. I use a breadcrumb component with a BreadCrumbDispatcher see https://github.com/argoyle/tapestry-breadcrumbs When I don't use this breadcrumb mechanism, everything works fine. When I use this component, I get the error only after I have cleared my web history (cache, cookie etc) and I guess also when my session has expired. Does somebody now understand what might be the cause and how I can fix this? regards, Leon On Oct 28, 2011, at 10:36 AM, Steve Eynon wrote: On what version of T5 are you using and under what circumstances exactly? For on T5.2.6 I can't generate the error with PageLinks or EventLinks. Steve. On 28 October 2011 16:24, Christian Riedel cr.ml...@googlemail.com wrote: I see the same exception in log files for years now. Last thing I remember is that it happened in T5.1 apps already. It's definitely something that tapestry does not always ignore. I'd say, Leon, you should create a JIRA for this! Am 28.10.2011 um 04:49 schrieb Steve Eynon: jsessionid's are unique id's created by the web-server (i.e. jetty or tomcat) when it first creates a session for a client. (In your case, after you login.) It is usually stored in a cookie but it is also equally valid to have them stored as part of refering URLs. (As you are seeing) Often this is only done for the first request / response cycle until your cookie is created. Anyhow, the jsessionid is nothing to do with T5, T5 just has to happily ignore it - which (after a quick check on my sites) it does for T5.1 and T5.3 so I'm not sure where your error is coming from. Steve. On 28 October 2011 04:43, Muhammad Gelbana m.gelb...@gmail.com wrote: Please specify the exact scenario to reproduce this issue and state the version you are using On Thu, Oct 27, 2011 at 12:17 PM, Leon Derks leon.de...@aurumeurope.comwrote: Hello I see this error message a lot. Almost always after my first login attempt... What is causing this error? Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid. regards, Leon - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- *Regards,* *Muhammad Gelbana Java Developer* - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid.
Hello Joakim, That would be great!! regards, Leon On Oct 28, 2011, at 12:23 PM, Joakim Olsson wrote: Hi, Being the author of the breadcrumb component, I can confirm that I have seen that from time to time as well. I can try to find out if there is something that I can do about it or if it has it's roots deeper into the Tapestry code. Regards, Joakim On Fri, Oct 28, 2011 at 11:04 AM, Leon Derks leon.de...@aurumeurope.com wrote: Hello Thank you all for your great support! I am using Tapestry 5.2.6. I just found out something what causes this issue. I use a breadcrumb component with a BreadCrumbDispatcher see https://github.com/argoyle/tapestry-breadcrumbs When I don't use this breadcrumb mechanism, everything works fine. When I use this component, I get the error only after I have cleared my web history (cache, cookie etc) and I guess also when my session has expired. Does somebody now understand what might be the cause and how I can fix this? regards, Leon On Oct 28, 2011, at 10:36 AM, Steve Eynon wrote: On what version of T5 are you using and under what circumstances exactly? For on T5.2.6 I can't generate the error with PageLinks or EventLinks. Steve. On 28 October 2011 16:24, Christian Riedel cr.ml...@googlemail.com wrote: I see the same exception in log files for years now. Last thing I remember is that it happened in T5.1 apps already. It's definitely something that tapestry does not always ignore. I'd say, Leon, you should create a JIRA for this! Am 28.10.2011 um 04:49 schrieb Steve Eynon: jsessionid's are unique id's created by the web-server (i.e. jetty or tomcat) when it first creates a session for a client. (In your case, after you login.) It is usually stored in a cookie but it is also equally valid to have them stored as part of refering URLs. (As you are seeing) Often this is only done for the first request / response cycle until your cookie is created. Anyhow, the jsessionid is nothing to do with T5, T5 just has to happily ignore it - which (after a quick check on my sites) it does for T5.1 and T5.3 so I'm not sure where your error is coming from. Steve. On 28 October 2011 04:43, Muhammad Gelbana m.gelb...@gmail.com wrote: Please specify the exact scenario to reproduce this issue and state the version you are using On Thu, Oct 27, 2011 at 12:17 PM, Leon Derks leon.de...@aurumeurope.comwrote: Hello I see this error message a lot. Almost always after my first login attempt... What is causing this error? Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid. regards, Leon - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- *Regards,* *Muhammad Gelbana Java Developer* - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid.
Thanks guys! But what is now the final conclusion? Is this now a Tapestry issue, because the decodePageRenderRequest doesn't like the ; ? regards, Leon On Oct 28, 2011, at 12:43 PM, Joakim Olsson wrote: Aaah...Sounds like an easy fix. Care to send a pull request at Github? Since you have already solved the problem I mean. :-) /Joakim 2011/10/28 Dávið Klein Sundsskarð d...@amc.dk: Hi, I have had the same issue with the Breadcrumb component. The problem is that the referrer contains a ;, which comes from tapestryRequest.getHeader(Referer) in the BreadCrumbDispatcher. decodePageRenderRequest doesn't like the ; (componentEventLinkEncoder.decodePageRenderRequest(referrerRequest);) I just check the string for ; and set previousPage to null if is true. I've only experienced it to be true after the login page which is never part of the breadcrumb. Not the prettiest workaround but it works... We use Jetty so it isn't a Tomcat issue per se. /david -Original Message- From: Leon Derks [mailto:leon.de...@aurumeurope.com] Sent: 28. oktober 2011 12:29 To: Tapestry users Subject: Re: Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid. Hello Joakim, That would be great!! regards, Leon On Oct 28, 2011, at 12:23 PM, Joakim Olsson wrote: Hi, Being the author of the breadcrumb component, I can confirm that I have seen that from time to time as well. I can try to find out if there is something that I can do about it or if it has it's roots deeper into the Tapestry code. Regards, Joakim On Fri, Oct 28, 2011 at 11:04 AM, Leon Derks leon.de...@aurumeurope.com wrote: Hello Thank you all for your great support! I am using Tapestry 5.2.6. I just found out something what causes this issue. I use a breadcrumb component with a BreadCrumbDispatcher see https://github.com/argoyle/tapestry-breadcrumbs When I don't use this breadcrumb mechanism, everything works fine. When I use this component, I get the error only after I have cleared my web history (cache, cookie etc) and I guess also when my session has expired. Does somebody now understand what might be the cause and how I can fix this? regards, Leon On Oct 28, 2011, at 10:36 AM, Steve Eynon wrote: On what version of T5 are you using and under what circumstances exactly? For on T5.2.6 I can't generate the error with PageLinks or EventLinks. Steve. On 28 October 2011 16:24, Christian Riedel cr.ml...@googlemail.com wrote: I see the same exception in log files for years now. Last thing I remember is that it happened in T5.1 apps already. It's definitely something that tapestry does not always ignore. I'd say, Leon, you should create a JIRA for this! Am 28.10.2011 um 04:49 schrieb Steve Eynon: jsessionid's are unique id's created by the web-server (i.e. jetty or tomcat) when it first creates a session for a client. (In your case, after you login.) It is usually stored in a cookie but it is also equally valid to have them stored as part of refering URLs. (As you are seeing) Often this is only done for the first request / response cycle until your cookie is created. Anyhow, the jsessionid is nothing to do with T5, T5 just has to happily ignore it - which (after a quick check on my sites) it does for T5.1 and T5.3 so I'm not sure where your error is coming from. Steve. On 28 October 2011 04:43, Muhammad Gelbana m.gelb...@gmail.com wrote: Please specify the exact scenario to reproduce this issue and state the version you are using On Thu, Oct 27, 2011 at 12:17 PM, Leon Derks leon.de...@aurumeurope.comwrote: Hello I see this error message a lot. Almost always after my first login attempt... What is causing this error? Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid. regards, Leon - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- *Regards,* *Muhammad Gelbana Java Developer* -- --- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --- -- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e
Re: Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid.
This also works... and now we don't have to set the previousPage to null. public static ReferrerRequest fromUri(final String uri, final Request request) { if (uri == null) { return null; } final String serverRegexp = ^.*:// + request.getServerName() + (: + request.getServerPort() + )? + request.getContextPath(); if (!uri.matches(serverRegexp + .*$)) { return null; } final String path = uri.replaceFirst(serverRegexp, ); int index = path.contains(;jsessionid) ? path.indexOf(;jsessionid) : path.length() - 1; return new ReferrerRequest(path.substring(0, index), request); } On Oct 28, 2011, at 12:43 PM, Joakim Olsson wrote: Aaah...Sounds like an easy fix. Care to send a pull request at Github? Since you have already solved the problem I mean. :-) /Joakim 2011/10/28 Dávið Klein Sundsskarð d...@amc.dk: Hi, I have had the same issue with the Breadcrumb component. The problem is that the referrer contains a ;, which comes from tapestryRequest.getHeader(Referer) in the BreadCrumbDispatcher. decodePageRenderRequest doesn't like the ; (componentEventLinkEncoder.decodePageRenderRequest(referrerRequest);) I just check the string for ; and set previousPage to null if is true. I've only experienced it to be true after the login page which is never part of the breadcrumb. Not the prettiest workaround but it works... We use Jetty so it isn't a Tomcat issue per se. /david -Original Message- From: Leon Derks [mailto:leon.de...@aurumeurope.com] Sent: 28. oktober 2011 12:29 To: Tapestry users Subject: Re: Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid. Hello Joakim, That would be great!! regards, Leon On Oct 28, 2011, at 12:23 PM, Joakim Olsson wrote: Hi, Being the author of the breadcrumb component, I can confirm that I have seen that from time to time as well. I can try to find out if there is something that I can do about it or if it has it's roots deeper into the Tapestry code. Regards, Joakim On Fri, Oct 28, 2011 at 11:04 AM, Leon Derks leon.de...@aurumeurope.com wrote: Hello Thank you all for your great support! I am using Tapestry 5.2.6. I just found out something what causes this issue. I use a breadcrumb component with a BreadCrumbDispatcher see https://github.com/argoyle/tapestry-breadcrumbs When I don't use this breadcrumb mechanism, everything works fine. When I use this component, I get the error only after I have cleared my web history (cache, cookie etc) and I guess also when my session has expired. Does somebody now understand what might be the cause and how I can fix this? regards, Leon On Oct 28, 2011, at 10:36 AM, Steve Eynon wrote: On what version of T5 are you using and under what circumstances exactly? For on T5.2.6 I can't generate the error with PageLinks or EventLinks. Steve. On 28 October 2011 16:24, Christian Riedel cr.ml...@googlemail.com wrote: I see the same exception in log files for years now. Last thing I remember is that it happened in T5.1 apps already. It's definitely something that tapestry does not always ignore. I'd say, Leon, you should create a JIRA for this! Am 28.10.2011 um 04:49 schrieb Steve Eynon: jsessionid's are unique id's created by the web-server (i.e. jetty or tomcat) when it first creates a session for a client. (In your case, after you login.) It is usually stored in a cookie but it is also equally valid to have them stored as part of refering URLs. (As you are seeing) Often this is only done for the first request / response cycle until your cookie is created. Anyhow, the jsessionid is nothing to do with T5, T5 just has to happily ignore it - which (after a quick check on my sites) it does for T5.1 and T5.3 so I'm not sure where your error is coming from. Steve. On 28 October 2011 04:43, Muhammad Gelbana m.gelb...@gmail.com wrote: Please specify the exact scenario to reproduce this issue and state the version you are using On Thu, Oct 27, 2011 at 12:17 PM, Leon Derks leon.de...@aurumeurope.comwrote: Hello I see this error message a lot. Almost always after my first login attempt... What is causing this error? Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid. regards, Leon - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- *Regards,* *Muhammad Gelbana Java Developer* -- --- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid.
Hello I see this error message a lot. Almost always after my first login attempt... What is causing this error? Input string 'login;jsessionid=082793EE9A197CEB7F7750090DD0423D' is not valid; the character ';' at position 6 is not valid. regards, Leon - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
jsessionid in URL results in RequestExceptionHandler
Hello Every once in a while I get the error below after logging in. The jsessionid is then visible in my url. I don't understand why this happens and why this occurs sometimes. Does somebody of you know what is going wrong and what I can do to solve this? regards, Leon ERROR org.apache.tapestry5.services.TapestryModule.RequestExceptionHandler-63 - Processing of request failed with uncaught exception: Input string 'login;jsessionid=76D07FFDD475963D6909F85947390F7A' is not valid; the character ';' at position 6 is not valid. java.lang.IllegalArgumentException: Input string 'login;jsessionid=76D07FFDD475963D6909F85947390F7A' is not valid; the character ';' at position 6 is not valid. at org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:144) at $URLEncoder_1332c6935b7.decode($URLEncoder_1332c6935b7.java) at org.apache.tapestry5.internal.services.ContextPathEncoderImpl.decodePath(ContextPathEncoderImpl.java:92) at $ContextPathEncoder_1332c6935ab.decodePath($ContextPathEncoder_1332c6935ab.java) at org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.checkIfPage(ComponentEventLinkEncoderImpl.java:328) at org.apache.tapestry5.internal.services.ComponentEventLinkEncoderImpl.decodePageRenderRequest(ComponentEventLinkEncoderImpl.java:320) at org.apache.tapestry5.internal.services.linktransform.LinkTransformerInterceptor.decodePageRenderRequest(LinkTransformerInterceptor.java:68) at $ComponentEventLinkEncoder_1332c69359d.decodePageRenderRequest($ComponentEventLinkEncoder_1332c69359d.java) - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Showing Hiding Blocks based on Select
Hello Thanks for your answer. At the moment I am working with Blocks and a t:delegate to=activeBlock/ I think it is almost working, but I want to handle the change event and update the activeBlock when changing the value in the select box. How can I do that? Why do I need a Zone to handle the change event? Because I want to be free in using zones or not. In my case the zone div breaks my page layout... On entering the page, the activeBlock is working fine. Now I only need to handle the change event from the select. Do you know how I can do this? regards, Leon On Oct 12, 2011, at 12:29 AM, Thiago H. de Paula Figueiredo wrote: On Tue, 11 Oct 2011 15:15:28 -0300, Leon Derks leon.de...@aurumeurope.com wrote: Hello Hi! In my page I have a form with a select. (see below) Based on this select I want to show/hide different Blocks with tr elements. What is the best way to do this? I tried to use a zone, but the zone div is automatically moved to the top of the page and I don't want that. How can I show/hide tr elements based on the value I have selected? Do you really need server-side processing? If not, just give an id the trs you want and use JavaScript to show or hide them. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br
NumberFormatter
I have a TextField that shows a double value. But I want to format the value in the Textfield as a decimal with 4 decimals (i.e. 0.1234) In Tapestry there is a NumericFormatter and a BigDecimalNumericFormatter. But I can't find any documentation on how to use these on a TextField. Can someone give me an example how I can format my double value into a decimal value with 4 decimals? regards, Leon - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: NumberFormatter
Hello Chris, Thank you. Yes I have already seen that page, but I couldn't find an example with a FieldTranslator. Does anyone have an example how to do this? regards, Leon On Oct 12, 2011, at 11:57 AM, derkoe wrote: Leon Derks wrote: I have a TextField that shows a double value. But I want to format the value in the Textfield as a decimal with 4 decimals (i.e. 0.1234) In Tapestry there is a NumericFormatter and a BigDecimalNumericFormatter. But I can't find any documentation on how to use these on a TextField. Can someone give me an example how I can format my double value into a decimal value with 4 decimals? regards, Leo For input fields (such as TextField) you can add a parameter translate of type FieldTranslator which translates between the object (e.g. BigDecimal) and the String representation in the input. See: http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/TextField.html You can also define your translator globally by contributing to TranslatorSource. -- Chris -- View this message in context: http://tapestry.1045711.n5.nabble.com/NumberFormatter-tp4894812p4894939.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: NumberFormatter
Hello all, Thanks for your support. It was quite some work, but I managed to get it working.. For everybody else who is struggling with this, here is my code for Tapestry 5.2.6 Page.tml input type=text t:type=textfield t:id=currencyInput t:validate=required value=price translate=currency / CurrencyTranslator.java import java.text.DecimalFormat; import org.apache.tapestry5.Field; import org.apache.tapestry5.MarkupWriter; import org.apache.tapestry5.ValidationException; import org.apache.tapestry5.internal.translator.AbstractTranslator; import org.apache.tapestry5.services.FormSupport; public class CurrencyTranslator extends AbstractTranslatorDouble { private static DecimalFormat decimalFormat = new DecimalFormat(0.); public CurrencyTranslator() { super(currency, Double.class, currency-format-exception); } @Override public String toClient(Double value) { return decimalFormat.format(value); } @Override public Double parseClient(Field field, String clientValue, String message) throws ValidationException { Double returnValue = null; if(clientValue != null) { try{ returnValue = Double.valueOf(clientValue); } catch(Exception e) { throw new ValidationException(message); } } return returnValue; } @Override public void render(Field field, String message, MarkupWriter writer, FormSupport formSupport) { } } AppModule.java public static void contributeTranslatorSource(MappedConfigurationClass, Translator configuration) { configuration.override(Double.class, new CurrencyTranslator()); } On Oct 12, 2011, at 12:34 PM, Muhammad Gelbana wrote: When you need to contribute a configuration or anything to tapestry, first check this page: http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/TapestryModule.html Find the method likely to satisfy your need, like in your case here: http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/TapestryModule.html#contributeTranslatorSource(org.apache.tapestry5.ioc.MappedConfiguration, org.apache.tapestry5.internal.translator.NumericTranslatorSupport) Google it to see it in action: http://www.google.com.eg/search?gcx=wsourceid=chromeie=UTF-8q=contributeTranslatorSource#sclient=psy-abhl=ensource=hpq=tapestry+%22contributeTranslatorSource%22pbx=1oq=tapestry+%22contributeTranslatorSource%22aq=faqi=aql=gs_sm=egs_upl=13088l14418l1l14680l2l3l0l0l0l0l0l0ll1l0bav=on.2,or.r_gc.r_pw.,cf.osbfp=127c72f3b5eca502biw=1366bih=643 Check those links too: http://tapestryjava.blogspot.com/2008/09/tapestry-5-ioc-introducing-service.html http://jumpstart.doublenegative.com.au/jumpstart/examples/input/translators1 http://jumpstart.doublenegative.com.au/jumpstart/examples/input/creatingtranslators1 Then love tapestry even more :) Good luck. On Wed, Oct 12, 2011 at 12:04 PM, Leon Derks leon.de...@aurumeurope.comwrote: Hello Chris, Thank you. Yes I have already seen that page, but I couldn't find an example with a FieldTranslator. Does anyone have an example how to do this? regards, Leon On Oct 12, 2011, at 11:57 AM, derkoe wrote: Leon Derks wrote: I have a TextField that shows a double value. But I want to format the value in the Textfield as a decimal with 4 decimals (i.e. 0.1234) In Tapestry there is a NumericFormatter and a BigDecimalNumericFormatter. But I can't find any documentation on how to use these on a TextField. Can someone give me an example how I can format my double value into a decimal value with 4 decimals? regards, Leo For input fields (such as TextField) you can add a parameter translate of type FieldTranslator which translates between the object (e.g. BigDecimal) and the String representation in the input. See: http://tapestry.apache.org/current/tapestry-core/ref/org/apache/tapestry5/corelib/components/TextField.html You can also define your translator globally by contributing to TranslatorSource. -- Chris -- View this message in context: http://tapestry.1045711.n5.nabble.com/NumberFormatter-tp4894812p4894939.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- *Regards,* *Muhammad Gelbana
Showing Hiding Blocks based on Select
Hello In my page I have a form with a select. (see below) Based on this select I want to show/hide different Blocks with tr elements. What is the best way to do this? I tried to use a zone, but the zone div is automatically moved to the top of the page and I don't want that. How can I show/hide tr elements based on the value I have selected? regards, Leon tr class=even thType/th td select t:type=select t:id=typeSelect value=type/ /td /tr t:block id=blockHighLow tr class=odd thHigh/th td input type=text size=50 / /td /tr tr class=even thLow/th td input type=text size=50 / /td /tr /t:block t:block id=normalBlock tr class=odd thNormal/th td input type=text size=50 t:type=textfield t:id=usageInput value=energyBill.consumption.value / /td /tr /t:block
Re: How to implement nested components?
Thanks for your reply! Actually, I want to know how to implement nested components. I will show you my scenario: 1. Requirment: A wizard that include some step to guide users complete a task, e.g. a sale order 2. Current Implementation: I implemented two components Wizard and WizardStep, and use them like this: t:wizard steps=[step1,step2,step3] t:wizardStep name=step1 step1 content /t:wizardStep t:wizardStep name=step2 step2 content /t:wizardStep t:wizardStep name=step3 step3 content /t:wizardStep /t:wizard // wizard class @Property private WizardStep[] steps; in this way, I need to pass WizardSteps as Property. But I want to use them as follows: t:wizard t:wizardStep name=step1 step1 content /t:wizardStep t:wizardStep name=step2 step2 content /t:wizardStep t:wizardStep name=step3 step3 content /t:wizardStep /t:wizard //wizard class @Inject private ComponentResources resources; private WizardStep[] steps; @SetupRender private viod setupRender(){ //initialize steps by iterate child components steps = initSteps(); } //I want to use ComponentResources to get WizardSteps ids then use getEmbeddedComponent() to get WizardStep instance. private void initSteps() { ListString stepIds = resources.getComponentModel().getEmbeddedComponentIds(); //Why stepIds is empy! so the follows codes will never execute! steps = new WizardStep[stepIds.size())]; int i = 0; for (String stepId: stepIds){ steps[i++] = resources.getEmbeddedComponent(stepId); } } I am really confused, what's wrong with my second implementing? Any suggestion? Thanks! On Wed, Mar 23, 2011 at 8:17 PM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: On Tue, 22 Mar 2011 22:56:28 -0300, leon mail@gmail.com wrote: Sorry, My question is :are there some documentations about nested components? All components are nested, so I don't know what you're asking. A non-page component instance doesn't exist outside a page, which is almost the same as a component, so all components are nested. I tried to inspect the component in debug model, but they're all null objects, I'm using IDEA 10, I don't know if is caused by IDE or Tapestry IoC. This is not caused by the IDE or Tapestry-IoC, but by Tapestry(-core) itself. It was already solved for 5.3-SNAPSHOT. So how could i trace a component's lifecycle? See this: http://tapestry.apache.org/component-rendering.html. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br -- Best Regards Li Guoqiang
Re: How to implement nested components?
Sorry, My question is :are there some documentations about nested components? I tried to inspect the component in debug model, but they're all null objects, I'm using IDEA 10, I don't know if is caused by IDE or Tapestry IoC. So how could i trace a component's lifecycle? On Mon, Mar 21, 2011 at 8:41 PM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: On Sun, 20 Mar 2011 22:50:20 -0300, leon mail@gmail.com wrote: Thanks a lot, I will try it, I looks Tapestry's component's relationship is build by component class rather than component template. Wrong. It's defined by template. Using @InjectComponent or getEmbeddedComponent() is just a way of getting the nested component instance. So, are there some dos about this? Could you rephrase your question? -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br -- Best Regards Li Guoqiang
Re: How to implement nested components?
Thanks a lot, I will try it, I looks Tapestry's component's relationship is build by component class rather than component template. So, are there some dos about this? On Sat, Mar 19, 2011 at 9:37 PM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: On Sat, 19 Mar 2011 01:16:21 -0300, Taha Hafeez tawus.tapes...@gmail.com wrote: resources.getContainerResources().getEmbeddedComponent(nested_component_id); Also this: @InjectComponent private ComB comB; // the name of the field should be the same as the component's t:id or @InjectComponent(componentId) private ComB anyFieldname; -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Best Regards Li Guoqiang
How to implement nested components?
Hi all, I have a requirement to implement nested components, it like this: t:comA t:comB/ t:comB/ t:comB/ /t:comA I have created components, but I can't access embedded components in comA: public class comA { @Inject private ComponentResources resources; void setupRender() { ComponentModel model = resources.getComponentModel(); ListString embeddedIds = model.getEmbeddedIds(); // The problem is that embeddedIds.size() is 0! } } So, Is this a wrong way? I'm so confused. Any idea? thanks! -- Best Regards Li Guoqiang
How to inject Spring Bean by name?
Hi all, We need to inject more than one implementings of service interface, so how to do that? Thanks! -- Best Regards Li Guoqiang
Re: How to inject Spring Bean by name?
I think Tapestry-spring shout support inject by name out of box. On Thu, Mar 17, 2011 at 10:28 AM, Jonathan Barker jonathan.theit...@gmail.com wrote: You can either inject the ApplicationContext and get the bean from that, or you can try what is described here: http://stackoverflow.com/questions/2684171/tapestry-5-and-spring-beans-with-same-interface I haven't tried it myself, but it is a way around the current limitation of Spring bean injection in Tapestry. On Wed, Mar 16, 2011 at 9:22 PM, leon mail@gmail.com wrote: Hi all, We need to inject more than one implementings of service interface, so how to do that? Thanks! -- Best Regards Li Guoqiang -- Jonathan Barker ITStrategic -- Best Regards Li Guoqiang
Re: How to inject Spring Bean by name?
Thanks ,got it. On Thu, Mar 17, 2011 at 11:38 AM, Thiago H. de Paula Figueiredo thiag...@gmail.com wrote: On Thu, 17 Mar 2011 00:37:19 -0300, Jonathan Barker jonathan.theit...@gmail.com wrote: This is only the case when 5.0 compatibility mode has been enabled. This is something that broke (well, broke some of my stuff) between 5.0 and 5.1. I stand corrected. :) I've been using the compatibility mode since 5.1 came out, so I didn't remember this detail. Thanks Jonathan! -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br -- Best Regards Li Guoqiang
Re: How to pass parameters from a Page to another Page in java code?
It works! Thanks a lot! On Mon, Feb 21, 2011 at 3:18 PM, Taha Hafeez tawus.tapes...@gmail.comwrote: On Mon, Feb 21, 2011 at 9:50 AM, leon mail@gmail.com wrote: Hi All, Hi I know that we can pass a parameter through context attribute of tag in template, but how to achieve it in java code? like this: public class Edit { @Property @Autowired private Employee employee; @InjectPage private View view; @Log Object onSuccess() { employee.persist(); view.setEmployeeId(employee.getId()); // Pass parameter employeeId to view Page return view; } } public class View { @Parameter private Long employeeId; public void setEmployeeId(Long employeeId){ this.employeeId = employeeId; } Long onPassivate(){ return employeeId; } @Property private Employee employee; void onActivate(Long employeeId) { if (employeeId != null) employee = Employee.findEmployee(employeeId); } } Thanks! -- Best Regards Rock Lee regards Taha -- Best Regards Li Guoqiang
How to pass parameters from a Page to another Page in java code?
Hi All, I know that we can pass a parameter through context attribute of tag in template, but how to achieve it in java code? like this: public class Edit { @Property @Autowired private Employee employee; @InjectPage private View view; @Log Object onSuccess() { employee.persist(); // Pass parameter employeeId to view Page return view; } } public class View { @Parameter private Long employeeId; @Property private Employee employee; void onActivate(Long employeeId) { if (employeeId != null) employee = Employee.findEmployee(employeeId); } } Thanks! -- Best Regards Rock Lee
Re: [T5] 5.0.17 URLEncoderImpl.decode error
He Martijn, The URL is not really generated. I was playing with Freemarker (Java template engine). I tried it to send a mail... The URL is in the mail template and the email param is replaced by freemarker: a href=http://localhost:8090/tapestry/test/user/${user.userEmail}/ My test was to send an email with freemarker with a link in it. I want to be able to click that link and show the email on the screen. So for me it is not handy that the URL encoding has changed, because I can not use the org.apache.tapestry5.internal.services.URLEncoderImpl inside my template. Any ideas how I can solve this? greetz, Leon Martijn Brinkers wrote: I guess the URL is generated outside of Tapestry? because if you passivate or create a link from Tapestry the parameters are encoded with the Tapestry 'special' encoding. You can probably use the default encoder implementation if you want to encode from outside of Tapestry: org.apache.tapestry5.internal.services.URLEncoderImpl Martijn Brinkers On Wed, 2008-12-10 at 23:43 +0100, Leon Derks wrote: Hi Martijn, Thanks! Yes, http://localhost:8090/tapestry/test/user/user$0040company.com works, when I change the @ into $0040 manually. But how can I automatically translate @ into $0040, because my code still generates the '@' character in the url. greetz, Leon Martijn Brinkers wrote: The URL encoder has been changed. @ for example is now encoded as $0040 See https://issues.apache.org/jira/browse/TAP5-302 Search the archive for what and why things have changed http://tapestry.markmail.org Martijn Brinkers On Wed, 2008-12-10 at 23:19 +0100, Leon Derks wrote: Hello This evening I tried tapestry 5.0.17 When I type in the following url in my application: http://localhost:8090/tapestry/test/user/[EMAIL PROTECTED] I do get an java.lang.IllegalArgumentException It says: Input string '[EMAIL PROTECTED]' is not valid; the character '@' at position 5 is not valid. Stacktrace: org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143) org.apache.tapestry5.internal.services.ContextPathEncoderImpl.decodePath(ContextPathEncoderImpl.java:70) org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRenderDispatcher.java:88) org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:71) org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:1029) I didn't had this problem in tapestry 5.0.14. I searched in the changes, but couldn't find a change that would cause this error. Any ideas? Leon - 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] __ NOD32 3682 (20081210) Informatie __ Dit bericht is gecontroleerd door het NOD32 Antivirus Systeem. http://www.nod32.nl - 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] __ NOD32 3682 (20081210) Informatie __ Dit bericht is gecontroleerd door het NOD32 Antivirus Systeem. http://www.nod32.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What's the easiest way to implement two dependent select lists ?
Indeed I agree with Hugo. I had this use case a couple of times and solved it in the same way as Hugo did. I also hoped there is an easier way to implement dependable selects, using zones... Also filling selects with objects is not really easy. I need to implement a selection model and a value encoder. I have the feeling that things are more complicated than they should be. For example, it would be easier to add a select into my page and bind a list with objects to it with setting the labelField and idField to object properties. So like this; select t:type=select t:id=productSelect model=productList labelField=name, idField=id value=selectedProduct / I get the feeling that sometimes tapestry 5 is doing things to complicated. Leon Hugo Palma wrote: Everything i used in the example is built into Tapestry except the OnEvent mixin that is provided by the library t5-components(http://87.193.218.134:8080/t5components/index.html). The javascript stuff is part of prototype that is already bundled with Tapestry. James Hillyerd wrote: Hugo, That's a great example. I think this belongs on the Wiki! Is the JSON stuff built into Tapestry, or do I need a third party library for that? -james On Tue, Dec 9, 2008 at 10:17 AM, Hugo Palma [EMAIL PROTECTED] wrote: Here's how i'm doing this now: On the source select i'm using the OnEvent mixin to fire the change event: select t:id=operator t:type=select t:mixins=commons/onEvent t:event=change t:onCompleteCallback=onCompleteOperatorChange .../ The event listener method is then responsible for querying the database for the value to be set in the destination select: @OnEvent(component = operator, value = change) public JSONArray onChangeOperatorEvent(String value) { JSONArray jsonArray = new JSONArray(); for (Plaza plaza : getDestinationSelectValues(value)) { JSONObject jsonObject = new JSONObject(); jsonObject.put(value, plaza.getId()); jsonObject.put(label, plaza.getDescription()); jsonArray.put(jsonObject); } return jsonArray; } Finally, the onCompleteOperatorChange javascript function has to parse the return JSON and update the select input options: function onCompleteOperatorChange(response) { selectElement = $(entryPlaza); responseJSON = response.evalJSON(); while (selectElement .options.length 0) { selectElement .options[0] = null; } for (index = 0; index responseJSON .length; index++) { selectElement.options[index] = new Option(responseJSON [index].label, responseJSON [index].value); } Tapestry.ElementEffect.highlight($(entryPlaza)); } It would make things a little easier if the selects weren't inside a form because then my event listener method could return the component instance itself and then on the client i would just have to replace the current element with the new rendered one. On Sun, Dec 7, 2008 at 10:46 PM, Hugo Palma [EMAIL PROTECTED] wrote: I'm already using the OnEvent component. Still, because the model of the select list i want to update is calculated server-side i need to pass it in json to the client, parse it again in javascript and then update the select input. This does work but i feel that there should be a simpler way of doing this, maybe using zones. thermus wrote: I'm a Tapestry novice, but you may want to have a look at http://code.google.com/p/tapestry5-components/ t5components . It allows you to add a mixin to components to respond to an OnChange event with AJAX (see: http://87.193.218.134:8080/t5c-demo/oneventpage this and http://87.193.218.134:8080/t5components/t5c-commons/ref/org/apache/tapestry/commons/mixins/OnEvent.html this for details). You could then change the data model for the other select component with a tiny bit of JavaScript in the onCompleteCallback function. I'm curious how a Tapestry expert would handle it. HugoPalma wrote: I have a very usual use where in a form i have two selects, and when the user selects a value on one the values on the second should be filtered accordingly. As the Select component doesn't support ajax out-of.the-box i see myself forced to implement a lot of plumbing and javascript stuff. Still, i feel that this kind of use case should be much easier to implement. Maybe i'm missing something. I'd like to hear some ideas about how u would handle this. Thanks. __ NOD32 3680 (20081210) Informatie __ Dit bericht is gecontroleerd door het NOD32 Antivirus Systeem. http://www.nod32.nl - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T5] 5.0.17 URLEncoderImpl.decode error
Hello This evening I tried tapestry 5.0.17 When I type in the following url in my application: http://localhost:8090/tapestry/test/user/[EMAIL PROTECTED] I do get an java.lang.IllegalArgumentException It says: Input string '[EMAIL PROTECTED]' is not valid; the character '@' at position 5 is not valid. Stacktrace: org.apache.tapestry5.internal.services.URLEncoderImpl.decode(URLEncoderImpl.java:143) org.apache.tapestry5.internal.services.ContextPathEncoderImpl.decodePath(ContextPathEncoderImpl.java:70) org.apache.tapestry5.internal.services.PageRenderDispatcher.process(PageRenderDispatcher.java:88) org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:71) org.apache.tapestry5.services.TapestryModule$17.service(TapestryModule.java:1029) I didn't had this problem in tapestry 5.0.14. I searched in the changes, but couldn't find a change that would cause this error. Any ideas? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Include multiple css in @IncludeStylesheet
Hello How can I add multiple stylesheets to the @includeSysheet annotation? In the documentation I read that one or more paths can be injected. But how can I do that? For example I want something like this: @IncludeStylesheet(context:css/page.css, context:css/tapestry-custom.css) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T4.0 PropertySelection + onChange
Hello Is it possible to catch an onchange Event for the PropertySelection component? I don't want the form te be submitted, but want to update a section in my page. I use tapestry 4.0.2 with Java 1.4 Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: url localization
I know that localization support is well integrated into Tapestry 5, but is it also possible to get localized urls? Example: english: http://www.someserver.com/cars/15 german: http://www.someserver.com/autos/15 If so, how can I do that? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: tapestry-test tutorial, sceencast?
I want to use the tapestry-test module, but can't find much information about how to get started. Is there some kind of screencast or tutorial planned for how to use the tapestry-test module with all kind of examples? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Setup render for authentication check?
Hello Is the SetupRender method the correct place to check if the user has the priviliges to view the page? For example something like this: @SetupRender boolean setupRender() { if(user has priviliges) { return true; } return false; } Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
show page title in layout component
Hello I use a layout component for all my pages, like below. But for some reason, the page title is not passed to the layout component. What am I doing wrong? Leon Page.tml html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; t:type=layout title=${message:page-title} . /html Laout.tml: ?xml version=1.0 encoding=utf-8? !DOCTYPE HTML PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; head meta http-equiv=Content-Type content=text/html;charset=utf-8 / link rel=shortcut icon href=${asset:favicon.ico}/ title${title}/title /head body div id=container t:branding t:id=branding / t:heading t:id=heading t:breadCrumbs=basePage.breadCrumbHolder.breadCrumbs / t:body / t:copyright t:id=copyright / /div /body /html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: get name of Start page
Hello Is it possible to get the name of the (default) start page? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Exception Handling
Hi Filip, I use an Transaction Filter where I catch all exceptions (see code part below). But can I use your redirect service in my catch part? I tried to get it work, but had no success. public RequestFilter buildTransactionFilter(final EntityManager entityManager, final RedirectService redirectService, final Logger logger) { return new RequestFilter() { EntityTransaction transaction; public boolean service(Request request, Response response, RequestHandler handler) throws IOException { boolean result = false; try { transaction = entityManager.getTransaction(); transaction.begin(); result = handler.service(request, response); transaction.commit(); } catch (Exception exception) { logger.error(exception.toString()); if (transaction.isActive()) { transaction.rollback(); } result = false; redirectService.sendRedirect(Error.class, false); } finally { entityManager.close(); } return result; } }; } Filip S. Adamsen wrote: Hi Leon, How to override server error pages depends on what server you're using. As far as I'm aware it's unfortunately not possible to use Tapestry pages as server error pages - if I'm wrong here, I'd really like to know how to do it. :) What I mean by turning the RequestExceptionHandler into a pipeline is that I've overridden the original service with my own that uses a pipeline. http://tapestry.apache.org/tapestry5/tapestry-ioc/pipeline.html So I define my filter: public interface RequestExceptionFilter { void handleRequestException(Throwable exception, RequestExceptionHandler handler) throws IOException; } Then I create a new RequestExceptionHandler as a pipeline: public static RequestExceptionHandler buildImprovedRequestExceptionHandler( ListRequestExceptionFilter configuration, @InjectService(RequestExceptionHandler) RequestExceptionHandler requestExceptionHandler, PipelineBuilder builder, Logger logger ) { return builder.build( logger, RequestExceptionHandler.class, RequestExceptionFilter.class, configuration, requestExceptionHandler ); } I then contribute this to AliasOverrides to replace the default RequestExceptionHandler: public static void contributeAliasOverrides( ConfigurationAliasContribution configuration, @InjectService(ImprovedRequestExceptionHandler) RequestExceptionHandler requestExceptionHandler ) { configuration.add(AliasContribution.create(RequestExceptionHandler.class, requestExceptionHandler)); } I can then contribute filters to the pipeline like this: public static void contributeImprovedRequestExceptionHandler( OrderedConfigurationRequestExceptionFilter configuration, RequestExceptionErrorFilter requestExceptionErrorFilter ) { configuration.add(Error, requestExceptionErrorFilter); } Where RequestExceptionErrorFilter looks like this: public class RequestExceptionErrorFilter implements RequestExceptionFilter { private final RedirectService redirectService; private final SecurityService securityService; private final Logger logger; public RequestExceptionErrorFilter(RedirectService redirectService, SecurityService securityService, Logger logger) { this.redirectService = redirectService; this.securityService = securityService; this.logger = logger; } public void handleRequestException(Throwable exception, RequestExceptionHandler handler) throws IOException { if (securityService.isProductionModeEnabled()) { logger.error(Exception during request, exception); redirectService.sendRedirect(ErrorIndex.class, false); } else { handler.handleRequestException(exception); } } } RedirectService and SecurityService are my own classes. They just make some things easier for me. As you can see I show an error page when I'm in production but invoke the next filter in the pipeline if I'm not. You could contribute more filters if needed. I've been wanting to contribute a strategy filter before this one allowing to do different things depending on the type of exception thrown, but haven't had the time nor need to do so yet. http://tapestry.apache.org/tapestry5/tapestry-ioc/strategy.html Anyhow, hope this helps - if not, you know where to ask. :) -Filip On 2008-05-16 17:37, Leon Derks wrote: Thanks Peter, Your original question in the post is also what I would like to know. Do you now know how to override server error pages(404, 505 etc)? And I don't understand what Flip means with :I've turned the RequestExceptionHandler service
Re: T5: Exception Handling
Hi Filip, Thanks for your answer. I understand now. But one final question. How does your redirectService looks like? Leon Filip S. Adamsen wrote: Hi Leon, How to override server error pages depends on what server you're using. As far as I'm aware it's unfortunately not possible to use Tapestry pages as server error pages - if I'm wrong here, I'd really like to know how to do it. :) What I mean by turning the RequestExceptionHandler into a pipeline is that I've overridden the original service with my own that uses a pipeline. http://tapestry.apache.org/tapestry5/tapestry-ioc/pipeline.html So I define my filter: public interface RequestExceptionFilter { void handleRequestException(Throwable exception, RequestExceptionHandler handler) throws IOException; } Then I create a new RequestExceptionHandler as a pipeline: public static RequestExceptionHandler buildImprovedRequestExceptionHandler( ListRequestExceptionFilter configuration, @InjectService(RequestExceptionHandler) RequestExceptionHandler requestExceptionHandler, PipelineBuilder builder, Logger logger ) { return builder.build( logger, RequestExceptionHandler.class, RequestExceptionFilter.class, configuration, requestExceptionHandler ); } I then contribute this to AliasOverrides to replace the default RequestExceptionHandler: public static void contributeAliasOverrides( ConfigurationAliasContribution configuration, @InjectService(ImprovedRequestExceptionHandler) RequestExceptionHandler requestExceptionHandler ) { configuration.add(AliasContribution.create(RequestExceptionHandler.class, requestExceptionHandler)); } I can then contribute filters to the pipeline like this: public static void contributeImprovedRequestExceptionHandler( OrderedConfigurationRequestExceptionFilter configuration, RequestExceptionErrorFilter requestExceptionErrorFilter ) { configuration.add(Error, requestExceptionErrorFilter); } Where RequestExceptionErrorFilter looks like this: public class RequestExceptionErrorFilter implements RequestExceptionFilter { private final RedirectService redirectService; private final SecurityService securityService; private final Logger logger; public RequestExceptionErrorFilter(RedirectService redirectService, SecurityService securityService, Logger logger) { this.redirectService = redirectService; this.securityService = securityService; this.logger = logger; } public void handleRequestException(Throwable exception, RequestExceptionHandler handler) throws IOException { if (securityService.isProductionModeEnabled()) { logger.error(Exception during request, exception); redirectService.sendRedirect(ErrorIndex.class, false); } else { handler.handleRequestException(exception); } } } RedirectService and SecurityService are my own classes. They just make some things easier for me. As you can see I show an error page when I'm in production but invoke the next filter in the pipeline if I'm not. You could contribute more filters if needed. I've been wanting to contribute a strategy filter before this one allowing to do different things depending on the type of exception thrown, but haven't had the time nor need to do so yet. http://tapestry.apache.org/tapestry5/tapestry-ioc/strategy.html Anyhow, hope this helps - if not, you know where to ask. :) -Filip On 2008-05-16 17:37, Leon Derks wrote: Thanks Peter, Your original question in the post is also what I would like to know. Do you now know how to override server error pages(404, 505 etc)? And I don't understand what Flip means with :I've turned the RequestExceptionHandler service into a pipeline. Can you show me some code of how to do this? Leon Peter Stavrinides wrote: Hi Leon I posted a number of questions to the list about this topic, but got only a few perls. One of them was this post, particularly Filip's answer: http://www.mail-archive.com/users@tapestry.apache.org/msg21914.html Also see this page, for how to override Tapestry's error page with your own friendly error page: http://wiki.apache.org/tapestry/Tapestry5ExceptionPage I am not sure what you are trying to do, but would suggest you familiarize yourself a bit more with Tapestry's error reporting mechanisms, which imho are incredibly powerful and easy to use. Hope this helps, Peter - Original Message - From: Leon Derks [EMAIL PROTECTED] To: Tapestry users users@tapestry.apache.org Sent: Friday, 16 May, 2008 1:35:19 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: T5: Exception Handling Hello What is the best way to handle exceptions in Tapestry 5? I want to show some kind of general error page, when an exception occurs. At the moment I have a onException method in my BasePage class. But for some
T5: Exception Handling
Hello What is the best way to handle exceptions in Tapestry 5? I want to show some kind of general error page, when an exception occurs. At the moment I have a onException method in my BasePage class. But for some reason the Error page is not returned. What is the way in T5 to handle exceptions? Object onException(Throwable cause) { return new Error(); } Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Exception Handling
Thanks Peter, Your original question in the post is also what I would like to know. Do you now know how to override server error pages(404, 505 etc)? And I don't understand what Flip means with :I've turned the RequestExceptionHandler service into a pipeline. Can you show me some code of how to do this? Leon Peter Stavrinides wrote: Hi Leon I posted a number of questions to the list about this topic, but got only a few perls. One of them was this post, particularly Filip's answer: http://www.mail-archive.com/users@tapestry.apache.org/msg21914.html Also see this page, for how to override Tapestry's error page with your own friendly error page: http://wiki.apache.org/tapestry/Tapestry5ExceptionPage I am not sure what you are trying to do, but would suggest you familiarize yourself a bit more with Tapestry's error reporting mechanisms, which imho are incredibly powerful and easy to use. Hope this helps, Peter - Original Message - From: Leon Derks [EMAIL PROTECTED] To: Tapestry users users@tapestry.apache.org Sent: Friday, 16 May, 2008 1:35:19 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: T5: Exception Handling Hello What is the best way to handle exceptions in Tapestry 5? I want to show some kind of general error page, when an exception occurs. At the moment I have a onException method in my BasePage class. But for some reason the Error page is not returned. What is the way in T5 to handle exceptions? Object onException(Throwable cause) { return new Error(); } Leon - 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: editing textfields values from a collection
I have an object which contains a collection with a maximum of 3 descriptions. I want to be able to edit the descriptions on the same page. At the moment I loop through the collection and print the descriptions in its own textfield on the screen. But I also want to be able to edit the textfield values, when I click the save button. How can I do this? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: JSONArray + fillling
Thanks, How can I loop through the jsonObjects in javascript? I have now something like this: array.each(function(item) { item[0] item[1] //fill options with the item. } But I get undefined text in for my select option values. The number of items in my select is correct, but the key-value is set to undefined Leon Lance Java wrote: JSONArray options = new JSONArray(); for(Group group : ListGroup groups) { JSONObject obj = new JSONObject(); obj.put(group.getId, group.getName()); options.put(obj); } Cheers, Lance. 2008/5/14 Leon Derks [EMAIL PROTECTED]: Can you give me an example of that? Leon Lance Java wrote: You want a JSONObject not a JSONArray http://tapestry.formos.com/nightly/tapestry5/apidocs/index.html Cheers, Lance. 2008/5/14 Leon Derks [EMAIL PROTECTED]: Hello I found this example: new JSONArray([['a', 'value a'], ['b', 'value b'], ['c', 'value c'], ['d', 'value d']])); The JSONArray contains information for my select box, with a value - label pair. But in my case, I want to make a new JSONArray filled with properties from my List of Groups. So for example something like this: for(Group group : ListGroup groups) { jsonArray.put(group.getId, group.getName()); } The problem is that a put operation only allows put(Object value) and put(int index, Object value); How can I add the group.getId and group.getName() as a value-label pair to the JSONArray? Leon - 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 + JSON + key name
Hi Sven, I only see that they get the value by using the key name. For example this: |var data = '{ name: Violet, occupation: character }'.evalJSON(); data.name; //prints Violet. | But in my case, I don't know the key name, so I can't get the value. Is there a way to get the key names of a JSON Object? For example something like this: | data.keys; //returns {name, occupation}| | | Leon Sven Homburg wrote: http://www.prototypejs.org/learn/json 2008/5/15 Leon Derks [EMAIL PROTECTED]: Hello I have a JSON object like this: JSONObject obj = new JSONObject(); obj.put(entity.getId(), entity.getName()); But how can I get the value from my json object in javascript, if I don't know the key name? Is there a way to get the key name(s) from a json object in javascript? Leon - 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 + JSON + key name
Thanks Chris, That worked. The only thing is that the order of groups in the select is gone. I know for sure I put them in the correct order in the java jsonObject. I think the var jsonObject = response.evalJSON(); or the for(var key in jsonObject) messes up the order. Is there a way to solve this? For the ones interested, I fill my select box now in this way: Java Page: @OnEvent(component = productSelect, value = change) JSONObject onProductSelectChanged(String value) { ProductCategory category = ProductCategory.getProductCategoryByName(value); groups = characteristicDAO.findGroupsByProductCategory(category); JSONObject jsonObject = new JSONObject(); for (CharacteristicGroup group : groups) { Long id = group.getId(); jsonObject.put(id.toString(), group.getName()); } return jsonObject; } javascript: function productSelectChanged(response) { var groupSelect = $('groupSelect'); clearSelectOption(groupSelect); var jsonObject = response.evalJSON(); for(var key in jsonObject) { addSelectOption(groupSelect, jsonObject[key], key, false); } } Chris Lewis wrote: Try: for (var i in object) {} Where object would be your json object. Leon Derks wrote: Hi Sven, I only see that they get the value by using the key name. For example this: |var data = '{ name: Violet, occupation: character }'.evalJSON(); data.name; //prints Violet. | But in my case, I don't know the key name, so I can't get the value. Is there a way to get the key names of a JSON Object? For example something like this: | data.keys; //returns {name, occupation}| | | Leon Sven Homburg wrote: http://www.prototypejs.org/learn/json 2008/5/15 Leon Derks [EMAIL PROTECTED]: Hello I have a JSON object like this: JSONObject obj = new JSONObject(); obj.put(entity.getId(), entity.getName()); But how can I get the value from my json object in javascript, if I don't know the key name? Is there a way to get the key name(s) from a json object in javascript? Leon - 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 + JSON + key name
Hello I have a JSON object like this: JSONObject obj = new JSONObject(); obj.put(entity.getId(), entity.getName()); But how can I get the value from my json object in javascript, if I don't know the key name? Is there a way to get the key name(s) from a json object in javascript? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 + JSON + key name
Hi Chris, I just noticed that the options in the select are initialy not ordered. But when I persist the options (groups) in my session data, the option are ordered after I have clicked the search button and submitted the form. Then refreshed page, contains a select with ordered group options. Do you have an explanation for this behaviour? Leon Leon Derks wrote: Thanks Chris, That worked. The only thing is that the order of groups in the select is gone. I know for sure I put them in the correct order in the java jsonObject. I think the var jsonObject = response.evalJSON(); or the for(var key in jsonObject) messes up the order. Is there a way to solve this? For the ones interested, I fill my select box now in this way: Java Page: @OnEvent(component = productSelect, value = change) JSONObject onProductSelectChanged(String value) { ProductCategory category = ProductCategory.getProductCategoryByName(value); groups = characteristicDAO.findGroupsByProductCategory(category); JSONObject jsonObject = new JSONObject(); for (CharacteristicGroup group : groups) { Long id = group.getId(); jsonObject.put(id.toString(), group.getName()); } return jsonObject; } javascript: function productSelectChanged(response) { var groupSelect = $('groupSelect'); clearSelectOption(groupSelect); var jsonObject = response.evalJSON(); for(var key in jsonObject) { addSelectOption(groupSelect, jsonObject[key], key, false); } } Chris Lewis wrote: Try: for (var i in object) {} Where object would be your json object. Leon Derks wrote: Hi Sven, I only see that they get the value by using the key name. For example this: |var data = '{ name: Violet, occupation: character }'.evalJSON(); data.name; //prints Violet. | But in my case, I don't know the key name, so I can't get the value. Is there a way to get the key names of a JSON Object? For example something like this: | data.keys; //returns {name, occupation}| | | Leon Sven Homburg wrote: http://www.prototypejs.org/learn/json 2008/5/15 Leon Derks [EMAIL PROTECTED]: Hello I have a JSON object like this: JSONObject obj = new JSONObject(); obj.put(entity.getId(), entity.getName()); But how can I get the value from my json object in javascript, if I don't know the key name? Is there a way to get the key name(s) from a json object in javascript? Leon - 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]
Failure writing parameter 'value' of component characteristic/Edit:nominaltextfield:
I get this error: Failure writing parameter 'value' of component characteristic/Edit:nominaltextfield: Binding [EMAIL PROTECTED] is read-only. I have the corresponding getter / setter for the property. What am I doing wrong? Java Page: private String nominalDescription; public String getNominalDescription() { String description = getDescriptionForValueType(CharacteristicValueType.Nominal); if(description != null) { return description; } return nominalDescription; } public void setNominalDescription(String nominalDescription) { this.nominalDescription = nominalDescription; } Webpage: input t:type=textfield t:id=nominalTextfield size=50 value=${nominalDescription}/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Failure writing parameter 'value' of component characteristic/Edit:nominaltextfield:
Hi Nicholas, Indeed, that was it. Thanks! Leon nicholas Krul wrote: ${X} is a one way output... it uses the prop: binding by default... remove the EL-style ${} and it should work. On Thu, May 15, 2008 at 2:24 PM, Leon Derks [EMAIL PROTECTED] wrote: I get this error: Failure writing parameter 'value' of component characteristic/Edit:nominaltextfield: Binding [EMAIL PROTECTED] is read-only. I have the corresponding getter / setter for the property. What am I doing wrong? Java Page: private String nominalDescription; public String getNominalDescription() { String description = getDescriptionForValueType(CharacteristicValueType.Nominal); if(description != null) { return description; } return nominalDescription; } public void setNominalDescription(String nominalDescription) { this.nominalDescription = nominalDescription; } Webpage: input t:type=textfield t:id=nominalTextfield size=50 value=${nominalDescription}/ - 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: JSONArray + fillling
Hello I found this example: new JSONArray([['a', 'value a'], ['b', 'value b'], ['c', 'value c'], ['d', 'value d']])); The JSONArray contains information for my select box, with a value - label pair. But in my case, I want to make a new JSONArray filled with properties from my List of Groups. So for example something like this: for(Group group : ListGroup groups) { jsonArray.put(group.getId, group.getName()); } The problem is that a put operation only allows put(Object value) and put(int index, Object value); How can I add the group.getId and group.getName() as a value-label pair to the JSONArray? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: JSONArray + fillling
Can you give me an example of that? Leon Lance Java wrote: You want a JSONObject not a JSONArray http://tapestry.formos.com/nightly/tapestry5/apidocs/index.html Cheers, Lance. 2008/5/14 Leon Derks [EMAIL PROTECTED]: Hello I found this example: new JSONArray([['a', 'value a'], ['b', 'value b'], ['c', 'value c'], ['d', 'value d']])); The JSONArray contains information for my select box, with a value - label pair. But in my case, I want to make a new JSONArray filled with properties from my List of Groups. So for example something like this: for(Group group : ListGroup groups) { jsonArray.put(group.getId, group.getName()); } The problem is that a put operation only allows put(Object value) and put(int index, Object value); How can I add the group.getId and group.getName() as a value-label pair to the JSONArray? Leon - 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: select + enum
Hello, Is it possible to show a limited list of my enum values in the select box? For example, my enum contains 10 objects, is it possible to show only 5 of them in the select? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: select + enum
Okay I will try that. Toby Hobson wrote: You might want to look at Java's EnumSet.range() method for this. Toby - Original Message From: Leon Derks [EMAIL PROTECTED] To: Tapestry users users@tapestry.apache.org Sent: Wednesday, 14 May, 2008 4:33:58 PM Subject: T5: select + enum Hello, Is it possible to show a limited list of my enum values in the select box? For example, my enum contains 10 objects, is it possible to show only 5 of them in the select? Leon - 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 + DWR integration
How easy is it to integrate T5 with DWR? Are there examples of how to do this? How do I need to configure the dwr.xml file? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 + DWR integration
I don't have that topic. Is it easy to integrate DWR with tapestry, without Spring? Leon Renat Zubairov wrote: Hi That's an interesting topic. Actually we had discussed it once with Igor, and it seems that it shouldn't be too hard. The question is which objects from the server-side you want to access from DWR? If you will answer this question then you can just start a DWR servlet in your web application and try to get the objects of interest. Renat 2008/5/13 Leon Derks [EMAIL PROTECTED]: How easy is it to integrate T5 with DWR? Are there examples of how to do this? How do I need to configure the dwr.xml file? Leon - 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]
update select based on first select
I want to update a select, based on a value from another select. I have tried the OnEvent mixin from the t5components, but only the first selected value is printed to the screen. When I select another value after that, it always prints the first selected value. How can I do this with Tapestry 5 at the moment? Here is a part of the java page code: @OnEvent(component = productSelect, value = change) Object onProductSelectChanged(String value) { System.out.println(Value: + value); return null; } Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Simple date format question
How can I format my date in a date field I want to use the format (dd/MM/). Does tapestry have some build in functionality for this? And how can I format a date printing it to the screen like this: td${person.birthday}/td Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple date format question
Okay, I use Tapestry 5. But can I use the OutputLocale component also on a DateField? Leon Marcus wrote: Hi Leon, There is a JIRA about format parameter for DateField, vote! To format a date output you can use OutputLocale component ( http://wiki.apache.org/tapestry/Tapestry5OutputLocaleNumber) Marcus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple date format question
Hi Marcus, I couldn't find the jira issue. Do you have it? I will vote! I found this example on :http://www.packtpub.com/article/tapestry-5-advanced-component input type=text t:type=datefield t:value=dateOfBirth t:format=%d/%m/%y/ But this seems to be outdated, because it doesn't work. Leon Marcus wrote: Leon, No, you can't, :) it's only for output. Don't forget to vote on JIRA! Marcus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
@Persist(flash) question
In my page I have a the following function that is executed when I click on the search button in my page. @Persist(flash) private ListImportRequest importRequests = new ArrayListImportRequest(); @OnEvent(component = searchForm, value = submit) public void doSearch() { importRequests = importDAO.findImportRequests(importRequestSearch); } The results are only shown on my page when I use @Persist(flash) for the importRequests. Is it possible to do this without an @Persist(flash)? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
overwrite first element in select
Hello Is it possible to overwrite the first element in a select box? At the moment this is an empty value, but can I for example overwrite this with All Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Autocomplete mixin + select event
Does the autocomplete mixin fire some kind of event, after I have selected an item from the autocomplete-menu? Because I want to update other fields, based on the value that I selected. How can I do this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Autocomplete providecompletions + extra parameter
Hello Is it possible to add an extra context parameter to the providecompletions method? For example like this: ListString onProvideCompletionsFromAccountName(Long categoryId, String partial) { ListProduct matches = productDAO.findByPartialNameInCategory(partial, categoryId); ... } How can I do this without an @Persist on my categoryId? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Page + render parts based on previous action
Hello I want to render different parts in my page, based on an action in my previous page. For example I have an edit section and an add section. Based on the button I clicked in the previous page (edit or add button) I want to render the page with the corresponding section. What is the best way to do this? Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Autocomplete mixin + select event
Thanks for the tips! Leon Steven Woolley wrote: I've got it working by overriding the Autocomplete mixin and putting the following in the AfterRender (instead of using a json object). String configS = {indicator:' + loaderId + ',frequency:.5,minChars: + minChars + ,paramName:\t:input\,afterUpdateElement:onChosen}; _pageRenderSupport.addScript( new Ajax.Autocompleter('%s', '%s', '%s', %s);, id, menuId, link.toURI(), configS); Basically, in am just using a String instead of a JSON object to write out the autocomplete parameters... so I can do the quoting as I desire. There is a JIRA for the quoting issue already, and hopefully when it's fixed I can go back to using the default implementation. Hope that helps. Steve On Apr 29, 2008, at 12:21:31, Josh Canfield wrote: In 5.0.11 I was unable to find a good extension point for the autocomplete mixin. The scriptaculous Ajax.Autocompleter does support updateElement and afterUpdateElement methods, but as far as I can tell you can't get them into the configuration because the JSONObject quotes its attributes (making the function into a string). If anyone has solved that problem I'd love to hear about it. http://wiki.script.aculo.us/scriptaculous/show/Ajax.Autocompleter One option would be to add a change handler to the input field that the autocomplete is populating. Something like: $('mytextfield').observe('change', function(theEvent) { /* update other fields */}); Hope that helps, Josh On Tue, Apr 29, 2008 at 4:47 AM, Leon Derks [EMAIL PROTECTED] wrote: Does the autocomplete mixin fire some kind of event, after I have selected an item from the autocomplete-menu? Because I want to update other fields, based on the value that I selected. How can I do this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. - 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: JPA EntityManager + Tapestry Injection
I have added an JPA entity manager to my AppModule, in the same way this is done for an HibernateSessionManager/Session in the tapestry-hibernate project. See the code below for some details. I inject this entity manager with the @Inject into my DAO object. @Inject private EntityManager entityManager In my DAO method I use the injected entityManager to build queries like this: entityManager.createNamedQuery(findProductsByCategory).setParameter(productCategory, ProductCategory.Lamps).getResultList(); But the problem is that the entityManager is null. It seems that the entityManager is not correctly injected into my DAO class. Because when I use the entityManager directly in my Java Page class and execute the same code, everything works well. Java Page code: public void onActivate() { // this results in an null pointer exception. products = productDAO.findAllByCategory(ProductCategory.Lamps); //this is working. products = entityManager.createNamedQuery(findProductsByCategory).setParameter(productCategory, ProductCategory.Lamps).getResultList(); } What do I need to do so I can use my DAO classes? Leon AppModule.java: /** * The JPAEnitityManagerService manages the entity manager on a per-thread/per-request basis. A [EMAIL PROTECTED] javax.persistence.EntityTransaction} is created * initially, and is committed at the end of the request. */ @Scope(PERTHREAD_SCOPE) public static JPAEntityManagerService build(PerthreadManager perthreadManager) { JPAEntityManagerServiceImpl jpaService = new JPAEntityManagerServiceImpl(); perthreadManager.addThreadCleanupListener(jpaService); return jpaService; } public static EntityManager build(JPAEntityManagerService jpaService, PropertyShadowBuilder propertyShadowBuilder) { return propertyShadowBuilder.build(jpaService, entityManager, EntityManager.class); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
multiple context values
How can I add multiple context values to an actionlink? For example a productId and a categoryId? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: onActivate() called twice
Hi, I noticed that my onActivate() is called twice. I solved the problem by changing onActivate() into onActivate(Object[] parameters). Now it is only called once. But is this the way to do this or is there a better way? greetings, Leon - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: onActivate() called twice
Hi Davor, Indeed, I have a BasePage that implements the public void onActivate() {}method. In my subpage I also have implemented the public void onActivate() {}. The code in onActivate() of my subpage is executed twice. BASEPAGE: public void onActivate() { String pageName = resources.getPageName(); breadCrumbHolder.checkBreadCrumbForRemove(pageName); } SUBCLASS: public void onActivate() { logger.debug(OnActivate ); products = productDAO.findAllByCategory(ProductCategory.Books); if (logger.isDebugEnabled()) { logger.debug(Nr of products: + products.size()); } } This is the logging when I acces the page: [DEBUG] Products OnActivate [DEBUG] Products Nr of products:: 43 [DEBUG] Products OnActivate [DEBUG] Products Nr of products:: 43 Leon Davor Hrg wrote: you have to be more specific, same OnActivate method will not be called more than once in normal circumastances, but overriding onActivate from a base class I belive can cause this ... some code would be useful. Davor Hrg On Mon, Apr 21, 2008 at 12:41 PM, Leon Derks [EMAIL PROTECTED] wrote: Hi, I noticed that my onActivate() is called twice. I solved the problem by changing onActivate() into onActivate(Object[] parameters). Now it is only called once. But is this the way to do this or is there a better way? greetings, Leon - 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: onchange event from a select
I want to be able to update a second select, based on the value in the first select box. So I want to process it on the server-side, or with AJAX. Is there a way to catch the onchange event in my java page? JP Date: Sun, 23 Sep 2007 23:37:52 -0700 From: [EMAIL PROTECTED] To: users@tapestry.apache.org Subject: Re: T5: onchange event from a select Do you want it to be processed on the server side, or on the client side? For javascript, you should be able to just add an onchange attribute. If you want to add AJAX support, I'm not sure how to do that yet. Josh On 9/23/07, Josh Penza [EMAIL PROTECTED] wrote: How can I catch the onchange event from a select in T5? are there examples? -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. _ De leukste video's en de beste concerten vind je op MSN Video http://video.nl.msn.com/v/nl-nl/v.htm
t:type=loop problem
I have a problem with the t:type=loop component in my Menu Component Every link that is generated gets the id of the first Category. So the html source looks like this: ul li a href=/mercado/start.layout.menu.category/1 id=categoryCategoryA | 1/a /li /ul ul li a href=/mercado/start.layout.menu.category/1 id=category_0CategoryB | 70/a/li /ul ul li a href=/mercado/start.layout.menu.category/1 id=category_1CategoryC | 110/a/li /ul Every categoryId is 1. (and it generates to much ul tags). When I click a category link the application thinks I always click the first category link. This is what is in Menu.html ul t:type=loop source=categories value=category li t:actionlink t:id=category context=${category.id}${category.name} | ${category.id}/t:actionlink /li /ul And this is what is in Menu.java @Inject @Service(categoryService) private CategoryService categoryService; private Category category; Object onActionFromCategory(Long categoryId) { System.out.println(Category + categoryId + has been clicked); categoryDetail.setup(categoryId); return categoryDetail; } public CollectionCategory getCategories() { return categoryService.getRootCategories(); } public Category getCategory() { return category; } public void setCategory(Category category) { this.category = category; } _ Altijd al willen weten wat jouw naam betekent? http://search.live.com/results.aspx?q=betekenis+annamkt=nl-nlFORM=LVCP
Integration of T5 with the domain model
Just wanted to share how I hooked up T5 with my domain model. I'm using jpa for persistence, so the thing I needed was injection of the EntityManager into the objects providing access to my top level domain objects. And for just that simple IoC, Spring is way too overkill. Guice on the other hand was quite nice for it. I integrated it like this: The access object public class BlaBlaJPAQuery implements BlaBlaFinder { @Inject //the guice inject annotation private EntityManager _entityManager; //Code... } the JPAUtil public class JPAUtil implements ProviderEntityManager { private static final EntityManagerFactory _entityManagerFactory; private static ThreadLocalEntityManager _entityManagerContainer; static { _entityManagerFactory = Persistence.createEntityManagerFactory(POB); _entityManagerContainer = new ThreadLocalEntityManager(); } public static void createEntityManager() { _entityManagerContainer.set(_entityManagerFactory.createEntityManager()) ; } public static void closeEntityManager() { EntityManager entityManager = _entityManagerContainer.get(); entityManager.close(); } public EntityManager get() { return _entityManagerContainer.get(); } } Another filter before the T5 filter that does this: public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException { try { JPAUtil.createEntityManager(); filterChain.doFilter(request, response); } finally { JPAUtil.closeEntityManager(); } } The Guice module: public class POBGuiceModule extends AbstractModule { public void configure() { bind(EntityManager.class).toProvider(JPAUtil.class); } } And the T5 module: public class POBTapestryModule { private static final Injector _injector; static { _injector = Guice.createInjector(new Module[] { new POBGuiceModule() }); } @Lifecycle(value=perthread) public static BlaBlaFinder buildBlaBlaFinder() { return _injector.getInstance(BlaBlaJPAQuery.class); } } And offcourse the page: @Inject //T5 inject annotation private BlaBlaFinder _blablaFinder; Comments/Suggestions/missed design flaws? DISCLAIMER: Dit bericht (met bijlagen) is met grote zorgvuldigheid samengesteld. Voor mogelijke onjuistheid en/of onvolledigheid van de hierin verstrekte informatie kan Stichting Kennisnet Ict op school geen aansprakelijkheid aanvaarden, evenmin kunnen aan de inhoud van dit bericht (met bijlagen) rechten worden ontleend. De inhoud van dit bericht (met bijlagen) kan vertrouwelijke informatie bevatten en is uitsluitend bestemd voor de geadresseerde van dit bericht. Indien u niet de beoogde ontvanger van dit bericht bent, verzoekt Stichting Kennisnet Ict op school u dit bericht te verwijderen, eventuele bijlagen niet te openen en wijst Stichting Kennisnet Ict op school u op de onrechtmatigheid van het gebruiken, kopiëren of verspreiden van de inhoud van dit bericht (met bijlagen). This message (with attachments) is given in good faith. Stichting Kennisnet Ict op school cannot assume any responsibility for the accuracy or reliability of the information contained in this message (with attachments), nor shall the information be construed as constituting any obligation on the part of Stichting Kennisnet Ict op school. The information contained in this message (with attachments) may be confidential or privileged and is only intended for the use of the named addressee. If you are not the intended recipient, you are requested by Stichting Kennisnet Ict op school to delete this message (with attachments) without opening it and you are notified by Stichting Kennisnet Ict op school that any disclosure, copying or distribution of the information contained in this message (with attachments) is strictly prohibited and unlawful. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
load modules with jettylauncher without a jar
Ok, I'm doing something wrong here. I'm working on a T5 project where I have a T5 module. I made a manifest file which is in the META-INF folder that is in the classpath (m2 resource folder, that is added as a source folder under eclipse). I'm running jettylauncher to test the project, but the module isn't loaded by Tapestry. What am I doing wrong? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: load modules with jettylauncher without a jar
Thanks for the quick reply. I resolved it by adding a .jar with only the manifest file as library in eclipse. I have an m2 project setup with inheritance where all code (and then with manifest file) is built into jars anyway which are then included in the war. So for the integration and test servers I didn't have a problem anyway. The 'manifest jar' is just for running jettylauncher and is only present in that environment. -Oorspronkelijk bericht- Van: Howard Lewis Ship [mailto:[EMAIL PROTECTED] Verzonden: woensdag 11 april 2007 16:16 Aan: Tapestry users Onderwerp: Re: load modules with jettylauncher without a jar Servlet class loaders do not look for META-INF/Manifest.mf inside the WAR. I believe you could place it WEB-INF/classes/META-INF/Manifest.mf. From what you describe, I'm not sure that the manifest file is showing up in the right place. I would not rely on the manifest approach for a web application, but instead rely on how T5 loads the application module, as demonstrated in the quickstart Maven archetype. On 4/11/07, Leon Pennings [EMAIL PROTECTED] wrote: Ok, I'm doing something wrong here. I'm working on a T5 project where I have a T5 module. I made a manifest file which is in the META-INF folder that is in the classpath (m2 resource folder, that is added as a source folder under eclipse). I'm running jettylauncher to test the project, but the module isn't loaded by Tapestry. What am I doing wrong? - 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] DISCLAIMER: Dit bericht (met bijlagen) is met grote zorgvuldigheid samengesteld. Voor mogelijke onjuistheid en/of onvolledigheid van de hierin verstrekte informatie kan Stichting Kennisnet Ict op school geen aansprakelijkheid aanvaarden, evenmin kunnen aan de inhoud van dit bericht (met bijlagen) rechten worden ontleend. De inhoud van dit bericht (met bijlagen) kan vertrouwelijke informatie bevatten en is uitsluitend bestemd voor de geadresseerde van dit bericht. Indien u niet de beoogde ontvanger van dit bericht bent, verzoekt Stichting Kennisnet Ict op school u dit bericht te verwijderen, eventuele bijlagen niet te openen en wijst Stichting Kennisnet Ict op school u op de onrechtmatigheid van het gebruiken, kopiëren of verspreiden van de inhoud van dit bericht (met bijlagen). This message (with attachments) is given in good faith. Stichting Kennisnet Ict op school cannot assume any responsibility for the accuracy or reliability of the information contained in this message (with attachments), nor shall the information be construed as constituting any obligation on the part of Stichting Kennisnet Ict op school. The information contained in this message (with attachments) may be confidential or privileged and is only intended for the use of the named addressee. If you are not the intended recipient, you are requested by Stichting Kennisnet Ict op school to delete this message (with attachments) without opening it and you are notified by Stichting Kennisnet Ict op school that any disclosure, copying or distribution of the information contained in this message (with attachments) is strictly prohibited and unlawful. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]