Re: How to tackle Ajax "Flooding"
Tom Wollert wrote: Hello there, I have a problem with my Wicket Application, which is quite Ajax heavy. Certain ajax calls take some time as they start an import, however the button can still be clicked and sends another ajax call (which is delayed for quite some time). Is it possible to disable the button while the request cycle is not complete? (I mean with wicket, or do I need to use Javascript?). Also ajax calls are postponed as long as the channel is busy, is it possible to deactivate this behaviour? And are there reasons why I should not? Normally I guess we do not want to do that (disabling all the other buttons ,etc). Often the reason we use ajax is to make the user requests handled asynchronysly. But for something that really critical like handling credit card payment, I think its still a good idea to disable any other actions on the same page. I did not have this problem(flooding) myself, but I think you may consider using a "event bus" to tackle it. So all the ajax events are queued into the bus then handled by your server layer when it can. Plus you will have the benefits to have a centralized place to prioritize the events, doing some sort of load balancing. Jason Wang - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: A bug in picking up resource strings for PatternValidator in 1.4-rc7
Ohhh, god! I took one day off and then 1.4.0 came out!!! Thanks for telling me and good job wicket team! Igor Vaynberg wrote: 1.4.0 is out, why dont you try with that... -igor On Thu, Jul 30, 2009 at 6:58 PM, Jason Wang wrote: Hi, all, I recently rebuild a small site with 1.4-rc7 and found that the resource strings for PatternValidator cannot be recognized by wicket and the default one is always used. Change back to 1.4-rc1 problem solved.(havnt tried rc2,rc6) I have created a jira ticket at https://issues.apache.org/jira/browse/WICKET-2405 Just send this email here so other people can be aware of it. Code: final RequiredTextField mobile = new RequiredTextField("mobile"); mobile.setLabel(new Model("mobile")).add(new PatternValidator("^[1-9]([0-9]{8,14})")); Properties file: mobile.PatternValidator = Please input a valid international phone number. Results: always output " does not match pattern '^[1-9]([0-9]{8,14})'. " WIth the same code, build with 1.4 rc1, worked fine, build with rc7, problem occurred Thanks Jason Wang - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
A bug in picking up resource strings for PatternValidator in 1.4-rc7
Hi, all, I recently rebuild a small site with 1.4-rc7 and found that the resource strings for PatternValidator cannot be recognized by wicket and the default one is always used. Change back to 1.4-rc1 problem solved.(havnt tried rc2,rc6) I have created a jira ticket at https://issues.apache.org/jira/browse/WICKET-2405 Just send this email here so other people can be aware of it. Code: final RequiredTextField mobile = new RequiredTextField("mobile"); mobile.setLabel(new Model("mobile")).add(new PatternValidator("^[1-9]([0-9]{8,14})")); Properties file: mobile.PatternValidator = Please input a valid international phone number. Results: always output " does not match pattern '^[1-9]([0-9]{8,14})'. " WIth the same code, build with 1.4 rc1, worked fine, build with rc7, problem occurred Thanks Jason Wang - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: will there be a performance gain to use singleton to remove references to the service object in models?
Hi Martijin, Thats a very good point. I definitely overlooked that risk before. Thank you for pointing it out! Thanks, Jason Wang Martijn Dashorst wrote: There's the risk of keeping the retrieved service as a reference somewhere, e.g. by declaring it final and using it inside an anon inner class, negating any and all gains you've done by using the static lookup. The @SpringBean annotated references are safe to pass around (as they are implemented as proxies to your services) Martijn On Tue, Jul 28, 2009 at 9:50 AM, Eelco Hillenius wrote: Actually, thinking about it, if you're very tight on memory, it will save you a reference, particularly when the page gets serialized. So if you are worrying about efficiency *and* are ok with this code style, it's an option. :-) Eelco On Tue, Jul 28, 2009 at 12:47 AM, Eelco Hillenius wrote: It might give you a very slight edge to use a singleton as you (or the annotation processor in this case) don't have to introspect and work through a proxy. If you're not bothered by singletons (I, for one typically are): go for it. However, keep that famous 'premature optimization is the root of all evil' in mind; 99.9% chance you're optimizing something that will never ever become a bottleneck. Eelco 2009/7/27 Murat YĆ¼cel : Hi Jason I dont have a performance comparison, but i cannot see why you should gain better performance. All spring beans are as default singleton, so you will just forward a singleton using a singleton. /Murat 2009/7/28 Jason Wang : Hi all, Although I am using spring-wicket to prevent the whole spring being serialized, It still brothers me to see the references in the model object, for example: Instead of using this: public class MyViewObjectProvider extends SortableDataProvider{ @SpringBean("daoService") private DAOServices daoService; private String objectID; public Iterator iterator(final int first, final int count){ . return daoService.load(objectId).subList(first, first+count).iterator(); } } I always write a singleton helper class for the service to be used, so I can have the model this way: public class MyViewObjectProvider extends SortableDataProvider{ //so no reference to the dao service object private String objectID; public Iterator iterator(final int first, final int count){ . //here the DAOServiceHelper.get() returns a instance that managed by spring(with the actual service object injected.) return DAOServiceHelper.get().load(objectId).subList(first, first+count).iterator(); } } So my question is, will there be a noticeable performance gain to do it the 2nd way? The reason to ask is that the static kind of singleton usage is indeed anti-spring, and makes my eyes bleed If no one has done a performance comparison, I might have to do one myself. Just being lazy... Thanks, Jason Wang - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
will there be a performance gain to use singleton to remove references to the service object in models?
Hi all, Although I am using spring-wicket to prevent the whole spring being serialized, It still brothers me to see the references in the model object, for example: Instead of using this: public class MyViewObjectProvider extends SortableDataProvider{ @SpringBean("daoService") private DAOServices daoService; private String objectID; public Iterator iterator(final int first, final int count){ . return daoService.load(objectId).subList(first, first+count).iterator(); } } I always write a singleton helper class for the service to be used, so I can have the model this way: public class MyViewObjectProvider extends SortableDataProvider{ //so no reference to the dao service object private String objectID; public Iterator iterator(final int first, final int count){ . //here the DAOServiceHelper.get() returns a instance that managed by spring(with the actual service object injected.) return DAOServiceHelper.get().load(objectId).subList(first, first+count).iterator(); } } So my question is, will there be a noticeable performance gain to do it the 2nd way? The reason to ask is that the static kind of singleton usage is indeed anti-spring, and makes my eyes bleed If no one has done a performance comparison, I might have to do one myself. Just being lazy... Thanks, Jason Wang - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: jWicket -- jQuery with Wicket integration
Jeremy Thomerson wrote: You could write your own tag resolver - seems like it would be fairly easy. Obviously if the component you want is in a repeater or such, your tag will also have to be in the same "context" so to speak (same repeater, etc). -- Jeremy Thomerson http://www.wickettraining.com On Wed, Jul 22, 2009 at 8:00 PM, Jason Wang wrote: I am thinking, if its possible to have a tag something looks like which can output the Id wicket generates at runtime , people like me then do not need to include any javascript into wicket. They can just leave in the pages where they should belong to anyway. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org Thats a great idea. I love open source! Thanks! Jas
Re: Spring and Wicket - is it worth it?
Dane Laverty wrote: Due to the fact that nearly every substantial sample Wicket app is Spring-based, I imagine that there's something awesome about using Spring. In fact, Wicket is what has finally gotten me to start learning Spring. I think I understand the basics of dependency injection -- configure your objects in xml files and then inject them into your classes -- but I'm still not clear on the advantage of it. I've read quite a ways into "Spring in Action", and the author seems to assume that the reader will automatically see why xml-based dependency injection is great thing. I must just be missing something here. What I love about Wicket is being free from xml files. Can anyone give me a concise explanation of how the advantages of Spring are worth introducing a new layer into my applications? Dane You dont have to use spring with wicket. Spring is a business layer framework essentially. It gives you so much convenience to decouple services from its clients. I tried to use it to manage all the web components, then I realized that doesnt give me much at all. Sometimes, a simple "new Page("id")" is just a better solution. But I do encourage you to learn spring, especially if you value automated tests. I cannot live with it now. Jas - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: jWicket -- jQuery with Wicket integration
Jeremy Thomerson wrote: I didn't read your whole post - but if you just want to code your jquery stuff in jquery, you don't need any integration - why use WicketJQuery? Just add a header contributor that contributes jquery and then write your own JS. -- Jeremy Thomerson http://www.wickettraining.com On Wed, Jul 22, 2009 at 3:44 PM, Tauren Mills wrote: Hi Richard, I actually tried out WiQuery before deciding it wasn't the right tool for me. I can't remember the exact specifics of the issues I had with it, and I only spent about a day with it. But I remember feeling like I was being forced to use it whenever and wherever I wanted to add ANY jQuery to my project. I can see how WiQuery would be good for a developer who doesn't want to touch JS, and only code in Java. With WiQuery, I can add all the functionality I need via the WiQuery API. I have nothing against the project in this regard, it seems like a great solution for that situation. But in my case, I want a wicket/jquery tool that is lightweight and stays out of my way. I would rather code client-side only stuff just in jQuery and not have anything necessary in my server code. The only time I want wicket components to be aware of my jQuery code is if there needs to be some client-server ajax communication. For instance, drag/drop information, or sorting a list of item, etc. From my perspective, I could care less if wicket knows which accordion panel is open in the browser, because *for my application*, that doesn't matter. And I do realize there are *other applications* that this would matter, for which an optional WiQuery accordion plugin would be userful. And when I want to use another add-on jQuery plugin such as superfish.js, I don't want to have to resort to WiQuery hacks or to create my own WiQuery plugin to support it. I am constantly adding little jQuery code here and there, and to have to make WiQuery plugins for it all or to code it using the WiQuery API would be a pain that I'm not willing to put up with. The following posting I made might give a little more insight into the reason I stopped using WiQuery: http://groups.google.com/group/wiquery/browse_thread/thread/190fc243777ea3ba/492092296e40fe10?lnk=gst&q=tauren#492092296e40fe10 I had already found WicketJQuery at the time I tried out WiQuery. WiQuery seemed further along and was easier to add into my application, so I tried it first. But when it failed for me, I gave WicketJQuery a try. At the moment, WicketJQuery (now jWicket) certainly isn't perfect either, but it is closer to meeting my needs. So I offered my help to Stefan to get it mavenized and moved to WicketStuff. We renamed it to jWicket during this transition. This new location will make it more accessible and easier to use for other developers. Of course, I have nothing against joining forces, but I also needed something to solve a problem, and I needed it now. WiQuery wasn't doing it for me, and jWicket was. I also want a light weight tool, and I felt like WiQuery was overkill for my needs. If there is a way to join forces so that one tool can satisfy everyone without becoming some big bloated thing, then I'm all for it! Bottom line is I just want to be able to easily add jQuery code to the client side whenever and wherever I want without having to deal with server side code -- except for when I need client/server communication of jQuery events. Maybe I'm not normal in this regard, but the WiQuery API just doesn't do it for me. I'd rather code the client side in JS/jQuery and keep it out of my java code. Sorry for being long winded. Again, I have nothing against WiQuery, and was quite impressed by it. But it just didn't seem like the right tool for my needs. I'm certainly open to ideas on how to integrate the projects, but from what I can tell, they really have different visions. Tauren On Wed, Jul 22, 2009 at 11:15 AM, richardwilko wrote: Hi, What are the advantages of jWicket over other Wicket jQuery projects (specifically wiQuery)? It would be nice if we could all work together on a single project. wiQuery has already pooled the development resources of two other such projects. wiQuery has Wicket behaviours for the core jQuery events / actions and jQuery UI components. It also has a nice plugin mechanism for adding other jQuery widgets / behaviours and it is under active development. At jWeekend we have also just designed, developed and are testing a server side state mechanism for wiQuery components. Regards - Richard jWeekend OO, Wicket, Java Technologies - Training and Consultancy http://jWeekend.com Lionel Armanet wrote: Hi, Just to talk, there's another jQuery-Wicket integration project called "WiQuery" (http://code.google.com/p/wiquery/) and supported by jWeekend (http://www.jweekend.com/dev/LWUGReg/). Did you look at this project too ? Lionel tauren wrote: jWicket has now been released as a wicketstuff project. jWicket is an integration of Wicket and
Re: Does FeedbackPanel have to be added to Page?
Igor Vaynberg wrote: mobile.add(new AjaxFormComponentUpdatingBehavior("onblur") { protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) { mobile.validate(); ajaxRequestTarget.addComponent(feedbackPanel); } ===> protected void onError(target) { target.addcomponent(feedbackpanel);} }); -igor On Sun, Apr 26, 2009 at 4:52 PM, Jason Wang wrote: Hi all, I got a weird error when doing a form component validation. When it fails on the validation the feedback panel is not updated with the error message. The log shows this: Component-targetted feedback message was left unrendered. This could be because you are missing a FeedbackPanel on the page. Well, I added the FeedbackPanel on the form belonging to a webpage. And all the error messages sent to the panel can be properly displayed. Just the one triggered with a component.validate failed to display. The example below can reproduce this error I got: Java: public class Example extends WebPage { public Example(){ Form signupForm = new Form("signUpForm"); final FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); feedbackPanel.setEscapeModelStrings(false).setOutputMarkupId(true); signupForm.add(feedbackPanel); final RequiredTextField mobile = new RequiredTextField( "mobile"); mobile.setLabel(new Model("mobile")).add(new PatternValidator("^[1-9]([0-9]{8,14})")); mobile.add(new AjaxFormComponentUpdatingBehavior("onblur") { protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) { mobile.validate(); ajaxRequestTarget.addComponent(feedbackPanel); } }); signupForm.add(mobile); add(signupForm); } } Html: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml"; xmlns:wicket="http://wicket.sourceforge.net/"; xml:lang="en" lang="en"> [feedbackmessages will be put here] Cheers, Jason - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org Thanks. That works fine. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Does FeedbackPanel have to be added to Page?
Hi all, I got a weird error when doing a form component validation. When it fails on the validation the feedback panel is not updated with the error message. The log shows this: Component-targetted feedback message was left unrendered. This could be because you are missing a FeedbackPanel on the page. Well, I added the FeedbackPanel on the form belonging to a webpage. And all the error messages sent to the panel can be properly displayed. Just the one triggered with a component.validate failed to display. The example below can reproduce this error I got: Java: public class Example extends WebPage { public Example(){ Form signupForm = new Form("signUpForm"); final FeedbackPanel feedbackPanel = new FeedbackPanel("feedback"); feedbackPanel.setEscapeModelStrings(false).setOutputMarkupId(true); signupForm.add(feedbackPanel); final RequiredTextField mobile = new RequiredTextField( "mobile"); mobile.setLabel(new Model("mobile")).add(new PatternValidator("^[1-9]([0-9]{8,14})")); mobile.add(new AjaxFormComponentUpdatingBehavior("onblur") { protected void onUpdate(AjaxRequestTarget ajaxRequestTarget) { mobile.validate(); ajaxRequestTarget.addComponent(feedbackPanel); } }); signupForm.add(mobile); add(signupForm); } } Html: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml"; xmlns:wicket="http://wicket.sourceforge.net/"; xml:lang="en" lang="en"> [feedbackmessages will be put here] class="signUpForm-input"/> Cheers, Jason - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Whats the best way to do a form component validation?
Liam Clarke-Hutchinson wrote: I use an AjaxFormComponentSubmittingBehavior onblur for each field - so it triggers the submission processing behaviour (including validation) for the given field - although it updates the model. You could use an applicable Ajax behaviour and then call the component's validate() method if you wanted to avoid the model update. Regards, Liam Clarke On Fri, Apr 24, 2009 at 3:50 PM, Jason Wang wrote: Hi all, I have a form with a couple form components, most of which have validators attached. For example, the mobile number input field has a patternValidator attached: mobile.add(new PatternValidator("^[1-9]([0-9]{8,14})")); I have hooked all the validation actions with "onblur" events using this: AjaxFormValidatingBehavior.addToAllFormComponents(signUpForm, "onblur", Duration.ONE_SECOND); But unfortunately all the validations are triggered as soon as the focus leaves any of the form component. Is there a way to hook the validator(like the patterValidator) with the event(onblur for example) on the form component(the mobile filed) rather than the whole form? It would be nice that the AjaxFormValidatingBehavior class could provide the option to trigger the validations on events on every components. Thanks. Jasonw - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org Thanks for the reply. I think you meant "AjaxFormComponentUpdatingBehavior <http://wicket.apache.org/docs/1.4/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.html>". I will give it a try. Any other options to discuss? Regards, Jasonw - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Whats the best way to do a form component validation?
Hi all, I have a form with a couple form components, most of which have validators attached. For example, the mobile number input field has a patternValidator attached: mobile.add(new PatternValidator("^[1-9]([0-9]{8,14})")); I have hooked all the validation actions with "onblur" events using this: AjaxFormValidatingBehavior.addToAllFormComponents(signUpForm, "onblur", Duration.ONE_SECOND); But unfortunately all the validations are triggered as soon as the focus leaves any of the form component. Is there a way to hook the validator(like the patterValidator) with the event(onblur for example) on the form component(the mobile filed) rather than the whole form? It would be nice that the AjaxFormValidatingBehavior class could provide the option to trigger the validations on events on every components. Thanks. Jasonw - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org