Re: Live reload in production?
my $0.02. If it was enabled till today then we should leave it that way. In documentation there should be note that it is possible to speed up significantly application by doing something and with cost of no live class reloads in production. Regards, Michal -- View this message in context: http://tapestry-users.832.n2.nabble.com/Live-reload-in-production-tp6288037p6293772.html Sent from the Tapestry Users 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: Quickstart for a IOC type project?
Hi Angelo, if you will run your app, could you share it (some early revision, without business logic), or write something about standalone T5 application? I never had enough of time to do the research, and I always was curious how T5 IOC looks in standalone app in comparison to e.g. Pico container :) Thanks and regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/Quickstart-for-a-IOC-type-project-tp6097716p6113480.html Sent from the Tapestry Users 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: Exception starting filter test
yes you may give it any name, but contract in web.xml is: in provided package root (in your case tapDemo) it will search for package services and in it there should be a class App1.java so please check if you have following class tapDemo.services.App1.java -- View this message in context: http://tapestry-users.832.n2.nabble.com/Exception-starting-filter-test-tp6083791p6096738.html Sent from the Tapestry Users 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] Removing project name and port number from URL
http://wiki.eclipse.org/Jetty/Howto/Deploy_Web_Applications If the webapp is called root.war or the directory is called root/ then it will be deployed at the / context. So yes, it should help. As for port, changing that in jetty also will help, but take a look into secure port number. By default it is 8443, change that to 443 in order to avoid adding port number to https connections Regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/T5-Removing-project-name-and-port-number-from-URL-tp5876705p5877869.html Sent from the Tapestry Users 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 when trying to use the components tapx
I do believe that it is on github available https://github.com/hlship/tapx so if there is no other way, you can always download sources and run gradle build BTW Howard will Tapestry, as a project, start using gradle instead of maven (or as an alternative)? -- View this message in context: http://tapestry-users.832.n2.nabble.com/error-when-trying-to-use-the-components-tapx-tp5864156p5874531.html Sent from the Tapestry Users 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: A more general approach to configuring for compatibility
There are three that I know of that may be used to achieve that First is Wookie (Apache licence) Second one is jumpstart (also open source, don't know what licence though) Third is hotel bookmarking application I know that two of those are made as a demo apps, but they contain a lot of T5 features still. Only thing needed would be server for selenium tests and some separate repo for test. Maybe apache-extras? Regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/A-more-general-approach-to-configuring-for-compatibility-tp5846901p5861794.html Sent from the Tapestry Users 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: A more general approach to configuring for compatibility
I'm not familiar with Tapestry code but that sounds like a lot of if's and checking for version. If i'm not mistaken then it will pollute the code and maybe slow down applications (as every action will need to be checked) If it is possible then additional modules sounds as much better idea. If someone is upgrading library version then some minimal effort is required from his side (downloading new jar/changing maven). Some small additional effort (downloading second jar/adding maven dependency) should not be so exhausting, and will allow to avoid a lot of unnecessary code. Regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/A-more-general-approach-to-configuring-for-compatibility-tp5846901p5859511.html Sent from the Tapestry Users 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: It's payback time!
Tapestry don't have best press int the world. In SS comments there is starting another flame war. http://www.theserverside.com/news/thread.tss?thread_id=61537 Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/It-s-payback-time-tp5847075p5856555.html Sent from the Tapestry Users 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: @Transactional needed in tapestry-hibernate?
for sake of backward compatibility imho @commitAfter should not be modified to work as @Transactional. Additional annotation is safer choice. Regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/Transactional-needed-in-tapestry-hibernate-tp5826487p5838112.html Sent from the Tapestry Users 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: First Tapestry app with Hibernate
That is probably not the answer that you would excpect but please review that small app of mine. I created that for JUG and it has working hibernate support for T5 with in memory h2 db running. It's not cleanest, but should be easy to understand. http://bitbucket.org/mgruca/tjug_tapestry_30.09.10/overview Last thing that I recall regarding hibernate (I was even writing that on this list), I had to annotate AppModule with @SubModule(value = { HibernateModule.class }) else eclipse was ** on me. -- View this message in context: http://tapestry-users.832.n2.nabble.com/First-Tapestry-app-with-Hibernate-tp5787608p5790976.html Sent from the Tapestry Users 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: First Tapestry app with Hibernate
Hi, are you using eclipse for that project? I had some issues due to .m2 plugin. If it is the case then try to take out pom.xml and create new project using mvn command line. Then import project to eclipse and check if it will start working. I was doing a lot of this kind of magic tricks to get eclipse working with my poms Regards Michał -- View this message in context: http://tapestry-users.832.n2.nabble.com/First-Tapestry-app-with-Hibernate-tp5787608p5787933.html Sent from the Tapestry Users 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: [ANN] Polish blog about Tapestry 5
Don't worry to much about exception page, it's important for me that it gives me information, I don't need to like colors ;) Besides while translating, I guess that most of context data may be lost. My blog posts won't be 100% serious, it's just not my style. I'm big fan of T5, else I wouldn't follow it for over 2 yrs or something like that ;) @Adam: I don't believe as it is needed. It would also require a lot of work. Also maintaining page later on would be pain. I prefer to cover same topics on my blog as a reference with other examples (guess game is probably not the best example of that ;) Sorry for just copying it, but I had no better idea to show simple mechanism Regards Michal -- View this message in context: http://tapestry-users.832.n2.nabble.com/ANN-Polish-blog-about-Tapestry-5-tp5768229p5769634.html Sent from the Tapestry Users 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
[ANN] Polish blog about Tapestry 5
Hi all, I started writing blog about tapestry some time ago. Today I announced that in public. Till I'll get comfortable with writing on regular basis I'm planning to stick to my mothers tongue and that is polish. Later on I plan to do couple screen casts in English, maybe switch language totally on all posts. I hope to convince some people to tapestry camp. Currently i'm writing step by step tutorial. If any one is interested please request translation in comments or use google translate ;) Please cross your fingers for success and enough of my self motivation to keep on writing new stuff :) Hope that this blog will be another reference for tapestry freshers. oh, and address :P http://mgruca.wordpress.com Regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/ANN-Polish-blog-about-Tapestry-5-tp5768229p5768229.html Sent from the Tapestry Users 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: Should Tapestry phone home?
One more idea from my side. This could be done as extension (similar to hibernate support) that would provide statistic's for page owner with checkbox: send my anonymized data to tapestry.apache.org and separate page on which user could configure what is send -- View this message in context: http://tapestry-users.832.n2.nabble.com/Should-Tapestry-phone-home-tp5623806p5626454.html Sent from the Tapestry Users 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: Should Tapestry phone home?
+1 for not do it by default. But I give +1 if it could be additional library added if someone wishes to contribute. As for how it could work my proposal is to put some public page on tapestry project where anyone could check site some aggregated stats. In library service module there should be options that could set what is being uploaded to tapestry public repository. In return for that data, tapestry could send emails with information about updates or important security patches. Regards Michał -- View this message in context: http://tapestry-users.832.n2.nabble.com/Should-Tapestry-phone-home-tp5623806p5625727.html Sent from the Tapestry Users 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] Constructor issue
Howard Lewis Ship wrote: > > Remember that you can place @Inject on the constructor that should be > used if there's any ambiguity. > That is what I was looking for. Thanks :) and +1 for adding that to FAQ :) -- View this message in context: http://tapestry-users.832.n2.nabble.com/T5-2-Constructor-issue-tp5603058p5605989.html Sent from the Tapestry Users 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] Constructor issue
I must disagree. But first to clarify. I described two cases. 1. BeanEditForm that cannot instantiate my object 2. Same issue for SSO creating java.util.Date AD 1. Quote from BeanEditForm doc: "Often, the BeanEditForm can create the object as needed (assuming a public, no arguments constructor). " So i provided such constructor in my entity (public no agrs) + I added another one that taken String and custom enum. What I assumed was that T5 will just use the one that it can use and leave other one alone. Due to that behavior no object handled to BeanEditForm should have more constructors than default one, or should be always created manually, and that is bit more than user need to do. Ad 2. Quote from linked documentation: "The first time you access an SSO, it is created automatically. Typically, the SSO will have a public no-args constructor ... but you may inject dependencies into the SSO via its constructor, as you can with a Tapestry IoC service implementation." In this case I wanted to use Date. Maybe not some real case scenario, so let's think about shoping basket for example. It may have default no args for T5 and second one if I want to instantiate it with some products. If T5 always takes constructor with most arguments it will fail on that scenario also, meaning that I will have to check boolean variable companion exist on every page on which I wan't to use my object. IMHO the best would be try to use no-args constructor or use one with most args and if You fail try another one and another till You succeed (meaning reach default no-args or error when there is no default no-args constructor). Regards Michał -- View this message in context: http://tapestry-users.832.n2.nabble.com/T5-2-Constructor-issue-tp5603058p5603560.html Sent from the Tapestry Users 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] Constructor issue
Hi all. While preparing small showcase app, odd problem came out. When I created domain object with two constructors (first was default NOOP, second one had two parameters string and enum, it was meant for manual initialization only) and tried to use it with beaneditform I received exception that tapestry cannot handle my object creation. After removing parametrized constructor, error disappeared. It's bit odd IMHO. Tapestry should be capable to instantiate objects that have more than one constructor. Also @SessionState behaved weirdly. I was annotating java.util.Date. Error came up if I haven't instantiate object manually. Date has default constructor so Tapestry should be fine with constructing new Date on it's own. Maybe there are some reasons for that kind of behavior, but as I see it those are bugs. Should I create jira ticket for that? Tested on tapestry 5.2.1-snapshot. Link to application sources: https://bitbucket.org/mgruca/tjug_tapestry_30.09.10/downloads (last revision or two were stripped out from additional constructors. Content may be in Polish, but code should be all in En) -- View this message in context: http://tapestry-users.832.n2.nabble.com/T5-2-Constructor-issue-tp5603058p5603058.html Sent from the Tapestry Users 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: Early steps getting Tapestry and Hibernate working via DAO
https://bitbucket.org/mgruca/tjug_tapestry_30.09.10/downloads That should run in eclipse with m2 plugin. Check it out, maybe it will help to find solution. In case if revision 9 wouldn't work, try previous one. Rev 9 are changes that I made during presentation, they should not affect anything, but I prefer to mention it just in case.a With regards Michał Gruca Alex W. Croton wrote: > > Hi, > > I am a real newbie when it comes to Tapestry and even worse than that when > it comes to Hibernate. > > I am using Tapestry 5.1.0 and Hibernate 3.3.1 - talking to a MySQL > database. > > I've got the code from the Tapestry5HowToUseTapestryHibernate working > fine, but in the application that I am putting together I want/need to be > able to use DAO to interface between the various components of the > application. > > After 3 days of various Googling, I'm far more confused than when I > started - it seems that the examples that I have been able to find are > either for a different version of Tapestry - or appear to be using some > form of magic that my environment is lacking :-) > > Can anyone offer any pointers to get me going on what 'bits' I need where > please? > > Regards, > > Alex C > > -- View this message in context: http://tapestry-users.832.n2.nabble.com/Early-steps-getting-Tapestry-and-Hibernate-working-via-DAO-tp5591178p5601938.html Sent from the Tapestry Users 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: Early steps getting Tapestry and Hibernate working via DAO
I gave presentation about Tapestry yesterday. In it I included hibernate integration example, I will share that after weekend. >From my observation: make sure that You have both hibernate libraries in Your classpath. Double check did You annotated AppModule with @Submodule(HibernateModule.class). That are two related points that gave me a lot of trouble. Mainly because of eclipse weakest side: maven integration. -- View this message in context: http://tapestry-users.832.n2.nabble.com/Early-steps-getting-Tapestry-and-Hibernate-working-via-DAO-tp5591178p5591360.html Sent from the Tapestry Users 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: IntelliJIDEA vs Eclipse
Ok, thtat was easy :) Thanks, it was one of most annoying things for me. I have a keymap on wall behind monitor, but it figures that i was using wrong alt :P My guess is probably after couple of months i will get used to differences. Intellij is ok. I'm slowly getting used to new keymap and way in which some features works different. Best regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/IntelliJIDEA-vs-Eclipse-tp5437089p5439558.html Sent from the Tapestry Users 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: repo?.maven.org/.../tapestry*/5.2.0 ?!?!
That helped. Thanks :) Anyway I still stick to my opinion that archetype should be fixed Andreas Andreou-2 wrote: > > Michal, edit the last few lines of pom.xml so that it sets > tapestry-release-version to 5.2.0 > and then rerun mcn jetty:run > -- View this message in context: http://tapestry-users.832.n2.nabble.com/repo-maven-org-tapestry-5-2-0-tp5437148p5439212.html Sent from the Tapestry Users 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: IntelliJIDEA vs Eclipse
Sven Homburg wrote: > > And, i hope that i dont lie, IntelliJ's refactoring is unbeatable. > And that's the reason why i love eclipse. I prefere it refactoring and code generation features. Also I'm used to using keyboard and in Intellij i had to use mouse. Could any one tell me is there a keyboard shortcut to call red bulb actions? (e.g. when i write function that does not exist and want to generate it i swing with mouse all over the screen waiting for red bulb to show up. In eclipse it is part of quick fix actions under ctrl+1). But imo it just proves that one should use tools that fits him best. Regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/IntelliJIDEA-vs-Eclipse-tp5437089p5439098.html Sent from the Tapestry Users 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: repo?.maven.org/.../tapestry*/5.2.0 ?!?!
I got clean mvn due to recent hdd failure :/ Maybe to be more specyfic: I go same way as You with archetype but after that when I try to run it with mvn jetty:run I get following (part of log) [ERROR] BUILD ERROR [INFO] [INFO] Failed to resolve artifact. Missing: -- 1) org.apache.tapestry:tapestry5-annotations:jar:5.2.0-SNAPSHOT Try downloading the file manually from the project website. ... 2) org.apache.tapestry:tapestry-func:jar:5.2.0-SNAPSHOT Try downloading the file manually from the project website. In http://repo1.maven.org/maven2/org/apache/tapestry/tapestry-annotations/ there really is no 5.2.x version I'm not in best relation with maven (I don't like him and he don't like me ;) ) so maybe I'm doing sth wrong or I don't get sth. It's not vital for me to get 5.2 but I would like to try it. Any idea? (I get same errors in eclipse + m2) -- View this message in context: http://tapestry-users.832.n2.nabble.com/repo-maven-org-tapestry-5-2-0-tp5437148p5438099.html Sent from the Tapestry Users 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: IntelliJIDEA vs Eclipse
The best IDE will be the one that fits You best. After couple of years when I was working with Eclipse, now I have to use Intellij at work and I hate it. I really can't get used to it. IMHO try both and pick one You like better. Both will do the job -- View this message in context: http://tapestry-users.832.n2.nabble.com/IntelliJIDEA-vs-Eclipse-tp5437089p5437729.html Sent from the Tapestry Users 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: repo?.maven.org/.../tapestry*/5.2.0 ?!?!
Hi all, I got bit other problem, as there is some problem with maven repo. I can't create tapestry project using 5.2 archetypes. I tried both 5.2.0 and snapshot. Could anyone check is everything ok with them? Regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/repo-maven-org-tapestry-5-2-0-tp5437148p5437706.html Sent from the Tapestry Users 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: Another IllegalAccessError in 5.2 alpha [bug?]
I'm not everyday Tapestry user but I try to 'evangelize' in my neighborhood. In April I given presentation about Tapestry on tricity JUG and in next couple of weeks I'm planning to do another one. During first presentation I told that T5 won't change in a way that will affect existing code and with new version there is feature that makes me a liar ;) After long introduction I have proposal. Maybe it would be best for T5 if there would be option in MappedConfiguration that would turn on/off live reloading on all methods, something like: configuration.add(SymbolConstants.ENABLE_LIVE_RELOADING, "true/false"); with possibility to add the .preventReloading()/.enableReloading() on services that should behave in other way. Thanks to that You are backward compatible (what is IMO the most important thing for tapestry currently) and in easy way one may use new features on his own responsibility. Of course I don't know if it is possible to implement that kind of feature but it would show that T5 is really going to develop in a way that won't harm any already existing applications. (or maybe that bug is simple to resolve and all that I wrote is not relevant :) ) Howard Lewis Ship wrote: > > You can see these kinds of exceptions for a service implementation > that accesses protected or package private members of another class. > Because the service implementation class is loaded in a new > ClassLoader (to support live class reloading), it is considered to be > in a different Java package from the other classes (even though this > new package has the exact same name). When the specially loaded code > accesses those private members, this is recognized by the JVM which > throws the exception you are seeing. > > You should either make those other members (including constructors) > public OR mark the service in question as not live-reloadable. This > can be accomplished as: > > public static void bind(ServiceBinder binder) > { > binder.bind(MyInterface.class, > MyImplementation.class).preventReloading(); > } > -- View this message in context: http://tapestry-users.832.n2.nabble.com/Tapestry-5-2-0-Alpha-Release-Now-Available-tp5389967p5426894.html Sent from the Tapestry Users 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: Validation in component using onValidate method
Issue created: https://issues.apache.org/jira/browse/TAP5-1212 -- View this message in context: http://tapestry-users.832.n2.nabble.com/Validation-in-component-using-onValidate-method-tp5315887p5317888.html Sent from the Tapestry Users 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: Validation in component using onValidate method
Thiago H. de Paula Figueiredo wrote: > >> But one suggestion. Maybe tapestry should log on warn level if someone >> creates onValidate method with no parameters, else someone may be as >> confused as I was. I don't see any purpose of onValidate without >> parameters. > > That's a very good idea. Maybe Tapestry should go further and throw an > exception, as a no-arg onValidate method is useless. Please file a JIRA in > the Tapestry bug tracker for that. > I can't agree on that. This could break some apps that were using my kind of workaround (adding additional hidden fields) to make onValidate() work properly. I will create ticket, but later. Now time to go home and test new design :P -- View this message in context: http://tapestry-users.832.n2.nabble.com/Validation-in-component-using-onValidate-method-tp5315887p5316675.html Sent from the Tapestry Users 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: Validation in component using onValidate method
Thiago H. de Paula Figueiredo wrote: > > Hi! > This way, the developer can prevent the setter method of being invoked > with an invalid value. > Ok, I get it now. First I wanted to ask how are You supposed to get that value, but example I wanted to use (from bottom of this page http://tapestry.apache.org/tapestry5.1/guide/validation.html) showed me that I'm just blind or dumb. My code was almost same as example I provided, with onValidate metod without any value. That's why I didn't saw any value. That solves the problem, thanks. But one suggestion. Maybe tapestry should log on warn level if someone creates onValidate method with no parameters, else someone may be as confused as I was. I don't see any purpose of onValidate without parameters. Thanks again, that helped a lot :) Regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/Validation-in-component-using-onValidate-method-tp5315887p5316511.html Sent from the Tapestry Users 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
Validation in component using onValidate method
Hi all, I'm using tapestry for some time but for first time I cannot find correct solution by myself. My problem is with validation in onValidate method. I get that onValidate is called for every component inside form and onValidateForm is called after all other onValidates but I don't get why first Tapestery generates validate event and only after that it calls setter method for validated property. As I always could call onValidateForm, then it wasn't such a problem, but currently I need to do validation from inside of component. Structure is following: Page contains form and component which is just a part of that form. Component contains just a textarea, so validateForm method is not called. IMHO onValidateFromMyField method should do the job but inside I always get null. About year ago I was putting hidden field inside the form, but it's wasn't the solution and it definitely wasn't reliable. I always could find some simple workaround, but now the only solution that I see, is to make whole validation inside page validateForm method, what would result in violation of DRY principle (b/c I would have to do same trick in every page that uses my component). Project in which I have this problem is relatively small, so I could implement this workaround, but everything in me opose to do that (because of the smell it would left, and feeling that some day it won't be a small project). As my english is not the best I prepared small example which should be more expressive than my explanation. 1. Page class @Property @Persist private String foo; @Property @Persist private String bar; @Inject private Logger log; @Inject private ComponentResources resources; @Log public void onValidateForm() throws ValidationException { log.debug(""); log.debug("foo '{}', bar '{}'", foo, bar); } @Log void onSuccess() { resources.discardPersistentFieldChanges(); } 2. tml file for that page 3. component code @Inject private Logger log; @Persist private String password; @Log void onValidateFromPasswordComponent() throws ValidationException { log.debug("Password '{}'", password); // do validation, if goes wrong throw new // ValidationException(recordedError); } @Log void onValidate() throws ValidationException { log.debug("Password '{}'", password); // do validation, if goes wrong throw new // ValidationException(recordedError); } @Log public void setPassword(String password) { this.password = password; } @Log public String getPassword() { return password; } http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"; xmlns:p="tapestry:parameter"> 4. Log from submit. Values inputed into fields were a, b, c: [DEBUG] components.Comp [ENTER] onValidate() [DEBUG] components.Comp Password 'null' [DEBUG] components.Comp [ EXIT] onValidate [DEBUG] components.Comp [ENTER] onValidateFromPasswordComponent() [DEBUG] components.Comp Password 'null' [DEBUG] components.Comp [ EXIT] onValidateFromPasswordComponent [DEBUG] components.Comp [ENTER] setPassword("c") [DEBUG] components.Comp [ EXIT] setPassword [DEBUG] pages.About [ENTER] onValidateForm() [DEBUG] pages.About [DEBUG] pages.About foo 'a', bar 'b' [DEBUG] pages.About [ EXIT] onValidateForm [DEBUG] pages.About [ENTER] onSuccess() [DEBUG] pages.About [ EXIT] onSuccess IMHO it is bug or really counterintuitive feature. How I am supposed to do validation when value is always null? Please help, I really want to do this properly. Regards Michał Gruca -- View this message in context: http://tapestry-users.832.n2.nabble.com/Validation-in-component-using-onValidate-method-tp5315887p5315887.html Sent from the Tapestry Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tap