[T5.3-beta-9] Using tapestry-beanvalidator and tapestry-kaptcha together results in circular dependency
Hi List, I don't know whether this belongs here. I have recently introduced tapestry-kaptcha into one of my forms using tapestry-beanvalidator as well. Loading the page containing that form I get a circular depenency warning: WARN services.TapestryModule.MarkupRenderer Unable to add 'KaptchaAssets' as a dependency of 'BeanValidatorScript', as that forms a dependency cycle ('BeanValidatorScript' depends on itself via 'KaptchaAssets'). The dependency has been ignored. The validation seems to work anyway. As long as I input invalid values, the correct messages are displayed. But when finally inputting valid values I get an Exception after submit: ERROR tapestry5.ioc.Registry A JSONArray text must start with '[' at character 0 of I do not know, whether this culd be my fault. So I thought I'd ask here before filing a JIRA. Thanks nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-3-beta-9-Using-tapestry-beanvalidator-and-tapestry-kaptcha-together-results-in-circular-dependency-tp4820243p4820243.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
Re: Is it possible to perform form submit after being redirected via a loginform?
Did I get it right? The user enters data into a form and submits. If he were logged in, you would forward to success page. But not being logged in you would like to do a round trip via login page and after sucessfull login forward to success page? You could store the values entered by the user in the bean that is bound to the form in the session. After sucessfull login you could forward to the form-page again. Not a full solution, but at least the user would not have to enter data again. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-it-possible-to-perform-form-submit-after-being-redirected-via-a-loginform-tp4771930p4772413.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
Where's KaptchaImage and KaptchaField in T5.3-beta-1
Hello, I have recently updated one of my webapps from 5.2.6 to the recently released 5.3. beta. The only thing I had to change was code using the Predicate, because it is an interface and not an abstract class anymore. Based on the information posted here http://tapestry5.de/ and here https://github.com/hlship/tapx I thought that KaptchaImage and KaptchaField have become part of Tapestry core. But I cannot find them. Where are they? Or will I have to wait for a new beta? - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Where-s-KaptchaImage-and-KaptchaField-in-T5-3-beta-1-tp4765547p4765547.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
Re: Override numericformat error message
I have surfed through T5 source code and found out that the message You must provide an integer value for %s. is defined in /org/apache/tapestry5/internal/ValidationMessages.properties having the key integer-format-exception so I tried to add such a key to my app.properties, without success though. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Override-numericformat-error-message-tp4755753p4757740.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
Re: Override numericformat error message
Sorry for posting too quick. In fact after a reload of my app it worked. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Override-numericformat-error-message-tp4755753p4757748.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
Re: Eid Mubarak
And bon appetit ;-)) - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Eid-Mubarak-tp4752847p4753283.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
Override numericformat error message
Hi List, I would like to override the error message for numericformat. I.e. the error message that will be displayed, if a textfield is bound to an Integer value and the user types in letters. I've tried to provide a message numericformat-message. That unsupprisingly did not work, as numericformat is not a validator like e.g. max. How can I override the message? Thanks in advance, nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Override-numericformat-error-message-tp4755753p4755753.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
Re: component scope service with injected messages
public Object doSomethingUseful(Object someParameter, Messages messages) {...} Yes, exactly In your page/component class: @Inject private Messages messages; @Inject MyService myService; private Object myValue; public final Object getValueFromService() { return this.myService.doSomethingUseful(this.myObject, this.messages); } In your tml: t:output t:value=valueFromService ... / (I try to do method calls with parameters in the java code and avoid them in the tml, but that is a question of taste). - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4749543.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
Re: component scope service with injected messages
Don't inject it in the constructor. That isn't possible. Define the Messages as an (additional) parameter to your service method. (This is sometimes referred to as method-Injection, a misleading term in my humble opinion). - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4748239.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
Re: Tapestry apache2 and tomcat
Hi Dimitri, I cannot recommend to fumble around with the path-Part of an URI. I have once tried that in an PHP-App and ended up in a hard to maintain combination of Apache-directives and app-level processing of the paths. IMHO the best you should do is to make simple Proxy-directives to forward requests to the backing Tomcat. If you can, use the ROOT.war-approach. I you do not want to do that but would like to keep the context name PizzAroundMe, add a Location-directive for the root path that sends a permanent redirect to the context path. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-apache2-and-tomcat-tp4722849p4730131.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
Re: component scope service with injected messages
The easiest way is to define your service methods with an additional Messages parameter. This way you can use the Messages within the service methods. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/component-scope-service-with-injected-messages-tp4724993p4730146.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
Re: How to create a war from Eclipse
Not quite Tapestry related, but anyway you can use the maven war plugin to create wars. It is as simple as the following command on the command line: mvn clean war:war Look here for further information: http://maven.apache.org/plugins/maven-war-plugin/ - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-create-a-war-from-Eclipse-tp4732051p4732059.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
Re: remove red cross from the field vlidator
The easyest way is, what Thiago already suggested. Make it invisible with css. Tapestry adds the css class t-error-icon to the img-Tag so you could add the following: .t-error-icon { display: none; } But this way you would still have the img-Tag in your markup. If you want to get rid of that, you'll have to provide a custom implementation of ValidationDecorator and override the method public void afterField(Field field). Take a look at Tapestry's DefaultValidationDecorator to see how it works. Then implement a Subclass of BaseValidationDecorator doing what you want. Then you'll have to push instances of it into the environment at an appropriate place. I myself have created a mixin for forms and use the mixnin's @SetupRender and @CleanupRender for that. But if you want it to be used everywhere you can also contribute it to the MarkupRenderer service. Look at public void contributeMarkupRenderer in TapestryModule to see how that works. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/remove-red-cross-from-the-field-vlidator-tp4717200p4718140.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
Re: T5.2.6 HTML 5 validation fails
Hi Borut, You can provide your custom implementation of MarkupModel to do just that. As a start look at Tapesty's DefaultMarkupModel for inspiration. And there's an article in the wiki: http://wiki.apache.org/tapestry/Tapestry5HowToXhtml It refers to T5.1 though so I don't know whether the code is 100% valid. Cheers nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-HTML-5-validation-fails-tp4712132p4713247.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
Re: Tapestry and JSR-303
Hi kleanthis, try t:value=card.cardId instead of value=card.cardId. And the annotation @NotEmpty is not necessary in my opinion. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-and-JSR-303-tp4692368p4692609.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
Re: Is there a way to change tapestry.application-version value without redeploying the webapp ?
Hi, if you have used contributeApplicationDefaults in your AppModule, no. But you can externalize the values to web.xml by providing context parameters with appropriate name. The context parameters will be picked up by tapestry during startup. So first delete the code in AppModule and then write the paramters into web.xml. For tapestry.application-version this would be: context-param param-nametapestry.application-version/param-name param-valueYORVERSION/param-value context-param Now, when you change this value in web.xml a context reload is necessary, but no redeployment. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Is-there-a-way-to-change-tapestry-application-version-value-without-redeploying-the-webapp-tp4688726p4689241.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
Re: IoC services - can they come from an external jar?
No, that's part of what Tapestry calls distributed configuration You can define separate modules and pack them into separate jars. If you want them used in your AppModule yo can do this in two ways: Either use the @SubModule-annotation telling AppModule, what the other module's class name is. Or pack a MANIFEST.MF with apropriate entry with your jar. Tapestry will scan for that and find your module. Here you'll find more detailed info: http://tapestry.apache.org/tapestry-ioc-configuration.html - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/IoC-services-can-they-come-from-an-external-jar-tp4688157p4689254.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
Re: IoC services - can they come from an external jar?
My No is a bit ambigous ;-)) So: No they don't have to be in the same jar/Yes, they can come from an external jar - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/IoC-services-can-they-come-from-an-external-jar-tp4688157p4689260.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
Re: IoC services - can they come from an external jar?
Well, my definition of distributed configuration is different: it's the ability of more than one module class to contribute configuration for a given service. Granted. And how that works is, what I was trying to explain in my first reply to the question. I wanted to point out, that this feature goes far beyond just having services in a different jar. Admiddetly my explanation was a bit too clumsy or short. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/IoC-services-can-they-come-from-an-external-jar-tp4688157p4689361.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
T5.2.6: Activate called twice
Hi List, I've never really used onActivate so I did not care about how often it would be called... up to today. I have a single onActivate(EventContext context) and corresponding onPassivate in my page class and use the context to load som data from the db. I suddenly realized that onActivate allways get's called twice. The first thing I have done to fix this, was double checking all my css/js/tml/java files for usage of relative URLs, as suggested by Thiago in this thread: http://tapestry.1045711.n5.nabble.com/t5-onActivate-called-twice-td2429079.html#a2429087 Without success Then I thought some unseen redirects could be the cause. I installed HTTP-Live Headers plugin in FF5 to observe the HTTP headers. No redirects sent. CSS-files and images are cached and the only GET-request for the page ittself is answered with HTTP OK. Where else could I look? Thanks in advance - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-Activate-called-twice-tp4690554p4690554.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
Re: T5.2.6: Activate called twice
Hi guys, Thanks for the replies. In fact I had some img tags with no src-attribute as a placeholder for the designers to deliver their content. I replaced them now with properly styled divs. Although what was strange, they were on totally different pages. So I could not imagine them being the reason for such trouble. And indeed they did not cause the trouble. In fact my activate method IS just called ONCE. I somehow managed to misconfigure my logging system in a way that every message gets logged twice. I was fooled by that. I checked by replacing the log statements with ordinary System.out.printlns and tadaa everythin works as expected. Now for the logging configuration... but I wouldn't dare to badger you with that... - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-Activate-called-twice-tp4690554p4691473.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
Re: T5.2.6: Activate called twice
Just for the records: NEVER do that: log4j.rootCategory=info, A1 That will cause every message to be logged twice. I had managed that by misconfiguring maven resource filtering... - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-6-Activate-called-twice-tp4690554p4691543.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
Re: t:form cannot be created?
Hi eray, thanks for sharing your knowledge. That was an odd error. Usually one shouldn't be forced to change system language settings for Tapestry-apps to run. I myself am using a system with a non-Enlish system language (actually German) too and did not face this problem. Could it be that Turkish wasn't in the list of supported locales that is configured in AppModule? Regards nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/t-form-cannot-be-created-tp4657559p4670525.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
Re: E-mail validator accepts invalid addresses
Hi Stephan, Stephan Windmüller wrote: So it seems that only InternetAddress has a bug. Did you use the parse-methods/constructors with the boolean parameter strict set to true? And in fact , are allowed in so called route-addresses (what ever that may be). - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/E-mail-validator-accepts-invalid-addresses-tp4665488p4665860.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
Re: Specifying several event constants for the @OnEvent annotation?
You could implement one method that is called by your two event handlers. E.g. @OnEvent(EventConstants.ACTIVATE) final void callEventHandlerFromActivate() { this.doTheWork(); } @OnEvent(yourAjaxEvent) final void callEventHandlerFromMyAjaxEvent() { this.doTheWork(); } private final void doTheWork() { ... } - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Specifying-several-event-constants-for-the-OnEvent-annotation-tp4659025p4660584.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
Re: t:form cannot be created?
Look around line 90 in your AppModule (com.packtpub.services.AppModule$1.service(AppModule.java:90)) and see, if you can get a clue. If not, please post your AppModule's code and we'll see, if we can find an error. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/t-form-cannot-be-created-tp4657559p4660602.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
Checkout of tapestry-project not working
I have been trying to checkout the Tapestry sources for some days now. Haven't succeeded. I have followed the instructions given here: http://tapestry.apache.org/community.html Namely using this command: svn checkout https://svn.apache.org/repos/asf/tapestry/tapestry5/trunk tapestry-project After waiting for a long time i get the following error on the command line: svn: OPTIONS von »https://svn.apache.org/repos/asf/tapestry/tapestry5/trunk«: Konnte keine Verbindung zum Server herstellen (https://svn.apache.org) Which is tranlated svn: OPTIONS of »https://svn.apache.org/repos/asf/tapestry/tapestry5/trunk«: Could not establish connection to server (https://svn.apache.org) Same result when I try it with Eclipse's svn plugin. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Checkout-of-tapestry-project-not-working-tp4650349p4650349.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
Re: Checkout of tapestry-project not working
Just for the records, the error I get in Eclipse is: svn: OPTIONS request failed on '/repos/asf/tapestry/tapestry5' connect timed out - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Checkout-of-tapestry-project-not-working-tp4650349p4650359.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
Re: Checkout of tapestry-project not working
Hi Dragan, thanks for checking and confirmation that the url was correct. Indeed it was my fault. I am using my laptop in many different environments and forgot to apply correct proxy settings. Regards nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Checkout-of-tapestry-project-not-working-tp4650349p4650650.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
Re: onActivate doubt
You can have more than one onActivate method in a page class. Tapestry determines, which to call by the parameter count. You can write a catch-all onActivate. Code looks like this: Object onActivate(EventContext context) { } If this is the only onActivate-method in the page it will always be called. (Or even if there are others, haven't tried that out.) But I think you might have another problem, because it is not clear to me how your login page can be displayed, when the url for idnex (http://localhost:8080/MyAppName/) is called. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/onActivate-doubt-tp4648587p4648737.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
Re: Tapestry Forum
Paul Stanton-2 wrote: Personally I think forums are a more usable medium that mailing lists for a number of reasons. eg: * It is easier for new users to ask their first question * You can 'decorate' your messages (code blocks, quotes etc) making them more legible. * Posts are better categorised * You can ignore traffic until you are ready to read it I think many new tapestry users are uncomfortable with joining a mailing list and therefore don't get the help they need to get up and running. You don't have to agree... Paul. Paul, I'm afraid I don't agree. You're right mentioning the lack of comfort when using the mailing list purely just with an email client. But in my opinion nabble makes using this list as easy as a web forum. I myself use it to read and post messages. I only check my mail account from time to time to *delete* the mails. So I think we have everything that is needed already. But on the other hand, the internet is free you always gotta try new things. I wish you the best. Let's see what comes out. Cheers nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Tapestry-Forum-tp2404216p4642242.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
Re: Triggered event check on page
It sounds like this could be achieved by providing two event handlers, one for each button code could look like: @OnEvent(value=firstEventLink'sEventValue) final void/Class/Block/Object displaySpecialValue(final MarkupWriter writer) { . } @OnEvent(value=secondEventLink'sEventValue) final void/Class/Block/Object displayAnotherSpecialValue(final MarkupWriter writer) { . } - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Triggered-event-check-on-page-tp4642223p4642318.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
Re: Issue with tapestry tutorial
AHennion wrote: I have this jar in my classpath: -tapestry-hibernate-core-5.2.5 -hibernate-core-3.6.0.final.jar -hibernate-common-annotations-3.2.0.final.jar -hibernate-jpa-2.0-api-1.0.0.jar -hibernate-c3p0-3.6.0.jar It's not normal? That looks good. Second question, Do you have a security manager enabled, that prevents Javassist from accessing those jars. I had a similar error, after I introduces a security manager. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-tapestry-tutorial-tp4633740p4638529.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
Re: Form using both a zone and no zone.
George Christman wrote: Nillehammer, I don't mind. I've been an interface designer for years, so moving to the backend I'm rather green. I am very confused with how to use annotations in my situation, so I'm going to post a snippet of my code and hopefully you guys will be able to help clarify this for me. You'll soon discover that the real hard work is needed in the frontend. Programming the backend is quite a lazy job compared to that. (Don't take this 100% serious ;-)) ). George Christman wrote: I am very confused with how to use annotations in my situation, so I'm going to post a snippet of my code and hopefully you guys will be able to help clarify this for me. Thiago has already provided the code. This just for clarification. For every event caused by user action (like clicking a link, submitting a form) and for a lot of events trigered by components (like form's failure or success) that you want get handeled you use the Annotation @OnEvent. To narrow down the events you actually want to get handeled you use a) the event type (the annotation's value-attribute) and b) the event source's name (the annotation's component-attribute). You'll find those in the names of your event handler methods too, e.g. on*Selected*From*Update*. So selected is the event type and update is the event source's name. For events that are widely used around applications Tapestry provides a constants class EventConstants. This should be your first stop. Browse the constants to get an overwiew of the several events that are triggered. A second stop would be Tapestry's component reference. You'll find a detailed explanation of which events are triggered when by each component. Each event gives you the possibility to hook in by providing a handler. And if that isn't enough, you can even trigger events of your choice yourself! Hope this was helpfull. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Form-using-both-a-zone-and-no-zone-tp4635695p4639057.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
Re: Saving using form zone
George Christman wrote: Prior to converting my form to use a zone update, I use to save the form to the session then reload the update page with previous session data, however when using the zone update, it no longer redirects to the update page. A Zone is used to only update its content. I think in your case, where you always want to forward to a new page (the update page) using a zone is wrong. George Christman wrote: Issues, when saving form with zone update First I found it reruns all methods and creates a new object which causes a loss of all previous SSO data. I then surrounded create new object line with a boolean that was set to false from onSuccess which resolved issue with save, however if you accidentally refreshed browser, all data was lost. Lastly I attempted to persist the boolean and the result of that was the loss ability to actually generate a new object when coming to the create page from existing list page. I haven't fully understood the behavior you're describing, but I think somewhere in your code (maybe activate of page?) you initialize the object. This code is accidentially called after the zone update or when hitting the refresh button. What is the source code of objectState and how do you integrate that into your page/component? - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Saving-using-form-zone-tp4639355p4639470.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
Re: Saving using form zone
Hi George, I' move @SessionState private ObjectState objectState; away from Component.class and make it a field of both of your page classes. You're using a SSO anyway so there's no point in fumbeling around with acrivation contexts. And this looks a bit awfull void setupRender() { if((objectState.getObject() == null) || (object != null !object .getId().equals(objectState.getObjectt().getId( { objectState.setObject(object); } I'd rewrite that to (Hope I got it correct): void setupRender() { if this.object == null { return; } final YourObjetType stateValue = this.objectState.getObject(); if (stateValue == null { this.objectState.setObject(this.object); return; } if (! stateValue.getId().equals(tihs.object.getId()) { this.objectState.setObject(this.object); } } - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Saving-using-form-zone-tp4639355p4640181.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
Re: Saving using form zone
If you need ObjectState in your component, use @Parameter. Forgot to mention that in my earlier post. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Saving-using-form-zone-tp4639355p4640463.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
Re: simple chenillekit button question - label doesn't show up
html-Buttons display whatever is between opening and closing tag. So just place the text you want displayed between opening and closing tag in your tml. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/simple-chenillekit-button-question-label-doesn-t-show-up-tp4640331p4640489.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
Re: simple chenillekit button question - label doesn't show up
button t:type=ck/button class=medium white button t:id=testBuild t:event=click ${message:button.testBuild} /button - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/simple-chenillekit-button-question-label-doesn-t-show-up-tp4640331p4640493.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
Re: Issue with tapestry tutorial
Do you have the hibernate jars in your class path? - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Issue-with-tapestry-tutorial-tp4633740p4634085.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
Re: Form using both a zone and no zone.
Thiago H. de Paula Figueiredo wrote: By the way, any event in Tapestry can be handled by using an annotation in the method instead of relying on naming conventions. It's your choice. :) That cannot be repeated often enough. I think it is better style to use a name that explains, what is realy done in the method rather than that it is jus an event handler. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Form-using-both-a-zone-and-no-zone-tp4635695p4636078.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
Re: Form using both a zone and no zone.
Dragan Sahpaski wrote: Interesting, As I never had used annotations for event handlers in any project so far. I choose the name of the event to imply what is needed to be done in the method, which I prefer to keep it as short as possible (3-4 lines of code, rarely any more). Same with me. My methods also mostly contain no more than a few lines. But to get to know, what is done, one would have to read the source code and hopefully understand it. To give you simple example: Imagine someone would have to read your code (perhaps even you in 6 monts) trying to figure out what's going on. First aproach event handler with naming convention: final ClassSuccess onSuccessFromForm() { // Ok, he's handling the succsess event of the form. But what's he doing? this.dao.save(this.entity); // Ah, he has saved an entity using a dao. return Success.class; // He returns a Success.class. Hmm, why is he doing that? // ... read Tapestry documentation... come back here // Ok, Success.class is in the pages subpackage and returning classes // from there means to forward to the particular page. } Now Annotation aproach with meaningfull name: @OnEvent(value=success, component=form) final ClassSuccess storeEntityAndForwardToSuccess() { // Ok, got it he saves an entity and forwards to Success. // I'm not interested in HOW he does it and am glad not to have // to read any further. this.dao.save(this.entity); return Success.class; } I know this example may be a bit over simplified, but I hove you got my point. Lastly I want to apologize to George for stealing his thread. I am glad to discuss code styling matters, but perhaps we should open a new thread for that. Cheers nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Form-using-both-a-zone-and-no-zone-tp4635695p4636545.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
Re: Call for translations
Hi Igor, I have just checked the German translations in the properties you mentioned and they as far as correctness of translation is concerned look ok to me. Anyway translating to German wouldn't really have helped you, as you speak German yourself. ;-)) Apart from that I generally consider the messages a bit too programmer-centric. I dout that an ordinary user is comfortable with a message saing e.g. Date value 'xxx' is not parseable (German: Datumswert 'xxx' kann nicht geparst werden.). At least in Germany no one except programmers knows what parsing is. A better alternative would be Value 'xxx' is not a valid date (German: 'xxx' ist kein gültiger Datumswert). If you agree, I will be glad to help you in improving this. Cheers nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Call-for-translations-tp4636555p4636634.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
Re: How to set 'parameters' on EventLink?
Hi stephanos2k, A parameter with just test does not make any sense. Url parameters are name/value pairs with equals sign, e.g. ...id=1sortOrder=asc. That's why taprestry expects a map. In the component/page class, where you want to use the parameters provide a Map as a property and use that in the parameters-Attribute. Cheers nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-to-set-parameters-on-EventLink-tp4630532p4630596.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
Re: Using RadioGroup inside a Grid
Hi Stephan, afaik it's easy to ovveride the rendering of a single column in Grid, but it's hard to overide the rendering of a whole row. You could subclass Grid and GridRows to get the desired behavior. Anoter option could be to put your whole radiogroup in just one td and write a mixin that changes the markup in afterRender to split up the clumn into several tds. I can recall that Subclassing Grid and GridRow invloves quite an amount of work and the mixin might look a bit dirty. Perhaps you should refrain from using Grid and better implement your own component that suits your needs. Cheers nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Using-RadioGroup-inside-a-Grid-tp4629982p4630617.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
Re: Error page recipe not working anymore after update to t5.2.6
I think, in the version you updated from there was no index page but still the start page mechanism. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Error-page-recipe-not-working-anymore-after-update-to-t5-2-6-tp4615889p4630858.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
Re: Beginner needs help with PageActivationContext and page navigation in Tapestry
Hi Julien, to call your ModifyJobPosting page from JobPostingsTable page use a page link instead of an action link. The template would look like: t:pagelink t:page=ModifyJobPosting t:context=jobPostingsmodify/t:pagelink This makes the method modifyJobPosting redundant. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Beginner-needs-help-with-PageActivationContext-and-page-navigation-in-Tapestry-tp4631566p4631593.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
Re: Beginner needs help with PageActivationContext and page navigation in Tapestry
Me again, I have a typo in the pagelink (damn copy and paste). The value for the context parameter must be jobPosting of course. - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Beginner-needs-help-with-PageActivationContext-and-page-navigation-in-Tapestry-tp4631566p4631615.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
Re: Error page recipe not working anymore after update to t5.2.6
Hi Pieter, I think, what happens is that Tapestry handles the name of the non-existent page as activation context to the page that is actually displayed (probably your Index-Page). or do i have to change something? In a single page you could implement onActivate(String context) and redirect to 404 yourself. If this botheres you on several pages you could implement a Filter or Dispatcher. Cheers nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Error-page-recipe-not-working-anymore-after-update-to-t5-2-6-tp4615889p4616533.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
Re: Stylesheet in layout component causes my tests to fail...
Hi Julien, @Import(stylesheet = context:/style/style.css) That's a typo leave out the leading slash after the colon, i.e. context:style/style.css Regards nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Stylesheet-in-layout-component-causes-my-tests-to-fail-tp4616463p4616558.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
Re: Avoiding validate event after canceled from BeanEditForm
Hi Matias, you could call ValidationTracker.clear in your onCancel method. The ValidationTracker is pushed onto the Environment by the Form. You'll get by adding @Environmental private ValidationTracker tracker; to your page-/component class. Regards nillehammer - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/Avoiding-validate-event-after-canceled-from-BeanEditForm-tp4616049p4616607.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
Re: mvn package - exclude lib folder?
For the dependency you want exluded use scopeprovided/scope See the servlet-api dependency in you pom.xml for an example - http://www.winfonet.eu -- View this message in context: http://tapestry.1045711.n5.nabble.com/mvn-package-exclude-lib-folder-tp4601084p4610576.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
Re: Free J2ee hosting
Hi Taha, I am running a virtual root server to host my own T5 based site. I you want, I can supply you with your own Tomcat 6 instance with 100MB heap. Just send me a mail to my maillist account. Cheers nillehammer -- View this message in context: http://tapestry.1045711.n5.nabble.com/Free-J2ee-hosting-tp4584970p4587857.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
Re: Prevent a page from generating any javascript or css.
Hi Bo Gao In fact I want to load a page using ajax, but the page returned contains many javascript files like /assets/0.1.0/core/scriptaculous_1_8_2/prototype.js?_=1310547743256 This increase many requests. And these javascript may be already loaded. I just want to remove these. That is not really an issue. You're right that the requests are made everytime by the browser. But as js-Files are cached, the request/response is different the second time. The first time your browser requests a js-File, the Server will deliver it with a HTTP/1.1 200 OK . Now the js-File is cached by your browser. The second time you do a request, the browser does not ask dumbly for the same file again but asks the server, if a newer version exists by sending a If-Modified-Since: header with the request. This is answered with a HTTP/1.1 304 Not Modified . So js-Files only go over the wire the first time they are requested. Later it's just checking, if they have been modified. This rule applies to all assets (css, gifs etc.). Regards nillehammer -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: how to use asset from component library in template?
Hi stephanos2k, By the way, the stylesheet in my library references some images [background-image: /images/error.png], what's the best way to make this work when using the library? CSS files are assets that are not parsed like templates. So dynamic insertion of asset paths won't work here. To make background-image urls work with assets either put them into a style-addribute in the particular element or use a style.../style section in your template(s). I myself use the latter and have put everything together in my layout component. Regards, nillehammer -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Special Character in attribute.
Hello Juan, this was tricky! The String parameter for RenderSupport.addScript(...) somewhere deep in the code is passed to String.format(...). In String.format(...) the percent sign indicates a conversion. %, is no valid conversion, hence the Exception. To get rid of that error you have to mask the %. This is done by doubling it up (i.e. %%). I have rewritten your Mixins java class and it works. import org.apache.tapestry5.BindingConstants; import org.apache.tapestry5.ClientElement; import org.apache.tapestry5.RenderSupport; import org.apache.tapestry5.annotations.AfterRenderBody; import org.apache.tapestry5.annotations.InjectContainer; import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.services.javascript.JavaScriptSupport; public class ModalPage { /** * Added this for the code to compile. */ @InjectContainer private ClientElement element; /** * DEPRECATED, better use {@link JavaScriptSupport}. */ @Inject private RenderSupport renderSupport; @Parameter(value = null, defaultPrefix = BindingConstants.LITERAL) private String boxParams; @AfterRenderBody public void afterRenderTemplateLink() { String comando = String.format(new ModalPage(' + element.getClientId() + ', + braceWithQuotes(this.doubleUpPercentInBoxParams()) + );); renderSupport.addScript(comando); } /** * {@link RenderSupport#addScript(String)} passes the string argument to * {@link String#format(String, Object...)}. This causes trouble, if string * contains % as this is misinterpreted as a format conversion. We need to * mask it. In String format this is done with %%. * * @return */ private String doubleUpPercentInBoxParams() { return this.boxParams.replaceAll(%, %%); } private String braceWithQuotes(String value ) { return value.equals(null) ? value : ' + value + '; } } Am 06.07.2011 17:34, schrieb Juan Alba: sorry guys, de error shown is this one, not the one sent before: org.apache.tapestry5.internal.services.RenderQueueException Render queue error in AfterRenderBody[proxy/menu/EndPoint:showendpointlink]: Conversion = o, Flags = , On Wed, Jul 6, 2011 at 12:17 PM, Juan Albajuan.a...@condortech.com.arwrote: Hi, Thanks for the help Nillehammer, here is the code: /*JAVA*/ public class ModalPage { @Parameter(value=null, defaultPrefix = BindingConstants.LITERAL) private String boxParams; @AfterRenderBody public void afterRenderTemplateLink() { String comando = String.format(new ModalPage(' + element.getClientId() + ', + braceWithQuotes(boxParams) + );); renderSupport.addScript(comando); } private String braceWithQuotes(String value) { return value.equals(null) ? value : '+value+'; } } /*TML*/ div class=row t:actionLink t:id=myLink id=myLink title=${message:listendpoint} t:mixins=condorTapestryLib/ModalPage t:boxParams=width:50%,opacity:0.7,escKey:true,overlayClose:false ${message:endpoints} /t:actionLink /div -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Special Character in attribute.
Hi Juan, thanks for providing the code. I have implemented it (with some slight changes to get it to compile) and now I see the same error as you. I haven't found a solution yet. I will come back, when I have found one (hopefully ;-)). Cheers nillehammer Am 06.07.2011 17:34, schrieb Juan Alba: sorry guys, de error shown is this one, not the one sent before: org.apache.tapestry5.internal.services.RenderQueueException Render queue error in AfterRenderBody[proxy/menu/EndPoint:showendpointlink]: Conversion = o, Flags = , On Wed, Jul 6, 2011 at 12:17 PM, Juan Albajuan.a...@condortech.com.arwrote: Hi, Thanks for the help Nillehammer, here is the code: /*JAVA*/ public class ModalPage { @Parameter(value=null, defaultPrefix = BindingConstants.LITERAL) private String boxParams; @AfterRenderBody public void afterRenderTemplateLink() { String comando = String.format(new ModalPage(' + element.getClientId() + ', + braceWithQuotes(boxParams) + );); renderSupport.addScript(comando); } private String braceWithQuotes(String value) { return value.equals(null) ? value : '+value+'; } } /*TML*/ div class=row t:actionLink t:id=myLink id=myLink title=${message:listendpoint} t:mixins=condorTapestryLib/ModalPage t:boxParams=width:50%,opacity:0.7,escKey:true,overlayClose:false ${message:endpoints} /t:actionLink /div Error: java.lang.LinkageError loader constraint violation: when resolving method ar.com.condortech.lib.condorTapestryLib.utils.NavigationObject.getCurrentPage()Lar/com/condortech/lib/condorTapestryLib/pages/AbstractPage; the class loader (instance of org/apache/tapestry5/internal/services/ComponentInstantiatorSourceImpl$PackageAwareLoader) of the current class, ar/com/condortech/lib/condorTapestryLib/pages/AbstractPage, and the class loader (instance of org/eclipse/jetty/webapp/WebAppClassLoader) for resolved class, ar/com/condortech/lib/condorTapestryLib/utils/NavigationObject, have different Class objects for the type ar/com/condortech/lib/condorTapestryLib/pages/AbstractPage used in the signature -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Special Character in attribute.
Hi kado, Also I don't think that the problem is the word width because when I send width:800px, it works fine. The problem is when I try sending the width or height in % instead of px I have tried to reproduce your error using a String parameter in a component that generates an a href=...?boxparams=width:80%, height100%, opacity (with % and spaces). I did not get any error. Could you please post the java code and tml of your mixin for further investigation. Cheers nillehammer -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Special Character in attribute.
Hi Juan, Should I have to treat the % as a special character? I don't think the % is the problem. I think that Tapestry confused by the String starting with width: Tapestry uses the first part of a parameter before the : as a binding prefix. And width is not a valid binding prefix. As a fix i recommend either of the following: -Supply the parameter with a valid binding prefix, e.g. literal:width:80%,height:80% ,opacity:0.7 -Split up the parameter into three (width, height, opacity). Cheers nillehammer -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Want locale to be part of every uri
Hi List, if Tapestry recieves a request that does not contain the locale at the beginning of the uri, it will determine the desired locale from the request headers and send the respond. The PersistentLocale will not be set. In that case I want to set the PersistentLocale and send a redirect to the client to ensure the locale is allways part of every uri. My first idea was to implement a RequestFilter. But it turned out, even if the uri contained the locale, the PersistentLocale was not set (yet). Same with Dispatchers. I dug into Tapestry's source code and found out that PersistentLocale is set in ComponentEventLinkEncoder's decode methods. From that I judged I would only have access to PersistentLocale from within pages or components. So I implemented an abstract BasePage that checks PersistentLocale.isSet in its onActivate method and sends the redirect, if necessary. All my pages inherit from BasePage, Now I am wondering, if there is a smarter approach? Thanks in advance, nillehammer -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Want locale to be part of every uri
Hi Thiago, I'd write a RequestFilter that invokes ComponentEvenLinkEncoder.decodePageRenderRequest() and ComponentEvenLinkEncoder.decodeComponentEventRequest() and after that check the PersistentLocale. :) That's what I had already tried before asking: ComponentEvenLinkEncoder.decodeComponentEventRequest() PersistentLocale was still null, even if present in the uri. That's what I have tried after your answer: ComponentEvenLinkEncoder.decodePageRenderRequest() And tadaaa! The PersistentLocale was set! (Bang my head on the keyboard for not having tried earlier) I was about to implement a RequestFilter as you suggested. But meanwhile Howard has answered my question suggesting a ComponentRequestFilter. Will try that out and post my code, when done. Thanks so far. nillehammer -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Want locale to be part of every uri
Hi Thiago, I've never tried a ComponentRequestFilter for doing things that involved redirection, as they are invoked way later in the Tapestry processing pipeline. Please post if it works. ;) It turned out that ComponentRequestFilter has several advandatages over RequestFilter: 1.) If a locale is present in the uri, the PersistentLocale is set. No workaround using ComponentEventLinkEncoder's decodeXXX methods needed. 2.) The ThreadLocale already contains a supported locale that can be safely used to set the PersistentLocale. In RequestFilter the ThreadLocale is still the raw one taken from the request. Which might not be in supported-locales. 3.) The methods handlePageRender(...) and handleComponentEvent(...) are a directer way of distiguishing between the two types. In RequestFilter.service(...) you would have to distinguish them on your own by decoding the request with ComponentEventLinkEncoder. 4.) In handleComponentEvent you only have to set the persistent locale. Tapestry generates redirects for component events anyway. So you don't need to bother. The only (slightly) hard part is building a redirect mechanism in handlePageRender(...). I surfed through Tapestry's source code and found out that PageRenderRequestHandlerImpl uses a ComponentEventResultProcessor for that purpose. I have done that too. Thanks to you and Howard for helping. And speeking of locales. Its almost 03:00 am local time now. I really need to go to bed. My boss is gonna kill me, if I oversleep (again). Cheers, nillehammer P.S. The code: PersistentLocaleFilter.java: /** * Checks, if persistent locale is set. If not will do so and send redirect, if * necessary. */ final class PersistentLocaleFilter implements ComponentRequestFilter { /** * Used to set the persistent locale (that's what this filter is all about). */ private final PersistentLocale persistentLocale; /** * Used to determine current locale, if persistent locale is not set. */ private final ThreadLocale threadLocale; /** * Used to generate a page render link in * {@link #handlePageRender(PageRenderRequestParameters, ComponentRequestHandler)} * . */ private final ComponentEventLinkEncoder componentEventLinkEncoder; /** * Used to add request parameters to the page render link. */ private final Request request; /** * Used to process the page render link as a redirect. */ private final ComponentEventResultProcessorLink componentEventResultProcessor; /** * Constructor injecting all dependencies. * * @param persistentLocale * @param threadLocale * @param componentEventLinkEncoder * @param request * @param componentEventResultProcessor */ PersistentLocaleFilter(final PersistentLocale persistentLocale, final ThreadLocale threadLocale, final ComponentEventLinkEncoder componentEventLinkEncoder, final Request request, final ComponentEventResultProcessorLink componentEventResultProcessor) { this.persistentLocale = persistentLocale; this.threadLocale = threadLocale; this.componentEventLinkEncoder = componentEventLinkEncoder; this.request = request; this.componentEventResultProcessor = componentEventResultProcessor; } /** * Sets persistent locale if necessary and hands over to the rest of the * chain. Tapestry is generating redirects for component events anyway, so we * do not need to do that. */ @Override public final void handleComponentEvent( final ComponentEventRequestParameters parameters, final ComponentRequestHandler handler ) throws IOException { setPersistentLocaleIfNecessary(); handler.handleComponentEvent(parameters); } /** * Sets persistent locale if necessary and creates a page render link to * redirect to. */ @Override public final void handlePageRender( final PageRenderRequestParameters parameters, final ComponentRequestHandler handler ) throws IOException { if (setPersistentLocaleIfNecessary()) { final Link pageRedirectLink = this.componentEventLinkEncoder .createPageRenderLink(parameters); /* * pageRedirectLink lacks possible request parameters. We add them * manually. Anchor needs not be added. It stays in the address bar by * some magic I don't understand. */ for (final String paramName : this.request.getParameterNames()) { pageRedirectLink.addParameter(paramName, this.request.getParameter(paramName)); } this.componentEventResultProcessor.processResultValue(pageRedirectLink); return; } handler.handlePageRender(parameters
Re: T5: How to use context-param or init-param from web.xml in contributeApplicationDefaults?
Hi Martin, sorry for late reply. I was busy the last two days. I have tried the solution you suggested and indeed it just works. That was realy easy! Not having found the solution myself after digging into the sources, I have to admit that I'm feeling a bit stupid now. Thanks a lot, for your solution (and for making me feel stupid), nillehammer Am 17.06.2011 01:41, schrieb Martin Strand: ApplicationDefaults is only one of many SymbolProviders, you don't need to configure that specific SymbolProvider to set the supported locales. There are other options, including support for .properties files or system properties. I prefer context parameters myself, everything should just work if you add it to web.xml like so: context-param param-nametapestry.supported-locales/param-name param-valueen,de/param-value /context-param The ServletContextSymbolProvider will handle the rest for you. I'm sure you're already doing this for other symbols, at least tapestry.app-package :) On Fri, 17 Jun 2011 00:28:17 +0200, Nillehammer tapestry.nilleham...@winfonet.eu wrote: Hi List, I would like to replace the constant Strings in the method contributeApplicationDefaults in my AppModule. E.g. replace the following line: configuration.add(SymbolConstants.SUPPORTED_LOCALES, en,de); // don't like the en,de here. Would like to replace it. with something configurable in a text file. I thought providing the values in web.xml either as context-param or as init-param for the TapestryFilter was a good idea. My first try was to inject the Context service as additional parameter to the contribution method to get access to the context-params. That did not work. The parameter is null and Tapestry throws an exception. Same with ApplicationGlobals. I then browsed through Tapestry's source code and found out that I could implement my own filter inheriting from org.apache.tapestry5.TapestryFilter. So my next try was to do that and override the method protected void init(Registry registry ). My hope was to be able to do something sensible with the javax.servlet.FilterConfig that is returned by getFilter(). But I have no clue, what to do. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5: How to use context-param or init-param from web.xml in contributeApplicationDefaults?
Hi List, I would like to replace the constant Strings in the method contributeApplicationDefaults in my AppModule. E.g. replace the following line: configuration.add(SymbolConstants.SUPPORTED_LOCALES, en,de); // don't like the en,de here. Would like to replace it. with something configurable in a text file. I thought providing the values in web.xml either as context-param or as init-param for the TapestryFilter was a good idea. My first try was to inject the Context service as additional parameter to the contribution method to get access to the context-params. That did not work. The parameter is null and Tapestry throws an exception. Same with ApplicationGlobals. I then browsed through Tapestry's source code and found out that I could implement my own filter inheriting from org.apache.tapestry5.TapestryFilter. So my next try was to do that and override the method protected void init(Registry registry ). My hope was to be able to do something sensible with the javax.servlet.FilterConfig that is returned by getFilter(). But I have no clue, what to do. Does someone have an idea what to do? Thanks in advance, nillehammer -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: How to use context-param or init-param from web.xml in contributeApplicationDefaults?
Yeah, a possible way to go. But I'd like a more persistent solution hence the idea of using params in web.xml Am 17.06.2011 00:36, schrieb Lenny Primak: I use system properties. On Jun 16, 2011, at 6:28 PM, Nillehammertapestry.nilleham...@winfonet.eu wrote: Hi List, I would like to replace the constant Strings in the method contributeApplicationDefaults in my AppModule. E.g. replace the following line: configuration.add(SymbolConstants.SUPPORTED_LOCALES, en,de); // don't like the en,de here. Would like to replace it. with something configurable in a text file. I thought providing the values in web.xml either as context-param or as init-param for the TapestryFilter was a good idea. My first try was to inject the Context service as additional parameter to the contribution method to get access to the context-params. That did not work. The parameter is null and Tapestry throws an exception. Same with ApplicationGlobals. I then browsed through Tapestry's source code and found out that I could implement my own filter inheriting from org.apache.tapestry5.TapestryFilter. So my next try was to do that and override the method protected void init(Registry registry ). My hope was to be able to do something sensible with the javax.servlet.FilterConfig that is returned by getFilter(). But I have no clue, what to do. Does someone have an idea what to do? Thanks in advance, nillehammer -- http://www.winfonet.eu - 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 -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: onPrepare(Integer id)
Hi Tony, t:form t:id=editOfficeForm t:context=officeId Given this line in your template, Tapestry will just append nothing to the url, if officeId is null. This means the context is simply not there. When processing the post request, the correct signature for an eventhanlder wit no context would be one with no parameters i.e. onPrepare(). This method should be called, if officeId is null. As having multple eventHandlers for basically the same event just because of different amount of parameters may clutter the code, I suggest implementing just a single one with org.apache.tapestry5.EventContext as parameter. Cheers, nillehammer Am 13.06.2011 17:54, schrieb Tony Nelson: I'm trying to create a simple form that will work for both Add and Edit. I'm trying to use onPrepare to setup the database object and the code works fine for an existing object. When I try to use the form with a new object (id = null) it appears that onPrepare isn't called, so I end up with null pointer exceptions trying to build the form. Here is my simple controller: package com.starpoint.helpdesk.pages.office; import com.starpoint.helpdesk.business.OfficeLogic; import com.starpoint.helpdesk.domain.Office; import com.sun.istack.internal.Nullable; import org.apache.tapestry5.annotations.Log; import org.apache.tapestry5.annotations.Persist; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.ioc.annotations.Inject; import org.slf4j.Logger; t:context=officeId /** */ public class EditOffice { @Inject private Logger logger; @Inject private OfficeLogic officeLogic; @Persist private Integer officeId; @Property private Office office; public Integer getOfficeId() { return officeId; } @Log public void setOfficeId(@Nullable Integer officeId) { this.officeId = officeId; } @Log void onPrepare(Integer officeId) { if (office == null) { office = officeId == null ? new Office() : officeLogic.getOffice(officeId); } } void onActivate(Integer officeId) { this.officeId = officeId; } Integer onPassivate() { return officeId; } public Object onSuccess() { logger.info(**: + office.toString()); return this; } } And my form: html t:type=layout title=helpdesk Index t:sidebarTitle=Current Time xmlns:t=http://tapestry.apache.org/schema/tapestry_5_1_0.xsd; xmlns:p=tapestry:parameter t:form t:id=editOfficeForm t:context=officeId t:errors/ table tr tdt:label for=officeNameOffice Name/t:label/td tdt:textfield t:id=officeName value=prop:office.officeName/t:textfield/td /tr tr td colspan=2 t:submit t:id=saveOffice class=buttonSave Office/t:submit /td /tr /table /t:form /html What am I missing? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
T5 Bean Validation: How to override the property name in validation message?
Hi List, I have switched from Tapestry's validation API to JSR 303 Bean Validation API. I have provided a message catalog in ValidationMessages.properties in the default package. It gets loaded and the localized error messages are displayed. Only one thing bothers me. The messages are prepended by the name of the property being validated. E.g. my bean has a property getMsg() that is required. The resulting error message would be Msg is required. I'd like to override the Msg part with a more sensible value like Message in English or Nachricht in German. How could this be achieved? Would I have to provide a custom implementation of MessageInterpolator? I know this question is more related to Bean Validation than to Tapestry. But maybe someone on this list has encountered the same problem and can provide a solution for this. Thanks in advance, nillehammer - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5 Bean Validation: How to override the property name in validation message?
Answering my own question. The solution turned out to be VERY easy. The validation message ist constructed by Tapestry's BeanFieldValidator. It reads the fields label to construct the prefix for the validation message. That can be customized by putting a field-id-label into the message catalog. In my example, I put msg-label=Message into my component's message catalog and now I am satisfied. Am 12.06.2011 14:39, schrieb Nillehammer: Hi List, I have switched from Tapestry's validation API to JSR 303 Bean Validation API. I have provided a message catalog in ValidationMessages.properties in the default package. It gets loaded and the localized error messages are displayed. Only one thing bothers me. The messages are prepended by the name of the property being validated. E.g. my bean has a property getMsg() that is required. The resulting error message would be Msg is required. I'd like to override the Msg part with a more sensible value like Message in English or Nachricht in German. How could this be achieved? Would I have to provide a custom implementation of MessageInterpolator? I know this question is more related to Bean Validation than to Tapestry. But maybe someone on this list has encountered the same problem and can provide a solution for this. Thanks in advance, nillehammer - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
[Snippet] T5: A mixin to rewrite the markup of element
Tapestry's Submit component renders out as input type=submit. Since HTML 4.0 a submit button can be written as button type=submit. I prefer this approach, because it makes it easier to distinguish between real input elements (especially textfields) and buttons. I have created a JIRA request for this: https://issues.apache.org/jira/browse/TAP5-1545 Hopefully it will get implemented in future Tapestry versions. In the meanwhile I have helped myself out with a mixin that is able to change the markup of the element (element name and attributes) it is attached to. In case someone else finds this usefull this is the code: import java.util.Collection; import java.util.List; import org.apache.tapestry5.BindingConstants; import org.apache.tapestry5.MarkupWriter; import org.apache.tapestry5.annotations.AfterRender; import org.apache.tapestry5.annotations.BeforeRenderTemplate; import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.dom.Attribute; import org.apache.tapestry5.dom.Element; import org.apache.tapestry5.dom.Node; /** * Mixin that changes the markup of an element to desired values. */ public final class MarkupChanger { /** * The desired new name for the element. */ @Parameter(required = true, allowNull = false, defaultPrefix = BindingConstants.LITERAL) private String newElemName; /** * A string containing pairs of attribute names and values separated by ,. */ @Parameter(allowNull = false, defaultPrefix = BindingConstants.LITERAL) private String newAttribs; /** * The {@link Element} to change the markup. */ private Element originalElem; /** * In this render phase we can easily get the element that this mixin is * placed into by calling writer.getElement. * * @param writer * {@link MarkupWriter} injected by Tapestry. */ @BeforeRenderTemplate final void determineOriginalElem(final MarkupWriter writer ) { this.originalElem = writer.getElement(); } /** * We do all the rewriting of markup in the final phase not to interfere with * the render phases of the original element. * * @param writer * {@link MarkupWriter} injected by Tapestry. */ @AfterRender final void changeMarkup(final MarkupWriter writer ) { // Create a new element with the desired new name. final Element newElem = writer.element(this.newElemName); // Add all original attributes to the newly created element. final CollectionAttribute attribs = this.originalElem.getAttributes(); for (final Attribute attrib : attribs) { newElem.attribute(attrib.getName(), attrib.getValue()); } // Add new attributes to the new element, possibly overwriting original ones. if (this.newAttribs != null !this.newAttribs.isEmpty()) { final String[] attribArr = this.newAttribs.split(,); // parse null-String to null. for (int i = 0; i attribArr.length; i++) { if (null.equals(attribArr[i])) { attribArr[i] = null; } } newElem.forceAttributes(attribArr); } // Get children from the original element and add them to the new one. final ListNode children = this.originalElem.getChildren(); for (final Node node : children) { node.moveToBottom(newElem); } // End tag for new element. writer.end(); // Remove the original element from DOM. this.originalElem.remove(); } } Cheers nillehammer - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [bean-edit-form] error with constructor and enum param
When the BeanEditForm instantiates a new Model instance, it now uses the same code that instantiates service implementations (and injects dependencies). By default, Tapestry will find the constructor with the most parameters for this purpose, and will attempt to match each parameter to a service. That's why you get the Exception No service matches... In this case, you don't want that behavior. You surely want BeanEditForm to instantiate via the public no-arguments constructor. By placing an @Inject annotation on the public no-arguments constructor, you can direct BeanEditForm to use that constructor instead. Regards, nillehammer -- http://www.winfonet.eu manuel aldana schrieb: I am using BeanEditForm. I get an exception if I have model-class with a constructor with an enumeration parameter. //WORKS public class Model{ public Model(){..} } //WORKS public class Model{ public Model(String s){..} } //CRASHES with error message: No service implements the interface foo.bar.MyEnum public class Model{ public Model(MyEnum){..} } public enum MyEnum{...} apart from the constructor problem the bean-edit-form handles the enumeration good (gets displayed as combo-box) am using 5.0.18. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [bean-edit-form] error with constructor and enum param
Sorry to have messed up the thread. My local clock was wrong nillehammer schrieb: When the BeanEditForm instantiates a new Model instance, it now uses the same code that instantiates service implementations (and injects dependencies). By default, Tapestry will find the constructor with the most parameters for this purpose, and will attempt to match each parameter to a service. That's why you get the Exception No service matches... In this case, you don't want that behavior. You surely want BeanEditForm to instantiate via the public no-arguments constructor. By placing an @Inject annotation on the public no-arguments constructor, you can direct BeanEditForm to use that constructor instead. Regards, nillehammer -- http://www.winfonet.eu manuel aldana schrieb: I am using BeanEditForm. I get an exception if I have model-class with a constructor with an enumeration parameter. //WORKS public class Model{ public Model(){..} } //WORKS public class Model{ public Model(String s){..} } //CRASHES with error message: No service implements the interface foo.bar.MyEnum public class Model{ public Model(MyEnum){..} } public enum MyEnum{...} apart from the constructor problem the bean-edit-form handles the enumeration good (gets displayed as combo-box) am using 5.0.18. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Implication of client side redirect
Hi Dave, I am afraid I disagree with you on this point. Even when validation fails, redirect after post does make sense. Although you're right that double submission is not a problem when validation fails. If you respond directly to a post, the post will get into the browser's history. This is a problem when the browser's back button is used. This would result in the ugly dialogue Do you want to send formdata again... popping up. This can only be avoided by never directly responding to a post-request. Regards, nillehammer Dave Greggory schrieb: While I highly agree the redirect-after-post pattern is a good practice. It only makes sense in some situations. It makes sense to use it when you're submitting a form and the form submission was successful (ie. Tapestry success event fires). But if validation fails, Tapestry should not be using a redirect to re-show the form with the validation errors. When validation fails, it should use the response for the same request for re-showing the form, it should not be sending a 302. I wish there is a way to disable redirects for validation failures only. - Original Message From: Robert Zeigler robe...@scazdl.org To: Tapestry users users@tapestry.apache.org Sent: Wednesday, March 11, 2009 12:34:56 PM Subject: Re: Implication of client side redirect Hi Rajesh, Tapestry follows the redirect after post principle. This has a lot of pros (avoiding double submission of forms, for instance), but if you're really concerned about it, there's a configuration option to turn it off. In org.apache.tapestry5.SymbolConstants: /** * If set to true, then action requests will render a page markup response immediately, rather than sending a * redirect to render the response. */ public static final String SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS = tapestry.suppress-redirect-from-action-requests; Cheers, Robert 11, 2009, at 3/1110:35 AM , rajesh sukumaran wrote: Hi, I am evaluating Tapestry 5.1 to see if I can use it in one of my new projects. I see that Tapestry uses client side redirects to handle response for event requests. Will this not affect the performance of Tapestry applications, especially under high load? Redirects will result in an additional HTTP hit on the server for every event request that is rendered by a different page. Will this not degrade the responsiveness of the web application as the load increase? I would like to know what everyone thinks about this? regards, Rajesh Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/ - 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 -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Index Pages, 404s and Redirects
Hi Geoffrey, afaik that can only be avoided by the page itsself handling the request. So you would have to set the 404-code in onActivate (HttpServletResponse.setStatus) and probably would want to use Tapestry's Delegate-Component (http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Delegate.html) to show an error message. Regards, nillehammer Geoffrey Wiseman schrieb: I'd like to use an Index page at the root of my Tapestry application (mostly to get the / URL in links rather than /start), but I'd like to respond to some of those page requests with a 404. I've done this using the pattern described on the last a few times by adding an onActivate(EventContext), which I look at to decide if I want to return an instance of a PageNotFound page. This results in a redirect, which I believe is because this is an event handling-method. I like the redirect-after-post pattern, and most of the time, I'd probably like to keep that as a default. For this particular page, I don't want to use a redirect -- in part because I want the original request to 404, in keeping with the resource-oriented view of HTML. Also, if I make a request for /myNewPage before it's there, and I then implement it and refresh, I want the resulting request to be for /myNewPage not /pagenotfound, which it'll be after the redirect. So is it possible to avoid the redirect here without disabling redirect-after-post for the rest of Tapestry. To be honest, if I could use a start page and get a / link instead of /start that would also solve my problem for the time being -- although I like the ability to provide a custom 404 tapestry page that this will give me. - Geoffrey -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Implication of client side redirect
Hi Dave, your message made me doubt and I immediately tried that out (on IE 6 and FF 2). I was not able to reproduce, what you were implying. So I still think that redirect after post solves the problem. Regards nillehammer Dave Greggory schrieb: Redirect-after-post does not really solve that problem because if you hit Back button twice, you still get the same problem. - Original Message From: nillehammer tapestry.nilleham...@winfonet.eu To: Tapestry users users@tapestry.apache.org Sent: Wednesday, March 11, 2009 7:15:38 PM Subject: Re: Implication of client side redirect Hi Dave, I am afraid I disagree with you on this point. Even when validation fails, redirect after post does make sense. Although you're right that double submission is not a problem when validation fails. If you respond directly to a post, the post will get into the browser's history. This is a problem when the browser's back button is used. This would result in the ugly dialogue Do you want to send formdata again... popping up. This can only be avoided by never directly responding to a post-request. Regards, nillehammer - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: no service implements the interface java.util.Date
Hi ?. http://tapestry.apache.org/tapestry5/faq/general.html Cheers, nillehammer While I'm using BeanEditForm component from T5.0.18, it throws an error says no servicie implements java.util.Date. My code is quite simple. t:beaneditform t:id=celebrity / and Celebrity is just a POJO which has an constructor like public Celebrity(String firstName, String lastName,Date dateOfBirth). I'm a newbie and can't find any clue due to the poor documentation of Tapestry. Could someone give me a hint or tell me which doc I should read. Thanks a lot. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: App Block
Hi Luther, there is an annotation @DataType(). It is used to annotate accessors in you Entity. With this you can shortcut the DataTypeAnalyzer. names the block to render the Type. Greetings nillehammer Luther Baker schrieb: Is there a way to 'choose' which render block to use for a particular context? I have created a DISPLAY and an EDIT render block for a GenericSelectModel based on a Hibernate table of values. In one context, a Hibernate entity holds a reference to this entity and terms it Parent. In another context, a Hibernate entity holds a reference to this entity and terms it File Cabinet. I register the type with the AppModule - but is it possible to let the component choose which app block to display? Is there another way to use the GenericSelectModel with multiple labels? Thanks, -Luther -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: New User int the group
Hi Gutemberg, go to the following page: http://tapestry.apache.org/mail-lists.html There you'll find the email address for subscription (users-subscr...@tapestry.apache.org). Send a mail to this address. You'll recieve a confirmation mail. After confirmation you're part of the game. Be prepared to recieve LOADS of mails, as this list is very active. It might be a good idea to have an email address just for recieving mails from the list. Regards nillehammer -- http://www.winfonet.eu Gutemberg A. Da Silva schrieb: how do I do to add one new user in the tapestry-users group? -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Singleton Service behaves like a Per-Thread service
Hy Toby, you might be fooled by your own code. if (domains!=null){ return queries the database; Should be if (domains==null){ return queries the database; Regards, nillehammer -- http://www.winfonet.eu superoverdr...@gmx.de schrieb: Hello everyone! I am a bit confused. I thought the default service binding is a singleton? But why do I see a database query every time I load the same page? public class DomainPropertyService { private Session session; private ListDomain domains = null; public DomainPropertyService(Session session){ this.session=session; } public String getString(String key){ if (domains==null){ domains = session.createCriteria(Domain.class).list(); } if (domains!=null){ return queries the database; } else { return read from cache; } } } public static void bind(ServiceBinder binder) { binder.bind(DomainPropertyService.class); } Thanks! Toby - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How to implement a long lasting operation waiting page
Hi Hugo, perhaps you do not need ajax at all. The meta tag meta http-equiv=refresh content=5; URL=myWaitingPage might come in handy. This tag causes the browser to wait a certain amount of seconds before it requests the url. You could implement myWaitingPage to check whether the operation finished. If yes it would redirect to the result page, if not it would redirect to itself. Hope this helps. Regards, nillehammer -- http://www.winfonet.eu Hugo Palma schrieb: I have an operation that needs to be executed that could take a couple of minutes and so i'd like to provide a page where at first it displays a waiting message while the operation is getting executed and then if shows the result of that operation, using ajax so that i don't have to go to another page. Any ideas about the best way to do this ? If i bind the process execution to any phase of the page lifecycle it will always be executed before it renders anything and i loose control on how to update the page once the operation is complete. Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: validator and activation link
Hi Abangkis, I am not familiar with versions of Tapestry prior to 5.0. So I cannot answer your first question. Your second one is explained on the following page: http://tapestry.apache.org/tapestry5/guide/pagenav.html Scroll to the middle of that page the section named Page Render Requests. In addition to the method explained on that page you can use EventContext as a parameter. (http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/EventContext.html) Hope this helps. In case it does not, please do not hesitate to ask. Regards nillehammer abangkis schrieb: Hai guys, I've got two question that i would like to ask : 1. There use to be a match and differ validator, is this validator gone in T5 ? Is there anything i could use to subtitute it ? 2. How can I implement an activation link. So if a user click on some link (ex: www.myweb.net/approval/mykey123232 ) i can get the key and process it ? Cheers, Abangkis - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Extend AppPropertyEditBlocks with cut feature
Hi List, I am making extensive use of AppPropertyEditBlocks. Now I'd like to extend the way the blocks are rendered. I'd like to provide somehow a maxLenth value. Maxlenth being null the whole output should be displayed. Maxlength being positive the output should be cut to maxLenth. I have browsed T5's sources and have run into a dead end at AbstractPropertyDisplay and interface Block. Has anyone got an idea how to achieve this? Thanks in advance, nillehammer -- http://www.winfonet.eu - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: t:if test considers Float 1.0 as false?
Hi James, I don't think it is an issue with the if-component. If-component just calls a method that is given in the test-attribute and evaluates whether it returns true or false. Could it be that in this method you accidencially do an Integer comparison instead of a Float comparison? Greetz nillehammer James Hillyerd schrieb: It seems that t:if considers 0.1, 0.99 as false, but 1.0 as true. Should I file a bug? This is 5.0.18 -james - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Adding additional Textinput fields during runtime
Hi Toby, http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Loop.html The example Forms and Loops Example might give you, what you are looking for. Cheers nillehammer superoverdr...@gmx.de schrieb: Hi there! Is there a way to add additional Textinput fields during runtime without having specified them all before in Tapestry? I am working on an Admin interface that allows to add configuration values to an object. E.g. you would see a dropdown box with parameters that are available. You can then assign a value to an objectwhich would result in an additional Textfield for that value. There is an entity called Domain and one called Value. A value can be anything - could be the language, the country, the character set or whatever. The meaning of such a value is achieved by a Category that is referenced by a value. E.g. if you want to add an additional configuration parameter to a Domain, you select Country, then a new Value field could be entered (e.g. USA). Then you could choose to add a Value for Language, then a new text field to enter a language would be displayed. The problem is I need to define all Properties in the page beforeso how would you handle such a case? To have unlimited input fieldsthat are not all defined before? Thanks! Toby - 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: Entities referencing domain style Entities
Hi Luther, an alternative to contributing a DataTypeAnalyzer you could also use the annotation DataType on getters in your Entities so instead of doing public static void contributeDefaultDataTypeAnalyzer MappedConfigurationClass, String configuration) { configuration.add(Category.class, category); } you could do public class User { ... @DataType(category) // DataType needn't be analyzed, because you // provide Tapestry with necessary information. public Category getCategory() { return this.category; } ... } lutherbaker schrieb: Thanks Uli! Ulrich Stärk wrote: Luther Baker schrieb: I have an entity that contains another entity - but this time, the contained entity table is quite finite - say, 10 rows. public class Category { private String name; } public class User { private String firstName; private String lastName; private Category category; } and in this case, I'd like to render firstName, lastName and a DROP DOWN or some type of picker from existing Categories. Would I need to create my own t:form ... and possibly use a t:BeanEditor with a custom drop down/picker -- or is this type of idiom encapsulated in a Tapestry component already? Thanks much, -Luther Indeed you'll have to create a BeanBlockContribution and contribute it to the BeanBlockSource service. This contribution tells tapestry where to look for the component, that is responsible for rendering your type. Additionally you'll have to contribute your type to the DefaultDataTypeAnalyzer service. That could look something along the lines of public static void contributeDefaultDataTypeAnalyzer( MappedConfigurationClass, String configuration) { configuration.add(Category.class, category); } public static void contributeBeanBlockSource(ConfigurationBeanBlockContribution configuration) { configuration.add(new BeanBlockContribution(category, AppPropertyEditBlocks, category, true)); } AppPropertyEditBlocks is the name of a page that contains a component with the id category that is responsible for rendering your category. In your case this would be a select component: @Environmental private PropertyEditContext context; @Component(parameters = { value=context.propertyValue, label=prop:context.label, model=prop:categoryModel, encoder=prop:categoryEncoder, clientId=prop:context.propertyId, validate=prop:validator }) private Select category; @Inject private PropertyAccess propertyAccess; @SuppressWarnings({ unused, unchecked }) public FieldValidator getValidator() { return context.getValidator(category); } public PropertyEditContext getContext() { return context; } public SelectModelCategory getCategoryModel() { ... } public ValueEncoderCategory getCategoryEncoder() { ... } with the corresponding .tml: div xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; t:block t:id=category t:label for=category / t:select t:id=category / /t:block /div I believe that there is also some information about this on the wiki, check it out! HTH, Uli - 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: BeanEditForm Component in Tapestry 5
With BeanEditForm Person need not be instanciated in onActivate. That is done automagically by the component itself. The Exception surely refers to the id. Id being the only number in your Person class. Although I do not know, why that would be a problem for Tapestry, you surely would not want the user to edit the database id. So try the following. You might get rid of your problem with that: public class Persion { ... @NonVisual //-- that excludes this member from the generated // BeanModel. This could also be done manually whit exclude. // (see BeanModel for further information. public Person getPerson() { return person; } ... } Otho schrieb: You obviously left out some things for brevity, but I can't see Person anywhere instantiated? public class PersonForm { @Persist @Property //no need for accessors private Person person; Object onActivate() { if(person==null) person = new Person(); return null; } Object onSuccessFromPersonEditor() { return null; } } And you also seem to not have an id for the beaneditform. with the above code that would be: t:beaneditform t:id=personEditor t:object=person/ Regards, Otho 2008/12/11 mraible m...@raibledesigns.com I'm working on a simple CRUD example for Tapestry 5 (version 5.0.18) today in order to create the necessary FreeMarker templates for AppFuse's Maven Plugin. Here's my form class: package org.appfuse.webapp.pages; import org.apache.tapestry5.annotations.Persist; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.ioc.annotations.Inject; import org.appfuse.model.Person; public class PersonForm { @Persist private Person person; public Person getPerson() { return person; } public void setPerson(Person person) { this.person = person; } } My PersonForm.tml: t:layout title=message:personForm.title heading=message:personForm.heading menu=literal:PersonMenu xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; body h1Create New Person/h1 t:beaneditform t:object=person/ /body /t:layout Pretty simple. The Person.java object is as follows: package org.appfuse.model; import javax.persistence.*; @Entity public class Person { private Long id; private String firstName; public void setFirstName(String firstName) { this.firstName = firstName; } public void setId(Long id) { this.id = id; } public void setLastName(String lastName) { this.lastName = lastName; } private String lastName; @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() { return this.id; } @Column(name = first_name, length = 50) public String getFirstName() { return this.firstName; } @Column(name = last_name, length = 50) public String getLastName() { return this.lastName; } public String toString() { return firstName + ' ' + lastName; } } When I access http://localhost:8080/personform, I get the following error: Render queue error in AfterRender[PersonForm:beaneditform.editor.loop]: Failure reading parameter 'validate' of component core/PropertyEditBlocks:numberfield: No object of type org.apache.tapestry5.services.PropertyEditContext is available from the Environment. Available types are org.apache.tapestry5.RenderSupport, org.apache.tapestry5.ValidationDecorator, org.apache.tapestry5.ValidationTracker, org.apache.tapestry5.internal.services.ClientBehaviorSupport, org.apache.tapestry5.internal.services.DocumentLinker, org.apache.tapestry5.services.BeanEditContext, org.apache.tapestry5.services.FormSupport, org.apache.tapestry5.services.Heartbeat. Any ideas? Thanks, Matt -- View this message in context: http://www.nabble.com/BeanEditForm-Component-in-Tapestry-5-tp20964358p20964358.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: BeanEditForm Component in Tapestry 5
Sorry I messed up the code example corrected version: public class Persion { ... @Id @GeneratedValue(strategy = GenerationType.AUTO) @NonVisual //-- that excludes this member from the generated // BeanModel. This could also be done manually whit exclude. // (see BeanModel for further information. public Person getId() { return person; } ... } nillehammer schrieb: With BeanEditForm Person need not be instanciated in onActivate. That is done automagically by the component itself. The Exception surely refers to the id. Id being the only number in your Person class. Although I do not know, why that would be a problem for Tapestry, you surely would not want the user to edit the database id. So try the following. You might get rid of your problem with that: public class Persion { ... @NonVisual //-- that excludes this member from the generated // BeanModel. This could also be done manually whit exclude. // (see BeanModel for further information. public Person getPerson() { return person; } ... } Otho schrieb: You obviously left out some things for brevity, but I can't see Person anywhere instantiated? public class PersonForm { @Persist @Property //no need for accessors private Person person; Object onActivate() { if(person==null) person = new Person(); return null; } Object onSuccessFromPersonEditor() { return null; } } And you also seem to not have an id for the beaneditform. with the above code that would be: t:beaneditform t:id=personEditor t:object=person/ Regards, Otho 2008/12/11 mraible m...@raibledesigns.com I'm working on a simple CRUD example for Tapestry 5 (version 5.0.18) today in order to create the necessary FreeMarker templates for AppFuse's Maven Plugin. Here's my form class: package org.appfuse.webapp.pages; import org.apache.tapestry5.annotations.Persist; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.ioc.annotations.Inject; import org.appfuse.model.Person; public class PersonForm { @Persist private Person person; public Person getPerson() { return person; } public void setPerson(Person person) { this.person = person; } } My PersonForm.tml: t:layout title=message:personForm.title heading=message:personForm.heading menu=literal:PersonMenu xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; body h1Create New Person/h1 t:beaneditform t:object=person/ /body /t:layout Pretty simple. The Person.java object is as follows: package org.appfuse.model; import javax.persistence.*; @Entity public class Person { private Long id; private String firstName; public void setFirstName(String firstName) { this.firstName = firstName; } public void setId(Long id) { this.id = id; } public void setLastName(String lastName) { this.lastName = lastName; } private String lastName; @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() { return this.id; } @Column(name = first_name, length = 50) public String getFirstName() { return this.firstName; } @Column(name = last_name, length = 50) public String getLastName() { return this.lastName; } public String toString() { return firstName + ' ' + lastName; } } When I access http://localhost:8080/personform, I get the following error: Render queue error in AfterRender[PersonForm:beaneditform.editor.loop]: Failure reading parameter 'validate' of component core/PropertyEditBlocks:numberfield: No object of type org.apache.tapestry5.services.PropertyEditContext is available from the Environment. Available types are org.apache.tapestry5.RenderSupport, org.apache.tapestry5.ValidationDecorator, org.apache.tapestry5.ValidationTracker, org.apache.tapestry5.internal.services.ClientBehaviorSupport, org.apache.tapestry5.internal.services.DocumentLinker, org.apache.tapestry5.services.BeanEditContext, org.apache.tapestry5.services.FormSupport, org.apache.tapestry5.services.Heartbeat. Any ideas? Thanks, Matt -- View this message in context: http://www.nabble.com/BeanEditForm-Component-in-Tapestry-5-tp20964358p20964358.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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: T5: run time generation of pages?
Hi guys, I don't think it is possible to use Tapestry that way. As I have learned (and hopefully did not completely get wrong) from a Tapestry lesson once held by Igor and Renat, Tapestry determines the site's structure (i.e pages, components etc.) on application startup. For performance reasons this structure is static. But maybe I am proven wrong by someone more competent? Regards nillehammer Thiago H. de Paula Figueiredo schrieb: Em Sat, 13 Dec 2008 01:14:00 -0300, Angelo Chen angelochen...@yahoo.com.hk escreveu: I don't know if this is possible, just like to ask around: say a .tml and and .java file are generated at run time from certain information kept somewhere, and these files are written to the correct t5 package, is there a way to compile this page and got displayed? in the T5's apache page it has a equanda 3rd party lib that generates a program from certain spec, but it is generated and compiled before it is packaged, I'd like to have something dynamic, possible? I don't know too, and I'm very interested in knowing too. :) But, instead of generating the sources and compiling them, I would generate them on the fly using Javassist. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: White space problems in latest T5 snapshot
Hi Peter, that seems odd. Your label, being just as an html tag not the Tapestry component, should not be touched by Tapestry at all. Is there a reason, why you do not use the component? If not, I suggest you rewrite your code to: t:label class=formLabel for=address2 /... This surely does not answer your question, but might well solve your problem. Greetz nillehammer Hi everyone, Not sure if its just me, but since this morning I am experiencing some weird problems with whitespace. This line of code: label class=formLabel /t:textfield t:id=address2 value=site.address2 /br/ Is rendering as: label class=formLabel input id=address2 type=text name=address3/ img id=address2:icon class=t-error-icon src=../../assets/5.0.16-SNAPSHOT/tapestry/spacer.gif alt= style=display: none;/ br/ /label Which is clearly incorrect, if I add a character like this: label class=formLabelZ/labelt:textfield t:id=address2 value=site.address2 /br/ it becomes: label class=formLabel inlineBlockZ/label input id=address2 type=text value=201 Main Street name=address2/ img id=address2:icon class=t-error-icon src=../../assets/5.0.16-SNAPSHOT/tapestry/spacer.gif alt= style=display: none;/ br/ which is correct. I even tried replacing the Z with a space or character code, but it doesn't work either... has something changed in the tag rendering with regards to whitespace? why is label closed in the wrong place? is anyone else experiencing this? thanks, Peter - 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 Handling invalid urls with redirects
Hi List, Long time no see. I have finally got my application online and am facing two problems, I have not thought of before. Both of which are users or search bots (namely google) using wrong urls. 1.) I have got an index Page in the root which works fine, but my beloved users tend to type index.jsp or index.html instead of just index into the address bar of their browser. (Maybe it's because they're mainly Germans and therefore are hyper correct;-)) ) The dot being used Tapestry interprets those as components on the index page with ids jsp and html and shows my nicely crafted ExceptionReport. I'd rather have Tapestry send a redirect to the correct url. How can this be accomplished? I have thought of implementing components with names jsp and html and writing event handlers for them but that seems a bit odd to me. 2.) Before the migration to Tapestry the application was struts based. Therefore all the URLs within the application have changed. That would not be a problem, but google keeps the old URLs. I think the reason is that when a completely wrong URL is typed in Tapestry will directly response with the index page rather than redirecting to it. So the client-software never gets informed about the incorrectness. Also in this case I would like Tapestry to do a redirect. How can this be done? Your help will be apreciated. Yours nillehammer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Page pool hard limit and page instance usage
Hi list, I am also facing the problem that 9902468 had. I have -according to Howard's suggestion- replaced every pageLink with a customPageLink to prevent targeted pages from being created unecessarily. The problem persists. Trying to load the index-Page of my application with a browser I have to wait about two minutes before I get an empty page. In the app's log the following Exception appears: java.lang.RuntimeException: The page pool for page 'Index' (in locale de) has been exausted: there are 20 instances currently being used and no more can be created. Try increasing the hard limit (symbol tapestry.page-pool.hard-limit) to allow additional instances to be created, or increasing the soft wait (symbol tapestry.page-pool.soft-wait) to trade away some throughput for more efficient use of page instances. at org.apache.tapestry5.internal.services.PagePoolCache.checkout(PagePoolCache.java:199) at org.apache.tapestry5.internal.services.PagePoolImpl.checkout(PagePoolImpl.java:107) at $PagePool_11c76f8cf9a.checkout($PagePool_11c76f8cf9a.java) at org.apache.tapestry5.internal.services.RequestPageCacheImpl.get(RequestPageCacheImpl.java:43) at $RequestPageCache_11c76f8cf99.get($RequestPageCache_11c76f8cf99.java) at $RequestPageCache_11c76f8cf91.get($RequestPageCache_11c76f8cf91.java) ... In development and in production environment I use Java 6 and Tomcat 6. Tapestry is 5.0.14. The strange thing is that I am only seeing this in production environment. Has anyone a suggestion how to track this down? I am pretty stuck with this. Thanks in advance, nillehammer Howard Lewis Ship wrote Tapestry is obtaining page instances to see if there is an activation context for the page. I expect to optimize this in the future, to check to see if the page has an event handler for the passivate event. In the meantime, you could build your own PageLink component that generates the link by invoking ComponentResources.createPageLink(pagename, true) ... that will tell Tapestry to generate a link to the page with no activation context, and the page will NOT be queried for its context, and therefore, won't need to be attached to the current request. On Fri, Aug 29, 2008 at 3:58 AM, 9902468 [EMAIL PROTECTED] wrote: Hi, we are experiencing strange hard pool limit reached exceptions. (For the user count that we have.) After debugging a little, it seems that our left menu component, which is full of page links, instantiates not only the page that we are at, but also the ones that are referenced in page link. This can be seen also in that exception page is shown, if one of the pages that are referenced in page links have an error. Is this correct behavior? And should we really use common a href= tags to avoid this? Further more, is it possible to create infinite loop, when page a has page link to page b, which has page link to page a? - 99 -- View this message in context: http://www.nabble.com/Page-pool-hard-limit-and-page-instance-usage-tp19217773p19217773.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Page pool hard limit and page instance usage
Man that was a quick answer! Thanks for that. I am aware of this options in the configuration. I had not tuned them before, because load is not my problem. Anyway I have tuned them now and am currently waiting for the admistrator to deploy the newest war. According to acces-logs I was the only user accessing the page. So as far as I understand the mechanism only one instance of index should have been created and not 20. I think it is an issue with configuration in production environment. But I have no idea where to take a closer look (i.e. where to build in log-messages, which of Tomcat's configuration options to check etc.). So suggestions are still more than welcome. Nillehammer 9902468 schrieb: Hi, Eventually we had to add these to appmodule: configuration.add(tapestry.page-pool.hard-limit, 60); configuration.add(tapestry.page-pool.soft-limit, 20); configuration.add(tapestry.page-pool.soft-wait, 20 ms); as instructed here: http://tapestry.apache.org/tapestry5/guide/conf.html This solved our problems, and you can go up as long as your server has memory. Our problems were only in production, as development stress just isn't enough. (This is why one really should do load testing with jmeter or similar tool.) The defaults could be a bit more? Or considerably less, so that the developer would hit these walls during development and understands to load test / tune the parameters. - 99 nille hammer wrote: Hi list, I am also facing the problem that 9902468 had. I have -according to Howard's suggestion- replaced every pageLink with a customPageLink to prevent targeted pages from being created unecessarily. The problem persists. Trying to load the index-Page of my application with a browser I have to wait about two minutes before I get an empty page. In the app's log the following Exception appears: java.lang.RuntimeException: The page pool for page 'Index' (in locale de) has been exausted: there are 20 instances currently being used and no more can be created. Try increasing the hard limit (symbol tapestry.page-pool.hard-limit) to allow additional instances to be created, or increasing the soft wait (symbol tapestry.page-pool.soft-wait) to trade away some throughput for more efficient use of page instances. at org.apache.tapestry5.internal.services.PagePoolCache.checkout(PagePoolCache.java:199) at org.apache.tapestry5.internal.services.PagePoolImpl.checkout(PagePoolImpl.java:107) at $PagePool_11c76f8cf9a.checkout($PagePool_11c76f8cf9a.java) at org.apache.tapestry5.internal.services.RequestPageCacheImpl.get(RequestPageCacheImpl.java:43) at $RequestPageCache_11c76f8cf99.get($RequestPageCache_11c76f8cf99.java) at $RequestPageCache_11c76f8cf91.get($RequestPageCache_11c76f8cf91.java) ... In development and in production environment I use Java 6 and Tomcat 6. Tapestry is 5.0.14. The strange thing is that I am only seeing this in production environment. Has anyone a suggestion how to track this down? I am pretty stuck with this. Thanks in advance, nillehammer Howard Lewis Ship wrote Tapestry is obtaining page instances to see if there is an activation context for the page. I expect to optimize this in the future, to check to see if the page has an event handler for the passivate event. In the meantime, you could build your own PageLink component that generates the link by invoking ComponentResources.createPageLink(pagename, true) ... that will tell Tapestry to generate a link to the page with no activation context, and the page will NOT be queried for its context, and therefore, won't need to be attached to the current request. On Fri, Aug 29, 2008 at 3:58 AM, 9902468 [EMAIL PROTECTED] wrote: Hi, we are experiencing strange hard pool limit reached exceptions. (For the user count that we have.) After debugging a little, it seems that our left menu component, which is full of page links, instantiates not only the page that we are at, but also the ones that are referenced in page link. This can be seen also in that exception page is shown, if one of the pages that are referenced in page links have an error. Is this correct behavior? And should we really use common a href= tags to avoid this? Further more, is it possible to create infinite loop, when page a has page link to page b, which has page link to page a? - 99 -- View this message in context: http://www.nabble.com/Page-pool-hard-limit-and-page-instance-usage-tp19217773p19217773.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: [Hint] Pages in subpackages not loaded, if page and subpackage have the same name
Hi Guys, I agree with Howard. I think tapestry's behaviour of mapping URLs to page classes is good enough to be left as is. It is pretictable and easy to use... at least looking back from now. The day I had the problem I was a little confused not having totally understood everything. A hint in the doc would have spared me some hours of tumbling around. And as I neither have found anything covering my problem in the maillist, I wanted to share my experience so that future users would find my mail and get a bit quicker past this silly mistake than me. So again dear future user: Do not name a Page class the same like a subpackage of the package in which the class resides (or the other way round). This will lead to pages in subpackages (i.e. subpages) not loading. Read again the topic on activation context in the docs and you will understand why ;-) Kind regards and further enjoy the use of Tapestry, nillehammer Am Dienstag, 12. Februar 2008 01:01 schrieb Howard Lewis Ship: I'm really opposed to this. It is One More Choice to Make and that's a bad thing. Addiing lots of options that can be enabled or disabled is a cop out, if a feature needs to be disabled, it is likely broken. I'm only leaving in the optimized request stuff so that I can prove its not worth using (!). I want there to be a rigid, predictable set of rules for mapping between URLs and class names, not an endless series of decisions. I'm picturing this from a support angle, as in, limiting the number of questions I'd have to ask a prospective client. Some amount of configuration and tuning is unavoidable, but I think making major behaviors of the application optional will ultimately be worse than making people work around, or otherwise adapt to, Tapestry's naming rules. And it gets worse for IDEs that want to keep up with Tapestry. On Feb 11, 2008 1:08 PM, Daniel Jue [EMAIL PROTECTED] wrote: How about a flag in the app module to just turn off the friendly page renaming altogether? Then if someone wants to have a page structure like report/status report/reportstatus report/statusreport report/statusreport1 They can all resolve to unique pages. For now, I'll add the contents of my old post to the Caveats wiki http://wiki.apache.org/tapestry/Tapestry5Caveats On Feb 11, 2008 3:36 PM, Howard Lewis Ship [EMAIL PROTECTED] wrote: I agree this is a tripping point that needs addressing. I tend to organize things a little differently, so I'd have an orders package, with ListOrders, ViewOrders and EditOrders classes, thus: http://localhost/orders/list http://localhost/orders/view/101 http://localhost/orders/edit/101 On Feb 11, 2008 10:07 AM, Kevin Menard [EMAIL PROTECTED] wrote: I ran into the same problem early on, and eventually just changed the name of my pages. What I wanted was to be able to have a URL hierarchy like the following: http://localhost/orders http://localhost/orders/view/101 http://localhost/orders/edit/101 There was no clear way to have an index page, like Start functions as in the root package. So, I naturally added an Orders page. All subsequent page accesses were viewed as activation context, however, so that fell apart. I sorta forgot about all this and hoped it had been fixed. If not, it'd be great if it could be, as it seems to be a tripping point for a lot of people. -- Kevin On 2/10/08 3:52 PM, in article [EMAIL PROTECTED], Howard Lewis Ship [EMAIL PROTECTED] wrote: That's a very good point; I think it indicates that the approach taken by Tapestry when recognizing page names is too simplistic. Instead of trying to match forward, it should match backward, or perhaps create a Trie structure from the available page names.† On Feb 9, 2008 1:37 PM, nillehammer [EMAIL PROTECTED] wrote: Hello fellow users, I have just faced a little problem. I have searched the online documentation of tapestry 5, this maillist and google for a solution. As I did not find anything apropriate, I think this might be worth a mail. I obviously chose a very stupid packages/classes hirarchy: eu.domain.app.pages.Menu.java eu.domain.app.pages.menu.Subpage1.java eu.domain.app.pages.menu.Subpage2.java This results in logical page names (and corresponding URLs): menu menu/subpage1 menu/subpage2 Now clicking a link ...menu/subpage1 or .../menu/subpage2 neither of the two pages ever loads. The page named menu allways shows up. I guess this behaviour occours, because the remaining part of the URL after menu/ is handed to the page named menu as context rather than requesting the subpages. So do not do
[Hint] Pages in subpackages not loaded, if page and subpackage have the same name
Hello fellow users, I have just faced a little problem. I have searched the online documentation of tapestry 5, this maillist and google for a solution. As I did not find anything apropriate, I think this might be worth a mail. I obviously chose a very stupid packages/classes hirarchy: eu.domain.app.pages.Menu.java eu.domain.app.pages.menu.Subpage1.java eu.domain.app.pages.menu.Subpage2.java This results in logical page names (and corresponding URLs): menu menu/subpage1 menu/subpage2 Now clicking a link ...menu/subpage1 or .../menu/subpage2 neither of the two pages ever loads. The page named menu allways shows up. I guess this behaviour occours, because the remaining part of the URL after menu/ is handed to the page named menu as context rather than requesting the subpages. So do not do this. Kind regards, nillehammer P.S. My standing ovations to the tapestry developers. They have given the term straight forward a whole new meaning. Keep up the great work! THX - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]