Question about markup inheritance and page layouts
I was a little confused about page layouts and markup inheritance. I was thinking that a I could take a piece of HTML markup and reuse that component when I need to, and use it multiple times within page without ever having to create the content. I was not able to do this. What I have now, it seems I can only use parent child inheritance with one sub-component. Pseudo Code BasePage.java: public abstract class BasePage extends WebPage { public BasePage(final PageParameters parameters) { } } BasePage.html: html wicket:child / /html SomePage.java public class SomePage extends BasePage { public SomePage(final PageParameters parameters) { } } SomePage.html: wicket:extend div div wicket:id=myPanel/div div wicket:id=myPanel1/div /div /wicket:extend BasePanel.java ... BasePanel.html div wicket:child / /div MyPanel1.java extends BasePanel ... MyPane1l.html wicket:extend div /div /wicket:extend Basically: BasePage has child page - Some Page ... Some Page has child panels BasePanel - My Panel and My Panel1 ... I don't get the output I would expect. It looks like the markup inheritance stops at SomePage and doesn't recognize the BasePanel HTML child code. My intended goal is to avoid duplicating HTML content, what is the best way to achieve that. Maybe I should use markup inheritance for the panel instead of the page?
RE: Question about markup inheritance and page layouts
-Original Message- From: Jeremy Thomerson [mailto:jer...@wickettraining.com] Sent: Tuesday, June 15, 2010 11:26 AM To: users@wicket.apache.org Cc: Berlin Brown Subject: Re: Question about markup inheritance and page layouts On Tue, Jun 15, 2010 at 10:07 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: I was a little confused about page layouts and markup inheritance. I was thinking that a I could take a piece of HTML markup and reuse that component when I need to, and use it multiple times within page without ever having to create the content. I was not able to do this. What I have now, it seems I can only use parent child inheritance with one sub-component. Pseudo Code BasePage.java: public abstract class BasePage extends WebPage { public BasePage(final PageParameters parameters) { } } BasePage.html: html wicket:child / /html SomePage.java public class SomePage extends BasePage { public SomePage(final PageParameters parameters) { } } SomePage.html: wicket:extend div div wicket:id=myPanel/div div wicket:id=myPanel1/div /div /wicket:extend BasePanel.java ... BasePanel.html div wicket:child / /div MyPanel1.java extends BasePanel ... MyPane1l.html wicket:extend div /div /wicket:extend Basically: BasePage has child page - Some Page ... Some Page has child panels BasePanel - My Panel and My Panel1 ... I don't get the output I would expect. It looks like the markup inheritance stops at SomePage and doesn't recognize the BasePanel HTML child code. My intended goal is to avoid duplicating HTML content, what is the best way to achieve that. Maybe I should use markup inheritance for the panel instead of the page? Where did you place the wicket:panel tags in your markup? -- Jeremy Thomerson http://www.wickettraining.com They are in the SomePage: SomePage.html: wicket:extend div div wicket:id=myPanel/div div wicket:id=myPanel1/div /div /wicket:extend - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Question about markup inheritance and page layouts
-Original Message- From: Jeremy Thomerson [mailto:jer...@wickettraining.com] Sent: Tuesday, June 15, 2010 11:34 AM To: users@wicket.apache.org Cc: Berlin Brown Subject: Re: Question about markup inheritance and page layouts Where did you place the wicket:panel tags in your markup? -- Jeremy Thomerson http://www.wickettraining.com They are in the SomePage: SomePage.html: wicket:extend div div wicket:id=myPanel/div div wicket:id=myPanel1/div /div /wicket:extend No, the wicket:panel tags that must appear in the panel html files - where are they? Ooops, I got it working now and all the inheritance works as expected: In my base panel, I didn't include the wicket:panel (but I did put it in the implemeting panel html) Base Panel.html: wicket:panel ... /wicket:panel That change above, fixed the problem. -- Jeremy Thomerson http://www.wickettraining.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Newbie question anti-patterns and wicket, constructor component building
I am sorry, am just getting used to Wicket but I notice a lot of use of calling a lot of code in the constructor. Does it really matter? I mention it because this kind of style makes it difficult to test code because code in the constructor may fail and the object won't be created. Should I just create a method and call that method in the constructor?
RE: Newbie question anti-patterns and wicket, constructor component building
-Original Message- From: Jeremy Thomerson [mailto:jer...@wickettraining.com] Sent: Tuesday, June 15, 2010 3:25 PM To: users@wicket.apache.org Subject: Re: Newbie question anti-patterns and wicket, constructor component building On Tue, Jun 15, 2010 at 2:11 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: I am sorry, am just getting used to Wicket but I notice a lot of use of calling a lot of code in the constructor. Does it really matter? I mention it because this kind of style makes it difficult to test code because code in the constructor may fail and the object won't be created. Should I just create a method and call that method in the constructor? The constructor is supposed to construct the object. In Wicket, this also (typically) means constructing the component hierarchy. So, your constructor should be doing things like add(new FooPanel(foo, new SomeModel())); It should NOT be doing things like: ListFoo foos = SomeDao.loadAll(); new FooPanel(foo, foos); That's the kind of code I see newbs putting in their constructor all the time - and it should NOT be there. -- Jeremy Thomerson http://www.wickettraining.com - Well, the second version uses constructer injection. Some frameworks prefer that approach. But, I see your point. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Specific user/session properties and resources
I still want to use wicket message resource tags in my markup. But, I need a system to load and reload resources property data for each page and request. Or maybe load properties per user session. Is this possible using Wicket resource loader classes. Ideally, it looks like I should use a collection of labels, but I have code to use the wicket message tags. Can I have wicket messages reloaded at each page/request? This is what I am doing now, loading a property file on startup/init. But - import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.InvalidPropertiesFormatException; import java.util.Locale; import java.util.Properties; import org.apache.wicket.Component; import org.apache.wicket.resource.loader.IStringResourceLoader; public class MyResourceLoader implements IStringResourceLoader { private Properties properties = new Properties(); public void loadProperties() { final BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(DevelopmentResources.XML_PROPS.getBytes())); try { properties.loadFromXML(bis); } catch (Exception e) { e.printStackTrace(); } finally { try { bis.close(); } catch (IOException e) { } } // End of try finally // } ... ... } Berlin Brown
Dynamic Resources, Properties
I want to be able to use the StringResourceModel, but I want to use a property string that is loaded when the page is loaded. Basically, I want to set a dynamic property object? With this code below, how can I do this. public class SomePanel extends BaseContentPanel { private static final long serialVersionUID = 1L; public SomePanel(String id) { super(id); add(new Label(weatherMessage, new StringResourceModel(weather.message, this, null))); } } Berlin Brown
RE: Dynamic Resources, Properties
No, I was not using a properties file from the filesystem but it is an in memory string (the properties data). The properties data is loaded dynamically when the page is hit. -Original Message- From: Wilhelmsen Tor Iver [mailto:toriv...@arrive.no] Sent: Friday, June 18, 2010 2:29 AM To: users@wicket.apache.org Cc: Berlin Brown Subject: SV: Dynamic Resources, Properties add(new Label(weatherMessage, new StringResourceModel(weather.message, this, null))); If you put a property weather.message into the page's properties file then it will load from there (even if you provide a default in the panel's properties file). Is that what you mean? Properties are only read once no matter where they are resolved from. - Tor Iver - 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
Hierarchy mismatch with forms and hideable sections.
I am getting a hierarchy error message and the error makes sense, but how do you construct a form that also has hideable sections: This is what I had originally, a form and sub components. This works fine: Java: form = new Form(); panel.add(form); form.add(new TextField(t1)) form.add(new TextField(t2)) Html: form input wicket:id=t1 / input wicket:id=t2 / /form The above pseudo code works fine. Now I want to change to the following (html): Html: form input wicket:id=t1 / div wicket:id=hideableSectionDisabledInitially input wicket:id=t2 / /div /form ... What would I change in the java code so that the code is disaled initially, also such that the t2 text field is part of the form hierarchy (or at least I need to submit that with the form)? Berlin Brown
Wicket: On RadioChoice component, invoke form submit, what am I missing
There are some components in wicket that seem to be associated with a form, but I can't get them to actually submit the form. Or at least, I can't get them to submit the form, if I have a hierarchy of FORM - PANEL - COMPONENT/RADIOCHOICE For example, I can create a submitlink or button and those components submit: return new SubmitLink(id, form) { @Override public void onSubmit() { this.setResponsePage(pageClass); } }; That works above. I want to be able to perform a submit on a radio choice, on change. E.g. new OnChangeHandler() { @Override public void onChange(final Object sel) { // On submission, submit back to form setResponsePage(Page.class); } // MY CONTAINER IS NOT A FORM BUT A CHILD OF A FORM (E.g. FORM - PANEL - RADIOCHOICE public RadioChoice addRadioGroup(final WebMarkupContainer container, final Object modelObject, final String groupName, final String propFieldName, final String [] optionsArr, final OnChangeHandler handler) { final RadioChoice radioGroupYesNo = new RadioChoice(groupName, new PropertyModel(modelObject, propFieldName), Arrays.asList(optionsArr)) { @Override public boolean wantOnSelectionChangedNotifications() { return (handler != null); /* When the handler is not null, enable on change */ } @Override public void onSelectionChanged(Object newSel) { if (handler != null) { handler.onChange(newSel); } else { super.onSelectionChanged(newSel); } } }; container.add(radioGroupYesNo); return radioGroupYesNo; } With the code shown above, the page refreshes, but I want to submit the form and do a page refresh. I don't see where I could associate the form with the RadioChoice? Does RadioChoice need to imlement IFormSubmittingComponent? Berlin Brown
How to access above hierarchy in the markup
Pseudo Code: CompoundPropertyModelString labelModel = new CompoundPropertyModelString(labelProps); panel.setDefaultModel(labelModel); /* Load labels at the PANEL level */ panel.add(new Label(label[1])); form = new Form(new CompoundPropertyModel(myObj)) /* Load data at the form level */ panel.add(form); form.add(myObj.fieldName); ... Markup that will generate a error: panel.html: form wicket:id=theform div wicket:id=...someLabelFromPanelLevel / -- I want to access from the labelProps (this does not work) input wicket:id=someFieldFromMyObjFormLevel / -- I want to access from myObj (this works) /form ... With the current code, I can't access from the someLabelFromPanelLevel data or I will get a accessing outside of the hierarchy error message. I wish I could do the following (way to access higher up the hierarchy) Markup: panel.html: form wicket:id=theform div wicket:id=/PAGE:PANEL:someLabelFromPanelLevel / -- I want to access from the labelProps input wicket:id=someFieldFromMyObjFormLevel / -- I want to access from myObj /form - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wantOnSelectionChangedNotifications and form components. and keeping state
I have an object in session and want to keep the state of those values when I refresh a page or my form submits back to the page. Do I have to add on every component? It seems that I do. Also, how do I add want on selection change but NOT have it perform a form submit. public boolean wantOnSelectionChangedNotifications() { return true; }
Issues with form submit, not retaining values from session without ajax
I have a page that has a html components like a select list and radio buttons. And those components will invoke the onchange event to submit the form or move to the next page. It doesn't look like I am moving to the next page. My model values dont' seem to be retained, at least they aren't retained in for the radio buttons, text boxes. For example, I was thinking like Struts or Spring, I would call onchange on a radio button, the page would reload and all of my values would be retained. The values are NOT retained. Here are two radio buttons. I want to select one, do an onchange and have retain the value of radiogroup2. That is not happening: Also, I am losing the values of my textfields. What would I need to to keep the values of the widgets regardless if I submit the page or do an onchange. Source in a paste bin: http://paste.lisp.org/display/112321 = Snippet, two radio buttons. Radio two loses its values. final RadioChoice radioGroupYesNo2 = new RadioChoice(radioGroup2, new PropertyModel(bean, yesNo2), Arrays.asList(YES_NO)) { @Override public boolean wantOnSelectionChangedNotifications() { return true; } @Override public void onSelectionChanged(Object newSel) { this.setResponsePage(TestPage.class); } @Override public boolean isVisible() { return true; } }; // End of add radio group // radioGroupYesNo2.setPrefix(); radioGroupYesNo2.setSuffix(); form.add(radioGroupYesNo2); // Add Link // this.add(new SubmitLink(linkSubmit, form) { @Override public void onSubmit() { // Here what is the difference between the Class and the Object this.setResponsePage(TestPage.class); } }); } public final DropDownChoice createDropDown(final String str) { // Add list select elements. final ChoiceRenderer choiceRenderer = new ChoiceRenderer(name, value); final ListSelect list1 = new ArrayListSelect(); list1.add(new Select(select1, select1)); list1.add(new Select(select2, select2)); final DropDownChoice dropDown = new DropDownChoice(str, list1, choiceRenderer) { private static final long serialVersionUID = 3169945459254179351L; @Override protected boolean wantOnSelectionChangedNotifications() { return false; } @Override protected void onSelectionChanged(Object newSelection) { this.setResponsePage(TestPage.class); } }; dropDown.setRequired(true); return dropDown; } == Full Source: /** * File: TestPage.java */ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.wicket.PageParameters; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.form.ChoiceRenderer; import org.apache.wicket.markup.html.form.DropDownChoice; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.RadioChoice; import org.apache.wicket.markup.html.form.SubmitLink; import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.model.CompoundPropertyModel; import org.apache.wicket.model.PropertyModel; import TestBean.Select; public class TestPage extends WebPage { public static final String [] YES_NO = { Yes, No }; @SuppressWarnings(unchecked) public TestPage(final PageParameters parameters) { super(parameters); TestBean bean = new TestBean(); if (WicketSession.get().getTestBean() == null) { bean = new TestBean(); WicketSession.get().setTestBean(bean); } else { bean = WicketSession.get().getTestBean(); } final FormTestBean form = new FormTestBean(form, new CompoundPropertyModel(bean)); this.add(form); form.add(new TextField(firstName)); form.add(new TextField(lastName)); form.add(createDropDown(selectBox1)); form.add(createDropDown(selectBox2)); final RadioChoice radioGroupYesNo = new RadioChoice(radioGroup1, new PropertyModel(bean, yesNo1), Arrays.asList(YES_NO)) { @Override public boolean wantOnSelectionChangedNotifications() { return true; } @Override public void onSelectionChanged(Object newSel) { this.setResponsePage(TestPage.class); } @Override public boolean isVisible() { return true; } }; // End of add radio group // radioGroupYesNo.setPrefix(); radioGroupYesNo.setSuffix(); form.add(radioGroupYesNo); final RadioChoice radioGroupYesNo2 = new RadioChoice(radioGroup2, new PropertyModel(bean, yesNo2), Arrays.asList(YES_NO)) { @Override public boolean wantOnSelectionChangedNotifications() { return true; } @Override public void onSelectionChanged(Object newSel) { this.setResponsePage(TestPage.class); } @Override public boolean isVisible() { return true; } }; // End of add radio group // radioGroupYesNo2.setPrefix(); radioGroupYesNo2.setSuffix();
wicket hell
There is a css hell, html hell, java web app hell. Is there a wicket hell or issues that are specific to wicket? Because I do believe web application development is wicket is pretty unique. I am still new to wicket but there are two gripes that get me every time. And maybe over time, I will get used to the problem. 1. Hierarchy issues - The hierarchy is very strict and not like the Java hierarchy. If you want to reference a component, it must be added properly in the markup and in the java code. This can be caught at compile time, but it is still takes time getting used to. 2. Unexpected behavior with the markup - Sometimes I expect a particular attribute or piece of code to get output but some tags I add in the markup get replaced by wicket. (E.g. I added class= to a div and the class attribute was removed) Note: I am not saying wicket is hell, or css or html is. But I was just pointing out that even wicket can have some quirks. Am I wrong here? Berlin Brown
RE: Welcome Martin Grigorov as a core team member
Cool, he has been helping me on IRC/Freenode -Original Message- From: Maarten Bosteels [mailto:mbosteels@gmail.com] Sent: Tuesday, July 20, 2010 10:16 AM To: users@wicket.apache.org Subject: Re: Welcome Martin Grigorov as a core team member Congratulations Martin ! On Tue, Jul 20, 2010 at 1:21 PM, Martin Grigorov martin.grigo...@gmail.comwrote: Thanks a lot for the voted trust in me, team! As a big open source believer it is an honour for me to be a part of the team that made such a great framework! Looking forward to make 1.5 production ready ! 2010/7/20 Ian Marshall ianmarshall...@gmail.com Many congratulations Martin! (In my extremely limited experience with web application frameworks, Wicket is just so excellent. Developing with Wicket really is fun, too.) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Welcome-Martin-Grigorov-as- a-core-team-member-tp2294324p2295166.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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
Additional attributes to ajax events
With the onblur ajax calls, is it possible to add my own javascript . final AjaxFormComponentUpdatingBehavior blurText = new AjaxFormComponentUpdatingBehavior(onblur) { @Override protected void onUpdate(AjaxRequestTarget target) { checkPageNextLink(target); } }; In the markup, can I simply add the onblur and it will get appended? onblur=alert('update') How do I add the ajax call and then add my own javascript call?
RE: Additional attributes to ajax events
Is it possible to add the javascript function in the markup and somehow copy that value and append to the ajax onblur. E.g. This is in my markup : onblur=alert('update') Based on what you said, it looks like you are suggesting adding the javascript method in the Java code. -Original Message- From: Pedro Santos [mailto:pedros...@gmail.com] Sent: Wednesday, July 21, 2010 2:15 PM To: users@wicket.apache.org Subject: Re: Additional attributes to ajax events You can override the getAjaxCallDecorator method from AjaxFormComponentUpdatingBehavior and return an IAjaxCallDecorator that append your custom javascript On Wed, Jul 21, 2010 at 10:26 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: With the onblur ajax calls, is it possible to add my own javascript . final AjaxFormComponentUpdatingBehavior blurText = new AjaxFormComponentUpdatingBehavior(onblur) { @Override protected void onUpdate(AjaxRequestTarget target) { checkPageNextLink(target); } }; In the markup, can I simply add the onblur and it will get appended? onblur=alert('update') How do I add the ajax call and then add my own javascript call? -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
General question - business logic with Wicket, where to put it?
What is the best practice for where to put business logic in Wicket. At first, I had put logic in the page constructor, but now I have learned a little bit about the Lifecycle of a page, the serialization of the page. So putting any kind of logic there didn't seem like a good idea. I placed logic in the action buttons onSubmit methods and form onSubmit methods. Placing any logic here in the onSubmits methods are OK, but sometimes it is difficult to find all the dependent objects. I gues I am used to a Struts MVC approach, where you have one Page action and then communicate with all of your dependent objects (say a form bean with all of the data); With Wicket, I see these issues: 1. When will the page constructor get invoked (should any kind of business logic be placed here?) 2. Where and when will the onSubmit/onUpdate action methods get invoked (should any business logic be placed here and are all the dependent objects available) Berlin Brown
Dynamically invoke a page object (Reflection?)
What is the best approach to invoke a page object through the name of the Page class. E.g. String pageStr = com.test.Page; Page page = new Wicket.createPageSomeHow(pageStr); setResponsePage(page) Is there a way to do something like this? Berlin Brown
RE: Dynamically invoke a page object (Reflection?)
So, just use reflection. OK. I thought there might have been some Wicket oriented utility. But I am OK with reflection. -Original Message- From: Wilhelmsen Tor Iver [mailto:toriv...@arrive.no] Sent: Wednesday, September 01, 2010 4:03 AM To: users@wicket.apache.org Cc: Berlin Brown Subject: SV: Dynamically invoke a page object (Reflection?) Page page = new Wicket.createPageSomeHow(pageStr); Try reflection, e.g. Class.forName(pageStr).newInstance() for using a parameterless constructor. - Tor Iver - 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
Possible serialization issue on a server
We have this code working on jetty but not working on Tomcat. I was thinking there might have been a serialization issue where code is serialized on the server and the class data doesn't get updated. Is it possible that class files are serialized on the Server. How would I check where Wicket serializes those files? This code works fine in one environment but not the other. This is the only error I am getting: 2010-09-01 08:04:15,193 ERROR - RequestCycle - Could not find child with id: theField-radiogroup in the wicket:enclosure org.apache.wicket.WicketRuntimeException: Could not find child with id: theField-radiogroup in the wicket:enclosure at org.apache.wicket.markup.html.internal.Enclosure.checkChildComponent(Enc losure.java:210) at org.apache.wicket.markup.html.internal.Enclosure.ensureAllChildrenPresen t(Enclosure.java:249) at org.apache.wicket.markup.html.internal.Enclosure.onComponentTagBody(Encl osure.java:169) at org.apache.wicket.Component.renderComponent(Component.java:2626) at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1512) at org.apache.wicket.Component.render(Component.java:2457) at org.apache.wicket.MarkupContainer.autoAdd(MarkupContainer.java:229) at org.apache.wicket.markup.resolver.EnclosureResolver.resolve(EnclosureRes olver.java:61) at org.apache.wicket.markup.resolver.ComponentResolvers.resolve(ComponentRe solvers.java:81) at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1418) at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer .java:1577) at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.jav a:1501) at org.apache.wicket.markup.html.form.Form.onComponentTagBody(Form.java:192 6) final RadioChoice radioGroupYesNo = new RadioChoice(theField-radiogroup, new PropertyModel(ibaApplication, field), Arrays.asList(Constants.YES_NO)) { private static final long serialVersionUID = 11L; @Override public boolean isVisible() { return someData; } }; // End of add radio group // radioGroupYesNo.setPrefix(); radioGroupYesNo.setSuffix(); form.add(radioGroupYesNo); Berlin Brown
RE: Scripting language
I would like to point out that Scala is far from what one might consider a dynamic scripting language. I haven't tried it, but you may see if Clojure works with Wicket. That has some of the attributes where you can embed clojure into a java application and change code on the fly. Scala would require that you code be recompiled. -Original Message- From: Thomas Singer [mailto:wic...@regnis.de] Sent: Wednesday, September 01, 2010 12:34 PM To: users@wicket.apache.org Subject: Re: Scripting language Just curious: what makes you think that using a scripting language makes you more productive than using Java? Do you mean productivity in the first two days or in the long run? Tom On 01.09.2010 13:10, james yong wrote: Hi all, Can anyone recommends a scripting language that can be used with Wicket for productivity? Regards, James - 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
Using external link and adding onClick
Is there anyway to get ajax behavior or basic onclick functionality with the External Link class. I need an external link that has a stack href but I also want to invoke some functionality. Berlin Brown (POL)
Understanding wicket lifecycle and model past to wicket components
I have two scenarios, a and b. In one case I use the loadable detachable model and the other I don't. Is it possible when the wicket component in scenario b is deserialized, is it possible that the object won't be available? (a) Page Constructor code with Loadable detachable model: MyPage.java: ... final FormAppBean form = new FormAppBean(FORM, new CompoundPropertyModelAppBean(new LoadableDetachableModelAppBean() { @Override protected AppBean load() { final AppBean AppApplication = (AppBean) WicketSession.get().getApp(); return AppApplication; } }; }); --- (b) Page Constructor without Loadable detachable model: MyPage.java ... LINE2: final FormAppBean form = new FormAppBean(FORM, new CompoundPropertyModelAppBean((AppBean) WicketSession.get().getApp()) --- offending call --- SomeOtherPage.java: public SomeOtherPage() { new Link() { onClick() { setResponsePage(MyPage.class); Use wicket deserialization to get MyPage.class, constructor not called. } } } LINE2: (AppBean) WicketSession.get().getApp() QUESTION: in scenario (B), is it possible that the call to create the Form will be null? if I don't use the loadable detachable model? Because the constructor was not called to render that page again. Berlin Brown
RE: Understanding the model, initial/default value
And my pseudo code was wrong, I meant to add the model to a component. final IModelBoolean modelForAgree = new ModelBoolean(yes.equalsIgnoreCase(obj.getAgree(; final AjaxCheckBox yesChoiceBox = new AjaxCheckBox( Agree, modelForAgree) { } form.add(yesChoiceBox) I have another question, in the case of the checkbox, it expects a model with a boolean value. I would need to add a property field that holds a boolean? Is this correct. Let's say the property has a string? -Original Message- From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On Behalf Of James Carman Sent: Monday, October 04, 2010 9:13 AM To: users@wicket.apache.org Subject: Re: Understanding the model, initial/default value You're not binding your model to the agree property, really. So, if the value changes, it won't update your model. If you want to bind it, use a PropertyModel. On Mon, Oct 4, 2010 at 9:06 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Panel.java: ... final IModelBoolean modelForAgree = new ModelBoolean(yes.equalsIgnoreCase(obj.getAgree(; form.add(modelForAgree); ... In this code, how can I ensure that modelForAgree has the right default value when the panel loads. Is it possible that the Panel gets deserialized with an older version of modelForAgree? Berlin Brown - 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
Understanding the model, initial/default value
Panel.java: ... final IModelBoolean modelForAgree = new ModelBoolean(yes.equalsIgnoreCase(obj.getAgree(; form.add(modelForAgree); ... In this code, how can I ensure that modelForAgree has the right default value when the panel loads. Is it possible that the Panel gets deserialized with an older version of modelForAgree? Berlin Brown
Initialization/Business Logic code before page loads
I might have asked a similar question in a previous post but I wanted to clarify a bit. Where is the best place to put code to initialize the model before a page renders. I know of five options, but where do you normally put this type of initialization. Before a page renders, I want to set the data in my bean/model with certain attributes that may only be specific to that page. I think there are five options. 1. Add initialization logic in the constructor. This may work, but I don't know if the constructor is called for every page call (E.g. when the page is deserialized) 2. Add init logic in onBeforeRender. This works and it called for every request? But is it the best place? 3. Add init logic in a load or getmodel method in LoadableDetachableModel class? 4. Add init in previous page on onSubmit method or onEvent. (onSubmit() { initBeanInSession(); setResponsePage(); } 5. Pass a model to a panel or page constructor (using pageparameters?) Are any of these best practices or preferred over the other. (a) Page Constructor code with Loadable detachable model: MyPage.java: ... final FormMyBean form = new FormMyBean(FORM, new CompoundPropertyModelMyBean(new LoadableDetachableModelMyBean() { private static final long serialVersionUID = 1L; @Override protected MyBean load() { final MyBean app = (MyBean) Session.get().getApp(); ? ? initialize here??? ? return app; } }; }); ??? onBeforeRender() { ?? Add initiailize here final MyBean app = (MyBean) Session.get().getApp(); app.setData(doSomeBusinessLogicHere) } or initModel? --- Berlin Brown
For objects out of session, work with directly or use loadable detachable model
For objects that I get from session, I was trying to avoid accessing them in the constructor but I wanted to setup my default model so that they are pulled on the load method from a loadabledetachable model. Which approach do you use? Here are the three approaches, (The code below is pseudo code, I am typing it out from memory). ** Scenario 1. Add a call to the constructor. public class SomePage extends Page { public SomePage() { ... ... final bigSessObjBean = WicketSession.get().getSomeObjBean(); --- Access object from session in local constructor method scope. final Form x = new Form(form, new ModelObjBean(bigSessObjBean)) { --- Obj bean as default model ... } or even... final Form x = new Form(form) { ... onSubmit() { bigSessObjBean.getData(); Here, accessing bigSess Obj Bean } } } } ** Scenario 2. Use loadable detachable Model public class SomePage extends Page { public SomePage() { ... ... l = new LoadableDetachableModel() { public Bean load() { return WicketSession.get().getSessBeanObj(); } }; final Form x = new Form(form, l) { ... onSubmit() { getDefaultModel().getData(); Here, accessing bigSess Obj Bean } } } } ** Scenario 3: Call the session get when you need it. final Form x = new Form(form, l) { ... onSubmit() { WicketSession.get().getSessBeanObj();.getData(); Here, accessing bigSess Obj Bean } } Berlin Brown (POL)
RE: Log last error on error page
Another question, how do I throw the default error page? So with that request, log the exception: public final class MyRequestCycle extends WebRequestCycle { public WebRequestCycle(final WebApplication application, final WebRequest request, final Response response) { super(application, request, response); } /** * {...@inheritdoc} */ @Override protected final Page onRuntimeException(final Page cause, final RuntimeException e) { // And then catch the exception LOG.error(e); return new MyExceptionPage(e); } } -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Tuesday, November 23, 2010 9:05 AM To: users@wicket.apache.org Subject: Re: Log last error on error page The easiest I can think of is to override org.apache.wicket.RequestCycle.onRuntimeException(Page, RuntimeException) and return your own page which will show the error On Tue, Nov 23, 2010 at 2:43 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Is there a way to log the last error when you reach an error page. I am using my own error page but also want to log the last stack trace or exception message that created the error. getApplicationSettings().setInternalErrorPage(ErrorPage.class); Berlin Brown - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Log last error on error page
Is there an instance of the Default Internal Error page or should I return null in te onRuntimeException method? ... return new MyExceptionPage(e); Replace with return new org.apache.wicket.page.InternalErrorPage(e); -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Tuesday, November 23, 2010 9:28 AM To: users@wicket.apache.org Subject: Re: Log last error on error page On Tue, Nov 23, 2010 at 3:18 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Another question, how do I throw the default error page? what does it mean to throw a page ? So with that request, log the exception: public final class MyRequestCycle extends WebRequestCycle { public WebRequestCycle(final WebApplication application, final WebRequest request, final Response response) { super(application, request, response); } /** * {...@inheritdoc} */ @Override protected final Page onRuntimeException(final Page cause, final RuntimeException e) { // And then catch the exception LOG.error(e); return new MyExceptionPage(e); } } -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Tuesday, November 23, 2010 9:05 AM To: users@wicket.apache.org Subject: Re: Log last error on error page The easiest I can think of is to override org.apache.wicket.RequestCycle.onRuntimeException(Page, RuntimeException) and return your own page which will show the error On Tue, Nov 23, 2010 at 2:43 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Is there a way to log the last error when you reach an error page. I am using my own error page but also want to log the last stack trace or exception message that created the error. getApplicationSettings().setInternalErrorPage(ErrorPage.class); Berlin Brown - 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
RE: Best practice for content without encompassing tag
MartinG said it is OK, I like it. Also, I am blbrown on #freenode.wicket. I may ask you about it later. -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Monday, December 13, 2010 11:43 AM To: users@wicket.apache.org Subject: Re: Best practice for content without encompassing tag Both are OK On Mon, Dec 13, 2010 at 5:39 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Should I use wicket:container for a section of html that I want to include on my page without having a particular tag rendered to the user. For example, if I just want to output the text Data without outputting 'div' or 'span', should I use wicket:container. Or could I use something like setRenderBodyOnly? wicket:container Data /wicket:container Output HTML: Data Berlin Brown - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Print all HTML content to file
I have used the WicketTester to print out the rendered HTML content from wicket. I did that through the unit tests. How would I run a similar operation to return the rendered output document outside of WicketTester.I want to print the document from within my J2EE server. Here is the example junit code. private WicketTester tester; // start and render the test page tester.startPanel( TestRenderPanel.class ); tester.getServletResponse().getDocument(); ... I want to call tester.getServletResponse().getDocument(); outside of a junit test, in a server environment. Berlin Brown
Anyone seen this, ajaxsubmit link
ERROR: Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: ReferenceError: custom_inputHints is not defined ERROR: Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: ReferenceError: custom_inputHints is not defined ERROR: Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: ReferenceError: custom_inputHints is not defined I added an ajax submit link to a form. I click on the ajax submit link and I get this error. On the first click, there is an error and no response from the button. On the second click, the buttons responds and no error. Berlin Brown
Dynamically rotating form and static (or not so static) page links.
1. If my submit links (see B) down below are built when the page is built. But I have a panel that is constantly changing. How can I change the links to become associated with a new form. Just do addOrReplace(on the links)? 2. Is there a way to force a submit on a form. E.g. as opposed to having a handler onSubmit. Is there a way to invoke the submit method of a form? ...actually if there is a way to do point-2, then that would solve the problem in point-1. page panel -- Panel changes based on ajax link. Dynamic content form -- Form also changes, need to associated this FORM with the links down below. [A] /form /panel link submit back - added in the page constructor [B] link submit next - added in the page constructor /page Berlin Brown
RE: Submit form from other form onClick
This works, thanks. Another similar question based on your question. Can I use an ajax form submit, maybe using a wicket javascript utility. I guess I could use jquery but does wicket have something available. E.g. as opposed to document.forms[xxx].submit(). Is there some generic ajax submit I could use. ... this.add(new AjaxLinkObject(nextLink) { @Override public void onClick(final AjaxRequestTarget target) { // Find the dynamic form on the page. final Object objAtStopTraversal = HomePage.this.visitChildren(new FindFormVisitor()); if (objAtStopTraversal instanceof Form?) { // Form found, invoke javascript submit final Form? form = (Form?) objAtStopTraversal; target.appendJavascript(String.format(try { document.forms['%s'].submit(); } catch(err) { if (window.console != undefined) { console.log(err); } }, form.getMarkupId())); } } } ); -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Thursday, January 20, 2011 9:01 AM To: users@wicket.apache.org Subject: Re: Submit form from other form onClick you can submit any form with pure javascript: document.getElementById('myform').submit(); this will call the respective myForm.onSubmit() method at the server side at server side you may call directly your methods e.g. new Form() {onSubmit() { myService.do(); }} new AjaxLink() {onClick() { myService.do(); }} no need to call Wicket methods On Thu, Jan 20, 2011 at 2:49 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Is there a way to manually submit a form. E.g. normally we would have action handler methods onSubmit (on a button or a form). E.g. new AjaxLink() { onClick() { someOtherForm.submit(); } } Berlin Brown - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Call onAfterRender and change default model without error
I tried to do the following below but I got an error could not update component hierarchy. WicketMessage: Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Is there an event method (like onAfterRender) that I could use without error? Component: onBeforeRender() { ... this.setDefaultModel(...); } onAfterRender() { this.setSetDefaultModel(...); } Berlin Brown (POL)
RE: Call onAfterRender and change default model without error
If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model? onBeforeRender() { ... this.setDefaultModel(new ReadonlyStaticModel(state1)); } onAfterRender() { this.setDefaultModel(new ReadonlyStaticModel(state2-reset)); } I guess I could use the backing model object as opposed to the model to change the state. ... Changed to: onBeforeRender() { ... getDefaultModel().set(state1)); } onAfterRender() { getDefaultModel().set(state2)); } -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, January 25, 2011 12:40 PM To: users@wicket.apache.org Subject: Re: Call onAfterRender and change default model without error whats the usecase? -igor On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: I tried to do the following below but I got an error could not update component hierarchy. WicketMessage: Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Is there an event method (like onAfterRender) that I could use without error? Component: onBeforeRender() { ... this.setDefaultModel(...); } onAfterRender() { this.setSetDefaultModel(...); } Berlin Brown (POL) - 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
RE: Call onAfterRender and change default model without error
Here is a use-case for my request below: Let's say I am implementing a traffic stop light Wicket component. There are only two states, on and off. The default state is off but I can manually change the state to on. (E.g. some component like a link outside of the traffic light wicket component). WicketTrafficLight extends Panel { WicketTrafficLight() { super(trafficLight); setDefaultModel(new ModelString(EnabledLight)); } onAfterRender() { ... setDefaultModel(new ModelString(DisabledLight)); } } Some Other Panel : addAjaxLink() { onClick() { setDefaultModel(new ModelString(EnabledLight)); } } ... span wicket:id=trafficLight/span -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, January 25, 2011 1:01 PM To: users@wicket.apache.org Subject: Re: Call onAfterRender and change default model without error you didnt answer my question -igor On Tue, Jan 25, 2011 at 9:58 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model? onBeforeRender() { ... this.setDefaultModel(new ReadonlyStaticModel(state1)); } onAfterRender() { this.setDefaultModel(new ReadonlyStaticModel(state2-reset)); } I guess I could use the backing model object as opposed to the model to change the state. ... Changed to: onBeforeRender() { ... getDefaultModel().set(state1)); } onAfterRender() { getDefaultModel().set(state2)); } -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, January 25, 2011 12:40 PM To: users@wicket.apache.org Subject: Re: Call onAfterRender and change default model without error whats the usecase? -igor On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: I tried to do the following below but I got an error could not update component hierarchy. WicketMessage: Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Is there an event method (like onAfterRender) that I could use without error? Component: onBeforeRender() { ... this.setDefaultModel(...); } onAfterRender() { this.setSetDefaultModel(...); } Berlin Brown (POL) - 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
RE: Call onAfterRender and change default model without error
Some Other Panel : addAjaxLink() { onClick() { setDefaultModel(new ModelString(EnabledLight)); target.addComponent(trafficLight); } } -Original Message- From: Brown, Berlin [GCG-PFS] Sent: Tuesday, January 25, 2011 2:19 PM To: 'users@wicket.apache.org' Subject: RE: Call onAfterRender and change default model without error Here is a use-case for my request below: Let's say I am implementing a traffic stop light Wicket component. There are only two states, on and off. The default state is off but I can manually change the state to on. (E.g. some component like a link outside of the traffic light wicket component). WicketTrafficLight extends Panel { WicketTrafficLight() { super(trafficLight); setDefaultModel(new ModelString(EnabledLight)); } onAfterRender() { ... setDefaultModel(new ModelString(DisabledLight)); } } Some Other Panel : addAjaxLink() { onClick() { setDefaultModel(new ModelString(EnabledLight)); } } ... span wicket:id=trafficLight/span -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, January 25, 2011 1:01 PM To: users@wicket.apache.org Subject: Re: Call onAfterRender and change default model without error you didnt answer my question -igor On Tue, Jan 25, 2011 at 9:58 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model? onBeforeRender() { ... this.setDefaultModel(new ReadonlyStaticModel(state1)); } onAfterRender() { this.setDefaultModel(new ReadonlyStaticModel(state2-reset)); } I guess I could use the backing model object as opposed to the model to change the state. ... Changed to: onBeforeRender() { ... getDefaultModel().set(state1)); } onAfterRender() { getDefaultModel().set(state2)); } -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, January 25, 2011 12:40 PM To: users@wicket.apache.org Subject: Re: Call onAfterRender and change default model without error whats the usecase? -igor On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: I tried to do the following below but I got an error could not update component hierarchy. WicketMessage: Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Is there an event method (like onAfterRender) that I could use without error? Component: onBeforeRender() { ... this.setDefaultModel(...); } onAfterRender() { this.setSetDefaultModel(...); } Berlin Brown (POL) - 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
RE: Call onAfterRender and change default model without error
this still doesn't explain the need to switch it to disabled in onafterrender... Because in my traffic light scenario, I want to return to the original state/value after the component has been rendered. If it were a traffic light, I guess once it turns red, it has to return to disabled. Is there an other type of event method that I could use to set a value, render the component and then return to the original value? -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, January 25, 2011 2:32 PM To: users@wicket.apache.org Subject: Re: Call onAfterRender and change default model without error this still doesnt explain the need to switch it to disabled in onafterrender... -igor On Tue, Jan 25, 2011 at 11:19 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Here is a use-case for my request below: Let's say I am implementing a traffic stop light Wicket component. There are only two states, on and off. The default state is off but I can manually change the state to on. (E.g. some component like a link outside of the traffic light wicket component). WicketTrafficLight extends Panel { WicketTrafficLight() { super(trafficLight); setDefaultModel(new ModelString(EnabledLight)); } onAfterRender() { ... setDefaultModel(new ModelString(DisabledLight)); } } Some Other Panel : addAjaxLink() { onClick() { setDefaultModel(new ModelString(EnabledLight)); } } ... span wicket:id=trafficLight/span -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, January 25, 2011 1:01 PM To: users@wicket.apache.org Subject: Re: Call onAfterRender and change default model without error you didnt answer my question -igor On Tue, Jan 25, 2011 at 9:58 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: If we can update the model object and changes its value without problem. Shouldn't we also be able to assign a new model? onBeforeRender() { ... this.setDefaultModel(new ReadonlyStaticModel(state1)); } onAfterRender() { this.setDefaultModel(new ReadonlyStaticModel(state2-reset)); } I guess I could use the backing model object as opposed to the model to change the state. ... Changed to: onBeforeRender() { ... getDefaultModel().set(state1)); } onAfterRender() { getDefaultModel().set(state2)); } -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Tuesday, January 25, 2011 12:40 PM To: users@wicket.apache.org Subject: Re: Call onAfterRender and change default model without error whats the usecase? -igor On Tue, Jan 25, 2011 at 9:37 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: I tried to do the following below but I got an error could not update component hierarchy. WicketMessage: Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Is there an event method (like onAfterRender) that I could use without error? Component: onBeforeRender() { ... this.setDefaultModel(...); } onAfterRender() { this.setSetDefaultModel(...); } Berlin Brown (POL) - 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 - 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
Compound Property Model, sharing for children
How does the compound property model work in these instances: If I do (pseudo code): Form form = new Form ( new CompoundPropertyModel(someObject)) form.add (new MyTextField(someFieldFromObject); ... public class MyTextField { public MyTextField() { super(id); getModel() - will this return an object? getModelObject() -- will this return an object? } } Basically, when is the model object and model bound to a component that uses the compound property model. Berlin Brown
RE: Compound Property Model, sharing for children
Also, I am assuming a call to compoundPropertyModel.bind(expression) is called, does this return a property model? Or is more involved? New TextField().setDefaultModel(compoundPropertyModel.bind(obj.fieldName)) ; -- return a propertymodel. If I change the instance of modelobject obj in the case above, how does the compound property model use the new instance. E.g: public class SomeObject { public class Inner { fieldName } private SomeObject.Inner obj; getObj() { } setObj() { } } SomeObject someObjectMain = new SomeObject() Form form = new Form ( new CompoundPropertyModel(new SomeObject())); form.add (new MyTextField(obj.fieldName); someObjectMain.setObj(new SomeObject.Inner()); --- In this case, will the model object for the text field be updated and how?? ... -Original Message- From: Pedro Santos [mailto:pedros...@gmail.com] Sent: Thursday, January 27, 2011 8:07 AM To: users@wicket.apache.org Subject: Re: Compound Property Model, sharing for children No because the MyTextField will not be able to init its model based on the parent CompoundPropertyModel since it don't know him yet. Only after exit the form.add call MyTextField.getModel will work as expected. If MyTextField invokes getModel inside the onInitialize it will work fine, since at this point since an path exists from this component to the page. On Thu, Jan 27, 2011 at 10:59 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: How does the compound property model work in these instances: If I do (pseudo code): Form form = new Form ( new CompoundPropertyModel(someObject)) form.add (new MyTextField(someFieldFromObject); ... public class MyTextField { public MyTextField() { super(id); getModel() - will this return an object? getModelObject() -- will this return an object? } } Basically, when is the model object and model bound to a component that uses the compound property model. Berlin Brown -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Submit form from ajaxlink not a part of the form
So, I was able to submit a form WITHOUT ajax. Now, how can I submit a form with ajax but from a link not associated with that form. I tried the following.But, I couldn't get the proper URLs / Button? Are those needed for the wicketSubmFormById call? Also, do i have an issue using target.appendJavascript(...); ... If you look at the event handler method, public class MyPanel { public static final String JS_SUBMIT_THIS_WORKS_BUT_HOW_TO_SUBMIT_BY_AJAX = try { document.forms['%s'].submit(); } catch(err) { alert('ERR:' + err); if (window.console != undefined) { console.log(err); } }; this.add(new AjaxLinkObject(link) { @Override public void onClick(final AjaxRequestTarget target) { // Find the dynamic form on the page. final Object objAtStopTraversal = getParentContainer().visitChildren(new FindFormVisitor()); if (objAtStopTraversal instanceof Form?) { // Form found, invoke javascript submit final Form? form = (Form?) objAtStopTraversal; target.appendJavascript(getEventHandler(form.getMarkupId(), ???, this)); } } } ); protected CharSequence getEventHandler(final String formMarkupId, final String inputName, final AbstractLink link) { final String formId = formMarkupId; final CharSequence url = AppendingStringBuffer call = new AppendingStringBuffer(var wcall=wicketSubmitFormById(') .append(formId).append(', ').append(url).append(', ); call.append(') .append(inputName) .append(' ); call.append(,function() { }.bind(this),function() { }.bind(this), function() { }.bind(this));;; return false;;); return call; } Berlin Brown
RE: Submit form from ajaxlink not a part of the form
I added a kind of dummy ajax submit link on that form and then try to invoke that link... When I get a reference to the callback URL. Here is the error. Is there a way to debug that object error? I could try changing: 1. ignore if not active to false? 2. changing some of the parameters to the submit call? 3. hiddenSubmitLink ...maybe that is not the correct path to that link... Maybe I need to try panel:form:hiddenSubmitLink...etc? From the Debug Window: INFO: ?xml version=1.0 encoding=UTF-8?ajax-responseevaluate![CDATA[var wcall=wicketSubmitFormById('form5e', '?wicket:interface=:0:panel:form:hiddenSubmitLink::IActivePageBehaviorListener:0:-1wicket:ignoreIfNotActive=true', 'hiddenSubmitLink' ,function() { }.bind(this),function() { }.bind(this), function() {return Wicket.$$(this)Wicket.$$('form5e')}.bind(this));;; return false;]]/evaluate/ajax-response INFO: Response parsed. Now invoking steps... ERROR: Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: [object Error] INFO: Response processed successfully. -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Friday, January 28, 2011 12:52 AM To: users@wicket.apache.org Cc: berlin.br...@gmail.com Subject: Re: Submit form from ajaxlink not a part of the form add(new ajaxsubmitlink(submit, form)); -igor On Thu, Jan 27, 2011 at 7:46 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: So, I was able to submit a form WITHOUT ajax. Now, how can I submit a form with ajax but from a link not associated with that form. I tried the following. But, I couldn't get the proper URLs / Button? Are those needed for the wicketSubmFormById call? Also, do i have an issue using target.appendJavascript(...); ... If you look at the event handler method, public class MyPanel { public static final String JS_SUBMIT_THIS_WORKS_BUT_HOW_TO_SUBMIT_BY_AJAX = try { document.forms['%s'].submit(); } catch(err) { alert('ERR:' + err); if (window.console != undefined) { console.log(err); } }; this.add(new AjaxLinkObject(link) { @Override public void onClick(final AjaxRequestTarget target) { // Find the dynamic form on the page. final Object objAtStopTraversal = getParentContainer().visitChildren(new FindFormVisitor()); if (objAtStopTraversal instanceof Form?) { // Form found, invoke javascript submit final Form? form = (Form?) objAtStopTraversal; target.appendJavascript(getEventHandler(form.getMarkupId(), ???, this)); } } } ); protected CharSequence getEventHandler(final String formMarkupId, final String inputName, final AbstractLink link) { final String formId = formMarkupId; final CharSequence url = AppendingStringBuffer call = new AppendingStringBuffer(var wcall=wicketSubmitFormById(') .append(formId).append(', ').append(url).append(', ); call.append(') .append(inputName) .append(' ); call.append(,function() { }.bind(this),function() { }.bind(this), function() { }.bind(this));;; return false;;); return call; } Berlin Brown - 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
RE: Submit form from ajaxlink not a part of the form
I got it. But I passed function() { return true; } ... To the post and preconditions. -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Friday, January 28, 2011 12:52 AM To: users@wicket.apache.org Cc: berlin.br...@gmail.com Subject: Re: Submit form from ajaxlink not a part of the form add(new ajaxsubmitlink(submit, form)); -igor On Thu, Jan 27, 2011 at 7:46 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: So, I was able to submit a form WITHOUT ajax. Now, how can I submit a form with ajax but from a link not associated with that form. I tried the following. But, I couldn't get the proper URLs / Button? Are those needed for the wicketSubmFormById call? Also, do i have an issue using target.appendJavascript(...); ... If you look at the event handler method, public class MyPanel { public static final String JS_SUBMIT_THIS_WORKS_BUT_HOW_TO_SUBMIT_BY_AJAX = try { document.forms['%s'].submit(); } catch(err) { alert('ERR:' + err); if (window.console != undefined) { console.log(err); } }; this.add(new AjaxLinkObject(link) { @Override public void onClick(final AjaxRequestTarget target) { // Find the dynamic form on the page. final Object objAtStopTraversal = getParentContainer().visitChildren(new FindFormVisitor()); if (objAtStopTraversal instanceof Form?) { // Form found, invoke javascript submit final Form? form = (Form?) objAtStopTraversal; target.appendJavascript(getEventHandler(form.getMarkupId(), ???, this)); } } } ); protected CharSequence getEventHandler(final String formMarkupId, final String inputName, final AbstractLink link) { final String formId = formMarkupId; final CharSequence url = AppendingStringBuffer call = new AppendingStringBuffer(var wcall=wicketSubmitFormById(') .append(formId).append(', ').append(url).append(', ); call.append(') .append(inputName) .append(' ); call.append(,function() { }.bind(this),function() { }.bind(this), function() { }.bind(this));;; return false;;); return call; } Berlin Brown - 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
Cheap chaining of compound property model to propertymodel
In this code, do you think I am using the method CompoundPropertyModel.bind properly? See my example in Code2, below. In my snippet Code1, the values for the propertymodel were lost when I did an ajax onClick. But in Code2, the values are retained... Code1: Panel { Panel() { CompoundPropertyModel compoundPropertyModel = new CompoundPropertyModel(someObject); Form f = new Form(compoundPropertyModel); f.add(new TextField(name)); This works fine, data able to setObject and getObject on ajax and other cases f.add(new TextField(name, new PropertyModel(someObject); --- ON AJAX, VALUES LOST f.add(new AjaxLink() { onClick() { target.add(form); } } } } ... ... Code2: As a fix, I did the following: final PropertyModel pm = new PropertyModel(compoundPropertyModel, number) { @Override public Object getObject() { return ((CompoundPropertyModel) form.getDefaultModel()).bind(number).getObject(); } public void setObject(final Object obj) { ((CompoundPropertyModel) billingForm.getDefaultModel()).bind(number).setObject(obj); } }; f.add(new TextField(name)); This works fine, data able to setObject and getObject on ajax and other cases f.add(new TextField(name, pm)--- ON AJAX, NOW VALUES ARE AVAILABLE, FIXED! Berlin Brown
Static member wicket version... post 1.4.13
Is there a way to print the wicket version number from wicket class files or property files? E.g. Version.buildNum or something similar? Berlin Brown
Issue with error validation and onChange event of a dropdown
In the example below. StepOne: user enters INVALID DATA StepTwo: user hits the SAVE LINK (see below) StepThree: error is displayed in feedback panel StepFour: user enters to select drop down, onchange StepFiveERROR :: the code below should update the model, see Line12 But when the panel is displayed the textboxes don't have the value Hello When I do onchange from the dropdown, the value is set to empty. If there is NO ERROR from the validation then everything is fine. Possible issue? I tried to clear the error messages onUpdate but that didn't help.I also added onError event and the error was only hit during validation. It is strange because onUpdate is called and it looks like the value is getting set in the model (Line12) but that value is not displayed in the textfield. Only Other Solution? Maybe I need to do a force submit in the onChange/onUpdate method? Pseudo Code: Panel { Form form = new Form(new CompoundPropertyModel()); add(form); form.add(new TextField(val); form.add(childList = new DropDownChoice()); childList.add( new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate( final AjaxRequestTarget target ) { /// Tried clearing the messages here, does not work. Line12: form.getObjectModel().setVal(Hello); - VALUE NOT BEING REFRESHED ON ERROR when I redisplay the panel. target.addComponent(panel); target.addComponent(form); } }); form.add(new MyValidator()); -- VALIDATE, HAS ERROR!!!S form.add(new AjaxSubmitLink(form)) { onSubmit() { save(); moveToNextScreen(); } } }
Wicket Philosophy/Best Practice
I tell people that I think you should let your Model and Model backing object control the look and feel/display/content of your components. Even visibility should be delegated to the model or model object and not set by the component. Am I wrong here? I use this approach (only work with the Model/ModelObject) as opposed to monkeying with the wicket internal(seemingly) methods like onComponentTag or adding javascript to control the look feel or tags? E.g. MyComponent { isVisible() { getModelObject().isVisible(); } isEnabled() { getModelObject().isEnabled(); } } Berlin Brown
Ajax onChange but also submit all data on a form
Can you submit all of the data on a form based on an onchange event? Is adding javascript the only way to submit the data? Pseudo Code: Panel { Form form = new Form(new CompoundPropertyModel()); add(form); form.add(new TextField(val); form.add(childList = new DropDownChoice()); childList.add( new AjaxFormComponentUpdatingBehavior(onchange) { protected void onUpdate( final AjaxRequestTarget target ) { /// Tried clearing the messages here, does not work. Line12: form.getObjectModel().setVal(Hello); target.addComponent(panel); target.addComponent(form); } }); form.add(new MyValidator()); form.add(new AjaxSubmitLink(form)) { onSubmit() { save(); moveToNextScreen(); } } } Berlin Brown
onInitialize / onBeforeRender
Version: wicket1.4.13 Is there any reason onInitialize would not be called? And is it always called before onBeforeRender? When I look at my logs, it looks like there are cases where onInitialize wasn't called. But onBeforeRender was always called. Berlin Brown
Strange behavior with onUpdate after errors
Debugging Problem. I am trying to debug an issue where I set modelobject values for a form but the values do not appear in the text fields onUpdate (AFTER ERROR) encountered. Environment: A. Wicket 1.4.13 B. Ajax Tabbed Panel C. Modal Window D. Child Modal Window has a form (compound property model) E. Form has text components F. Form has a drop down box, on change the behavior set model values. F. Form has a abstract validator Recreating the issue: 1. Click on link to bring up modal window 2. Click on drop down box, ajax form behavior on change, sets values in text fields. 3. Click on drop down box, ajax form behavior on change, sets values in text fields (this part works FINE!!) 4. Click the null value/default selection on drop drown box 5. Click ajax save link 6. ERROR generated 7, go back to step 3 and click on the drop down box, now the values do NOT UPDATE IN THE TEXT FIELDS (but they worked in step 3). Basically, my ajax drop down worked fine WITHOUT THE error, but after a validation error, the text field values do not appear in the form. ... Debugging the issue. It is strange that the model seems to have the value I want but in the raw input does not. Here is me overriding behavior in the textfield: MyTextField { ... @Override protected void onComponentTag(final ComponentTag tag) { System.out.println(-:textComponent:modelValue: + getModelValue()); System.out.println(-:textComponent:rawInput: + getRawInput()); System.out.println(-:textComponent:getValue: + getValue()); // Default handling for component tag super.onComponentTag(tag); } } ...Output: SystemOut O :==222y:George SystemOut O -:textComponent:modelValue:George SystemOut O -:textComponent:rawInput: SystemOut O -:textComponent:getValue: Why is the model value NOT null but the raw input is? ... Some more code: ... final FormmyBean form = new FormmyBean(calloutForm, compoundPropertyModelForForm); ... final MyDropDownChoice childList = new MyDropDownChoice(childList, dropDownModelChild, renderer); childListContainer.add(childList); childList.add( new AjaxFormComponentUpdatingBehavior(onchange) { @Override protected void onUpdate( final AjaxRequestTarget target ) { BaseWicketSession.get().getFeedbackMessages().clear(); BaseWicketSession.get().cleanupFeedbackMessages(); SelectionOptionBean myChildSelected = (SelectionOptionBean)getFormComponent().getDefaultModelObject(); final myBean myBeanLoc = form.getModelObject(); THIS CODE BELOW THE VALUES ARE SET !!! myBean selectedChild = getChildDataFromData(); myBeanLoc.setFirstName(selectedChild.getFirstName()); myBeanLoc.setLastName(selectedChild.getLastName()); myBeanLoc.setMiddleName(selectedChild.getMiddleName()); target.addComponent(ccc); System.out.println(:==221x: + myBeanLoc); System.out.println(:==222y: + myBeanLoc.getFirstName() + - + myBeanLoc.getLastName()); System.out.println(!!); } } ); ... final AjaxSubmitLink saveLink = new AjaxSubmitLink(saveLink, form) { @Override public void onSubmit(final AjaxRequestTarget target, final Form? form) { modalWindow.onSave(target, null); target.addComponent(form); } }; ... WITH THE ERROR, the HTML renders WITHOUT THE values. But when I print the model object values, it looks like they are there. OUTPUT FROM THE HTML: input type=text size=28 maxlength=20 class=field value= name=lastName/
RE: Strange behavior with onUpdate after errors
OK, After doing some research, I call modelChanging and modelChanged(); @Override protected void onUpdate( final AjaxRequestTarget target ) { CALL form.modelChanging(); SelectionOptionBean myChildSelected = (SelectionOptionBean)getFormComponent().getDefaultModelObject(); final myBean myBeanLoc = form.getModelObject(); THIS CODE BELOW THE VALUES ARE SET !!! myBean selectedChild = getChildDataFromData(); myBeanLoc.setFirstName(selectedChild.getFirstName()); myBeanLoc.setLastName(selectedChild.getLastName()); myBeanLoc.setMiddleName(selectedChild.getMiddleName()); CALL form.modelChanged(); target.addComponent(ccc);} } ); ... -Original Message- From: Brown, Berlin [GCG-PFS] Debugging Problem. I am trying to debug an issue where I set modelobject values for a form but the values do not appear in the text fields onUpdate (AFTER ERROR) encountered. Environment: A. Wicket 1.4.13 B. Ajax Tabbed Panel C. Modal Window D. Child Modal Window has a form (compound property model) E. Form has text components F. Form has a drop down box, on change the behavior set model values. F. Form has a abstract validator Recreating the issue: 1. Click on link to bring up modal window 2. Click on drop down box, ajax form behavior on change, sets values in text fields. 3. Click on drop down box, ajax form behavior on change, sets values in text fields (this part works FINE!!) 4. Click the null value/default selection on drop drown box 5. Click ajax save link 6. ERROR generated 7, go back to step 3 and click on the drop down box, now the values do NOT UPDATE IN THE TEXT FIELDS (but they worked in step 3). Basically, my ajax drop down worked fine WITHOUT THE error, but after a validation error, the text field values do not appear in the form. ... Debugging the issue. It is strange that the model seems to have the value I want but in the raw input does not. Here is me overriding behavior in the textfield: MyTextField { ... @Override protected void onComponentTag(final ComponentTag tag) { System.out.println(-:textComponent:modelValue: + getModelValue()); System.out.println(-:textComponent:rawInput: + getRawInput()); System.out.println(-:textComponent:getValue: + getValue()); // Default handling for component tag super.onComponentTag(tag); } } ...Output: SystemOut O :==222y:George SystemOut O -:textComponent:modelValue:George SystemOut O -:textComponent:rawInput: SystemOut O -:textComponent:getValue: Why is the model value NOT null but the raw input is? ... Some more code: ... final FormmyBean form = new FormmyBean(calloutForm, compoundPropertyModelForForm); ... final MyDropDownChoice childList = new MyDropDownChoice(childList, dropDownModelChild, renderer); childListContainer.add(childList); childList.add( new AjaxFormComponentUpdatingBehavior(onchange) { @Override protected void onUpdate( final AjaxRequestTarget target ) { BaseWicketSession.get().getFeedbackMessages().clear(); BaseWicketSession.get().cleanupFeedbackMessages(); SelectionOptionBean myChildSelected = (SelectionOptionBean)getFormComponent().getDefaultModelObject(); final myBean myBeanLoc = form.getModelObject(); THIS CODE BELOW THE VALUES ARE SET !!! myBean selectedChild = getChildDataFromData(); myBeanLoc.setFirstName(selectedChild.getFirstName()); myBeanLoc.setLastName(selectedChild.getLastName()); myBeanLoc.setMiddleName(selectedChild.getMiddleName()); target.addComponent(ccc); System.out.println(:==221x: + myBeanLoc); System.out.println(:==222y: + myBeanLoc.getFirstName() + - + myBeanLoc.getLastName()); System.out.println(!!); } } ); ... final AjaxSubmitLink saveLink = new AjaxSubmitLink(saveLink, form) { @Override public void onSubmit(final AjaxRequestTarget target, final Form? form) { modalWindow.onSave(target, null); target.addComponent(form); } }; ... WITH THE ERROR, the HTML renders WITHOUT THE values. But when I print the model object values, it looks like they are there. OUTPUT FROM THE HTML: input type=text size=28 maxlength=20 class=field value= name=lastName/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Ajax like event for onLoad
I am using the Ajax Tabbed Panel class and I could possibly hijack the onUpdate/onClick routines to suit my needs. But I was curious, is there an event/behavior that I can call when a panel loads or render. Something along the lines of: SomeAjaxPanel { onBeforeRender() { this.add(AjaxBehavior(onload') { onEvent(target) { } } } }
Wicket log4j configuration, log wicket errors to file
I think I was able to log wicket log4j messages (pre wicket verson 1.4.10) by specificying a log4j appender for the wicket package. E.g. org.apache.wicket.* But, I wonder with the recent version of wicket, do I have to use org.slf4j.impl ... Basically, is there anything special to redirect wicket logging messages through log4j? [2/18/11 15:45:24:747 EST] 0024 RequestCycle E org.slf4j.impl.JCLLoggerAdapter error org.apache.wicket.WicketRuntimeException: Internal error parsing wicket:interface = SDFSD org.apache.wicket.protocol.http.request.InvalidUrlException: org.apache.wicket.WicketRuntimeException: Internal error parsing wicket:interface = SDFSD at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.decode( WebRequestCodingStrategy.java:235) at org.apache.wicket.Request.getRequestParameters(Request.java:183) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
Typically when is the constructor of a component of a panel, page, etc called?
I was trying to get a feel for the wicket lifecycle, I can where onBeforeRender, onAfterRender are called during the component rendering lifecycle. But, I still don't see when the constructor (object instantiation) of a component. If I debug and/or trace the constructor calls, it looks like the component is instantiated every time is rendered? With ajax components, when is the constructor of a component called? In my case below, when is the MyPanel constructor called. Only once? when the object is added to the ajax tabbed panel. Or when the content is rerendered? AjaxTabbedPanel ajaxTabbedPanel ... public class MyPanel extends Panel { public MyPanel() { ... add components. } } new Page(); ajaxTabbedPanel.addTheMyPanelToAjaxPanel(new MyPanel)); thePage.add(ajaxTabbedPanel) ... onClickOfTab { target.addComponent(myPanel) }
Wicket philosophy, modelObject isVisible, isEnabled, CSS
Most of the backing modelObject and models are normally associated with the data that is to be displayed or edited. Isn't the CSS and visibility one aspect that is part of the display? What are your thoughts on controlling the visibility, enabled state and CSS through the model objects as opposed at the component? Where do you draw the line between how the component should work and how the data should manipulate the component? public class DataWithCSS { public String getValue() { return value; } public String getCSS() { return css } } For example, let's say you have a text box that has two backing objects: Label label = new LabelDataWithCSS(new DataWithCSS(Hello World, style-red)) { onComponentTag() { tag.put(class, this.getCSS()) } } ... I know we can add functionality that will pull the data value and CSS or visbility or other attributes from the model and model objects, I was just curious if the wicket developers intended for some aspects to be more controlled at the component level.
Good way to remove validation globally from a page or panel
If I am using AbstractFormValidator and in some places, I am using setRequired, default validation on components. What is the best way to remove the validation temporarily Let's say I am in a view only mode and fields are disabled, I want to remove validation. And then later on, may add back that validation. I guess I Could remove and add onBeforeRender or initialize or configure and then add the validators back. I was trying to avoid doin that. I would have to remove validation on all the components on those particular pages. Also, I was thinking of just exiting early in the validation methods? Also, let's say I have some fields that are disabled and some that aren't. I am using abstractformvalidator and throwing an error if those fields are empty. They are empty but disabled. Is there a way to treat disabled fields differently in validation modes..
RE: Good way to remove validation globally from a page or panel
I should have clarified. Yea, if you have input fields with a dozen or so fields and you have 50% disabled. But you are using the AbstractFormValidator validate() { get(field1).getInput; get(field2).getInput ... And doing validation checks, I guess this isn't a good approach. I have to keep the fields disabled and can't use true/read only spans. I could visit each field and check if the component is enabled or not, but I was trying to see if there is a one liner, easy solution that I could remove validation in a disabled state...if I use the validation approach I mention above. -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Saturday, March 05, 2011 3:59 AM To: users@wicket.apache.org Subject: Re: Good way to remove validation globally from a page or panel When you are in View mode then either your components are not form components (e.g. input is replaced with label/span/...) or as you said they are disabled. Form submit will not send name/value pair for disabled form elements. I think the first approach is better regarding user experience. See visural's view or edit components for example. On Sat, Mar 5, 2011 at 1:32 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: If I am using AbstractFormValidator and in some places, I am using setRequired, default validation on components. What is the best way to remove the validation temporarily Let's say I am in a view only mode and fields are disabled, I want to remove validation. And then later on, may add back that validation. I guess I Could remove and add onBeforeRender or initialize or configure and then add the validators back. I was trying to avoid doin that. I would have to remove validation on all the components on those particular pages. Also, I was thinking of just exiting early in the validation methods? Also, let's say I have some fields that are disabled and some that aren't. I am using abstractformvalidator and throwing an error if those fields are empty. They are empty but disabled. Is there a way to treat disabled fields differently in validation modes.. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Run a standalone wicket app
That is a more a jetty question. Research the server jetty classes. ... import org.mortbay.jetty.Connector; import org.mortbay.jetty.Server; import org.mortbay.jetty.bio.SocketConnector; import org.mortbay.jetty.webapp.WebAppContext; Server server = new Server(); server.start(); -Original Message- From: Mauro Ciancio [mailto:maurocian...@gmail.com] Sent: Monday, March 07, 2011 12:26 PM To: Wicket Mailing List Subject: Run a standalone wicket app Hello all, I'd like to create a jar with a wicket application inside that can be run from the command line as it were a desktop application. I'm using maven and jetty and it would be great if jetty could start and listen on a port. Any hints or links would be really appreciated. Thanks in advance. Regards. -- Mauro Ciancio http://about.me/maurociancio - 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
RE: CompoundPropertyModel deprecated in 1.5 - what is the replacement?
What is wrong with compoundpropertymodel (pre 1.5)? -Original Message- From: Maarten Billemont [mailto:lhun...@gmail.com] Sent: Wednesday, March 09, 2011 4:30 PM To: users@wicket.apache.org Subject: Re: CompoundPropertyModel deprecated in 1.5 - what is the replacement? On 09 Mar 2011, at 22:01, Chris Colman wrote: Sorry, CompoundPropertyModel is not deprecated in 1.5, it's BoundCompoundPropertyModel that is. Too bad :-) Really, you use normal models and LDMs, or BindGen (http://code.google.com/p/bindgen-wicket/) and make your code type-safe. - 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
Deserialize/cache components in Ajax rendering and other scenarios
It looks like caching and the deserializing of pages only happens when the user revisits a page or goes back to a page? Is there any serialization/deserialization that is done to panels if they are just rerendered through ajax? If your whole site is ajax based (where most of the content is not rendered through pages but panels), I guess we don't get the benefits of the wicket caching? Also, does anyone have more information when the wicket page caching kicks in? I only see it deserialize a page when you visit the javascript back button.
Ajax modal window does not allow submit form under open browsers
When I use the ajax modal window and under Firefox/Chrome/Safari, the ajax form submit does not happen. When I open the ajax debug window, it looks like a request is made. Has anyone had issues with modal windows, form submission and firefox? Internet Explorer 7 works fine. Version of Wicket: 1.4.13 Here is the error in the debug window: RROR: Wicket.Ajax.Call.submitFormById: Trying to submit form with id 'calloutForm449' that is not in document. ERROR: Wicket.Ajax.Call.submitFormById: Trying to submit form with id 'calloutForm449' that is not in Pseduo Code: import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; ... final ModalWindow modalWindow = new ModalWindow( modalWindow); final Panel basicPanel = new BasicPanel( modalWindow.getContentId()); modalWindow.setInitialWidth( 600 ); mainPanel.add(modalWindow); modalWindow.setContent(basicPanel); ... public class BasicPanel extends Panel { public BasicPanel(final String id) { ... final Form form = new Form(calloutForm); add(form); } } ** Panel for Modal Window Markup: form wicket:id=calloutForm ... /form ** Output from ajax debug window. The form looks like it is available. div id=feedback4d7 style=display:none/div form id=calloutForm4d8 method=post action=?wicket:interface=:10:contentPanelContainer:contentPanel:panel:m odalWindow:content:calloutForm::IFormSubmitListener:: div style=width:0px;height:0px;position:absolute;left:-100px;top:-100px;ove rflow:hiddeninput type=hidden name=calloutForm4d8_hf_0 id=calloutForm4d8_hf_0 //div fieldset table cellspacing=0 cellpadding=0 style=width: auto; class=content_panel_table tbody ... /form /div
RE: Ajax modal window does not allow submit form under open browsers
You mean? Markup, main panel: form div wicket:id=thePanelForModalWindow/div /form OK, but why does it work with Internet Explorer 7. Strange. -Original Message- From: Pedro Santos [mailto:pedros...@gmail.com] Sent: Saturday, March 19, 2011 8:02 PM To: users@wicket.apache.org Subject: Re: Ajax modal window does not allow submit form under open browsers To submit a form inside a modal window you must enclose it by a form in the main panel and use an AJAX submit component. Please open a ticket + quickstart if the issue remains. On Sat, Mar 19, 2011 at 7:45 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: When I use the ajax modal window and under Firefox/Chrome/Safari, the ajax form submit does not happen. When I open the ajax debug window, it looks like a request is made. Has anyone had issues with modal windows, form submission and firefox? Internet Explorer 7 works fine. Version of Wicket: 1.4.13 Here is the error in the debug window: RROR: Wicket.Ajax.Call.submitFormById: Trying to submit form with id 'calloutForm449' that is not in document. ERROR: Wicket.Ajax.Call.submitFormById: Trying to submit form with id 'calloutForm449' that is not in Pseduo Code: import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; ... final ModalWindow modalWindow = new ModalWindow( modalWindow); final Panel basicPanel = new BasicPanel( modalWindow.getContentId()); modalWindow.setInitialWidth( 600 ); mainPanel.add(modalWindow); modalWindow.setContent(basicPanel); ... public class BasicPanel extends Panel { public BasicPanel(final String id) { ... final Form form = new Form(calloutForm); add(form); } } ** Panel for Modal Window Markup: form wicket:id=calloutForm ... /form ** Output from ajax debug window. The form looks like it is available. div id=feedback4d7 style=display:none/div form id=calloutForm4d8 method=post action=?wicket:interface=:10:contentPanelContainer:contentPanel:panel :m odalWindow:content:calloutForm::IFormSubmitListener:: div style=width:0px;height:0px;position:absolute;left:-100px;top:-100px;o ve rflow:hiddeninput type=hidden name=calloutForm4d8_hf_0 id=calloutForm4d8_hf_0 //div fieldset table cellspacing=0 cellpadding=0 style=width: auto; class=content_panel_table tbody ... /form /div -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Ajax modal window does not allow submit form under open browsers
OK, so the patch just scraps the form in the modal window. -Original Message- From: Chris Colman [mailto:chr...@stepaheadsoftware.com] Sent: Sunday, March 20, 2011 8:36 AM To: users@wicket.apache.org Subject: RE: Ajax modal window does not allow submit form under open browsers .. and please vote for WICKET-3404 if you think the need for this additional form is just annoying. +1 from me! I find having to wrap a modal in a form quite annoying. - 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
RE: Apache Wicket Cookbook Published!
Congrats. I trust Igor -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Friday, March 25, 2011 1:44 PM To: users@wicket.apache.org; d...@wicket.apache.org; annou...@wicket.apache.org Subject: Apache Wicket Cookbook Published! For the past nine months I have been quietly working on a book about Wicket. Unlike other books on the market this one does not attempt to teach you Wicket from the ground up. Instead, it is for developers who already know the basics and want to learn how to implement some of the more advanced use cases. Essentially, it contains recipes that show the reader how to implement solutions to some of, what I think are, the most commonly asked questions and stumbling blocks. This morning I was informed that the book has been published! You can read more about it and pick up a copy on PACKT's Site[1]. I hope you enjoy it, more details below... [1] https://www.packtpub.com/apache-wicket-cookbook/book ## Description ## Apache Wicket is one of the most famous Java web application frameworks. Wicket simplifies web development and makes it fun. Are you bored of going through countless pages of theory to find out how to get your web development done? With this book in hand, you don't need to go through hundreds of pages to figure out how you will actually build a web application. You will get practical solutions to your common everyday development tasks to pace up your development activities. Apache Wicket Cookbook provides you with information that gets your problems solved quickly without beating around the bush. This book is perfect for you if you are ready to take the next step from tutorials and step into the practical world. It will take you beyond the basics of using Apache Wicket and show you how to leverage Wicket's advanced features to create simpler and more maintainable solutions to what at first may seem complex problems. You will learn how to integrate with client-side technologies such as JavaScript libraries or Flash components, which will help you to build your application faster. You will discover how to use Wicket paradigms to factor out commonly used code into custom Components, which will reduce the maintenance cost of your application, and how to leverage the existing Wicket Components to make your own code simpler. A straightforward Cookbook with highly focused practical recipes to make your web application development easier with the Wicket web framework ## What you will learn from this book ## * Leverage Wicket to implement a wide variety of both simple and advanced use cases in a narrative that gets straight to the point * Make forms work in the crazy world of the Web by learning the ways of Wicket's form processing * Simplify localizing your Wicket applications * Take the boring out of your forms by discovering how to improve the user experience while simplifying your code at the same time * Leverage the built-in Table component to make displaying tabular data a snap * Think Wicket's Borders are not very useful? Learn to use them in unexpected places to simplify things * See how to integrate with Flash components and create interactive charts at the same time * Web 1.0 too boring? Learn how to tame Wicket's AJAX support and bring your application into Web 2.0 * Simplify your security code by learning various security techniques * An application cannot be built with Wicket alone; see how to make it play nice with other frameworks ## Approach ## This is a hands-on practical guide to a large variety of topics and use cases. This book tries to use real-world examples when possible, but is not afraid to come up with a contrived pretext if it makes explaining the problem simpler. Unlike a lot of other books, this one does not try to maintain a continuous theme from chapter to chapter, such as demonstrating solutions on the same fictional application; doing so would be almost impossible given the wide variety of recipes presented here. Instead, this book concentrates on focused problems users are likely to encounter and shows clear solutions in a step-by-step manner. This book tries to teach by example and is not afraid to show a lot of code because, after all, it is for coders. ## Who this book is written for ## This book is for current users of the Apache Wicket framework; it is not an introduction to Wicket that will bore you with tons of theory. You are expected to have built or maintained a simple Wicket application in the past and to be looking to learn new and better ways of using Wicket. If you are ready to take your Wicket skills to the next level this book is for you. Cheers, and I hope you enjoy the book! -Igor - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail:
Ajax Submit Link and detect if that button clicked
I was having trouble detecting if a particular ajax submit link was the last behavior associated with a form submission. I tried to use the findSubmittingButton (or whatever the name is) and that was always returning null. I used this approach and it works, but doesn't seem intuitintive and I wonder if there is a better way. final String lastURL = form.getWebRequest().getURL(); return (lastURL.indexOf(nextLink) != -1); or whatever the link is in the URL.
HTML comment tag
This is simple code and works, do you think this is a way to add dynamic HTML comments that use some Wicket model? Or have you done something else? I am not as familiar with onComponentTagBody. public class HtmlComment extends Label { /** * @see org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup. MarkupStream, * org.apache.wicket.markup.ComponentTag) */ @Override protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, !-- + getDefaultModelObjectAsString() + --); } } and the output will be in the final HTML output: !-- DATA --
RE: HTML comment tag
They may contain information like a build number, version number of application for debugging purposes that I can see on the rendered HTML output. I was thinking of sub-classing label because the output of a comment is similar to that kind of markup. -Original Message- From: Pedro Santos [mailto:pedros...@gmail.com] Sent: Monday, March 28, 2011 12:19 PM To: users@wicket.apache.org Subject: Re: HTML comment tag An reusable behavior can be archived using the MarkupComponentBorder. On a side note, why do you want to write commented model values in markup? On Mon, Mar 28, 2011 at 11:02 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: This is simple code and works, do you think this is a way to add dynamic HTML comments that use some Wicket model? Or have you done something else? I am not as familiar with onComponentTagBody. public class HtmlComment extends Label { /** * @see org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup. MarkupStream, * org.apache.wicket.markup.ComponentTag) */ @Override protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, !-- + getDefaultModelObjectAsString() + --); } } and the output will be in the final HTML output: !-- DATA -- -- Pedro Henrique Oliveira dos Santos - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: HTML comment tag
Oops, I didn't see this, is this the same thing? java.lang.Object org.apache.wicket.protocol.http.documentvalidation.Comment -Original Message- From: jcar...@carmanconsulting.com [mailto:jcar...@carmanconsulting.com] On Behalf Of James Carman Sent: Monday, March 28, 2011 1:04 PM To: users@wicket.apache.org Subject: Re: HTML comment tag We do this in our application by doing: add(new Label(debugInfo, new DebugInfoModel()).setEscapeModelStrings(false).setRenderBodyOnly(true)); private static class DebugInfoModel extends LoadableDetachableModelString { @Override protected String load() { return MessageFormat.format(!-- \n + Java Version: {1}\n + Wicket Version: {0}\n + Hibernate Version: {2}\n + Spring Version: {3}\n + Oracle Driver: {4}\n + Application Server: {5}\n + Operating System: {6}\n + --, WebApplication.get().getFrameworkSettings().getVersion(), System.getProperty(java.vendor) + + System.getProperty(java.version), versionOf(Hibernate.class), versionOf(ApplicationContext.class), versionOf(OracleDriver.class), WebApplication.get().getServletContext().getServerInfo(), System.getProperty(os.version)); } } On Mon, Mar 28, 2011 at 1:00 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: They may contain information like a build number, version number of application for debugging purposes that I can see on the rendered HTML output. I was thinking of sub-classing label because the output of a comment is similar to that kind of markup. -Original Message- From: Pedro Santos [mailto:pedros...@gmail.com] Sent: Monday, March 28, 2011 12:19 PM To: users@wicket.apache.org Subject: Re: HTML comment tag An reusable behavior can be archived using the MarkupComponentBorder. On a side note, why do you want to write commented model values in markup? On Mon, Mar 28, 2011 at 11:02 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: This is simple code and works, do you think this is a way to add dynamic HTML comments that use some Wicket model? Or have you done something else? I am not as familiar with onComponentTagBody. public class HtmlComment extends Label { /** * @see org.apache.wicket.Component#onComponentTagBody(org.apache.wicket.markup. MarkupStream, * org.apache.wicket.markup.ComponentTag) */ @Override protected void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { replaceComponentTagBody(markupStream, openTag, !-- + getDefaultModelObjectAsString() + --); } } and the output will be in the final HTML output: !-- DATA -- -- Pedro Henrique Oliveira dos Santos - 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
Ajax Response and a Redirect, anyone seen this
https://gist.github.com/918794 Has anyone seen this, where is the code to process an ajax-response. POST /life/launch/?wicket: interface=:23:navigationPanel:nextLink::IActivePageBehaviorListener:1:-1 wicket:ignoreIfNotActive=truerandom=0.006311339758800216 HTTP/1.1 Accept: text/xml Accept-Language: en-us wicket-ajax: true Referer: https://mysite/launch/ wicket-focusedelementid: idc96 Content-Type: application/x-www-form-urlencoded UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30) Host: mysite Content-Length: 457 Connection: Keep-Alive Cache-Control: no-cache idc9e_hf_0=firstName=SP HTTP/1.1 200 OK Date: Wed, 13 Apr 2011 19:24:37 GMT Server: IBM_HTTP_Server Ajax-Location: ?wicket:bookmarkablePage=:theapplife.errors.ErrorPage Content-Length: 121 Keep-Alive: timeout=10, max=97 Connection: Keep-Alive Content-Type: text/xml Content-Language: en-US
RE: Ajax Response and a Redirect, anyone seen this
Where is the code to process the ajax-response, the java code? -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Thursday, April 14, 2011 9:56 AM To: users@wicket.apache.org Subject: Re: Ajax Response and a Redirect, anyone seen this the code is in wicket-ajax.js you Ajax callback lead to an error and thus the redirect to your internal error page On Thu, Apr 14, 2011 at 3:46 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: https://gist.github.com/918794 Has anyone seen this, where is the code to process an ajax-response. POST /life/launch/?wicket: interface=:23:navigationPanel:nextLink::IActivePageBehaviorListener:1: -1 wicket:ignoreIfNotActive=truerandom=0.006311339758800216 HTTP/1.1 Accept: text/xml Accept-Language: en-us wicket-ajax: true Referer: https://mysite/launch/ wicket-focusedelementid: idc96 Content-Type: application/x-www-form-urlencoded UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30) Host: mysite Content-Length: 457 Connection: Keep-Alive Cache-Control: no-cache idc9e_hf_0=firstName=SP HTTP/1.1 200 OK Date: Wed, 13 Apr 2011 19:24:37 GMT Server: IBM_HTTP_Server Ajax-Location: ?wicket:bookmarkablePage=:theapplife.errors.ErrorPage Content-Length: 121 Keep-Alive: timeout=10, max=97 Connection: Keep-Alive Content-Type: text/xml Content-Language: en-US -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Deserialization of pages with Wicket, back button
When does wicket use the deserialization of pages from the filesystem disk store/cache? With the default, out of the box Wicket code, when does Wicket deserialize a page? Pseudo-code: getHomePage() { return Page.class } ... Let's say I am using ajax or ajax tabbed panels and I am not really instantiate new pages to re-render screens (E.g. with AjaxTabPanel, only that panel gets rerendered), do panels get deserialized outside page deserialization? Or is it only a full page? As far as I can tell, it looks like it only happens when you use the web browser 'back' button? But shouldn't it happen when I refresh a page?
RE: Deserialization of pages with Wicket, back button
Clicking back button will lead you to the previous page, not to the previous state of the page. Refreshing the page reloads the current version of the page which is in the http session and thus doesn't hit the file system. I think you answered the question, just wanted to confirm. When does the deserialization from the filesystem happen? -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Wednesday, April 20, 2011 10:41 AM To: users@wicket.apache.org Subject: Re: Deserialization of pages with Wicket, back button Wicket do *not* serialize new version of the page for Ajax requests. Clicking back button will lead you to the previous page, not to the previous state of the page. Refreshing the page reloads the current version of the page which is in the http session and thus doesn't hit the file system. On Wed, Apr 20, 2011 at 5:33 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: When does wicket use the deserialization of pages from the filesystem disk store/cache? With the default, out of the box Wicket code, when does Wicket deserialize a page? Pseudo-code: getHomePage() { return Page.class } ... Let's say I am using ajax or ajax tabbed panels and I am not really instantiate new pages to re-render screens (E.g. with AjaxTabPanel, only that panel gets rerendered), do panels get deserialized outside page deserialization? Or is it only a full page? As far as I can tell, it looks like it only happens when you use the web browser 'back' button? But shouldn't it happen when I refresh a page? -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com http://jweekend.com/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Strange error, cannot modify hierarchy
I am shooting in the dark but I thought I would post the error I am getting. I get this error. Cannot modify component hierarchy after render phase has started. The full stack trace is at the bottom of this post. During the form submission process (user clicks on link) then I get the error above but ONLY when I have a dynamic component with isTransparentResolver = true. If I restructure my hierarchy such that transparentResolver is false then I don't get the same error. Why do you think I get the error? ... final WebMarkupContainer container = new WebMarkupContainer( container ) { public boolean isTransparentResolver() { return false; // true causes error } @Override public boolean isVisible() { return logic(); } }; Cannot modify component hierarchy after render phase has started (page version cant change then anymore) org.apache.wicket.WicketRuntimeException: Cannot modify component hierarchy after render phase has started (page version cant change then anymore) at org.apache.wicket.Component.checkHierarchyChange(Component.java:3598) at org.apache.wicket.Component.modelChanging(Component.java:2260) at org.apache.wicket.Component.setDefaultModelObject(Component.java:3124) at org.apache.wicket.markup.html.form.FormComponent.updateModel(FormCompone nt.java:1168) at org.apache.wicket.markup.html.form.Form$FormModelUpdateVisitor.component (Form.java:229) at org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrde rHelper(FormComponent.java:514) at org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrde rHelper(FormComponent.java:493) at org.apache.wicket.markup.html.form.FormComponent.visitComponentsPostOrde r(FormComponent.java:465) at org.apache.wicket.markup.html.form.Form.internalUpdateFormComponentModel s(Form.java:2110) at org.apache.wicket.markup.html.form.Form.updateFormComponentModels(Form.j ava:2078) at org.apache.wicket.markup.html.form.Form.process(Form.java:1028) at org.apache.wicket.markup.html.form.Form.process(Form.java:955) at org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:920) at org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java: 177) at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDef aultAjaxBehavior.java:300) at org.apache.wicket.request.target.component.listener.BehaviorRequestTarge t.processEvents(BehaviorRequestTarget.java:142) at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab stractRequestCycleProcessor.java:92) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java :1250) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484 ) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java: 160)
Google Chrome and Apache Wicket, an awesome combination
FYI... I usually ask questions but I thought I post a comment about google chrome. The chrome browser has default web debugging that is similar to firebug. With Firebug, it is more difficult to detect the wicket ajax rendered content but comes up automatically in chrome. Also speed wise, chrome renders much faster than IE or Firefox. I tested Ajax oriented complex content and chrome just works quickly.
Differences development vs deployment mode, hierarchy errors
I noticed with the web.xml configuration, development mode that I see more hierarchy exceptions thrown by wicket. Basically, it seems that wicket ignores some hierarchy or markup issues in development mode and not in deployment mode. What are the main differences between those modes and how do I know what exceptions will be thrown?
Slow ajax request and possible timeout variable?
Sometimes on slower connections I see issues with the application with ajax requests. If the request takes longer than 20 or 30 seconds my page/panels become unresponsive? Example pseudo code might include; new TextField(text).add(new AjaxBehavior(onchange)); With this request, the ajax request never returns ... say after 30 seconds. And the bevhaior is diferent for different browsers. IE8 may have an issue but Chrome does not. Is there something I could debug to see if this is the case? Is there some sort of issue or timeout with ajax requests.
RE: Slow ajax request and possible timeout variable?
This bug seems to be related to the issue I am experiencing. https://issues.apache.org/jira/browse/WICKET-2246 From: Brown, Berlin [GCG-PFS] Sent: Wednesday, May 25, 2011 11:57 PM To: 'users@wicket.apache.org' Subject: Slow ajax request and possible timeout variable? Sometimes on slower connections I see issues with the application with ajax requests. If the request takes longer than 20 or 30 seconds my page/panels become unresponsive? Example pseudo code might include; new TextField(text).add(new AjaxBehavior(onchange)); With this request, the ajax request never returns ... say after 30 seconds. And the bevhaior is diferent for different browsers. IE8 may have an issue but Chrome does not. Is there something I could debug to see if this is the case? Is there some sort of issue or timeout with ajax requests.
RE: WicketStuff.org is down, do you guys need some change for your server?
Is it down again, darn I was doing a demo. I am getting a 503 unavailable error. -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Thursday, May 26, 2011 9:59 AM To: users@wicket.apache.org Subject: Re: WicketStuff.org is down, do you guys need some change for your server? Seems to be up now. On Thu, May 26, 2011 at 4:32 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Is wicketstuff.org supposed to be up? I don't know if it is deprecated or not. There were some good examples out there. -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - 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
Request logger invasive
Is the request logger invasive? Is it something that can be used in a production environment? http://www.volkomenjuist.nl/blog/2009/04/08/wicket-requestlogger/
Wicket, invalidurlexception with ajax panel, possibly ajax calls
I am getting this error intermittently with a web application that uses ajax calls. My theory is that on slower Internet connections, parts of a page aren't returned at the correct time. With the ajax call, maybe a user clicks on a link but the link hasn't been entirely processed by the server back end. Error: org.apache.wicket.protocol.http.request.InvalidUrlException: org.apache.wicket.WicketRuntimeException: component panel:theLink not found on page MyHomePage[id = 1], listener interface = [RequestListenerInterface name=IBehaviorListener, method=public abstract void org.apache.wicket.behavior.IBehaviorListener.onRequest()] at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequ estCycleProcessor.java:262) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484 ) at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:1 38) at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) ... Version: Wicket1.4.13 Pseudo Code: I am using the wicket ajax tabbed panel. On the panel, there is a link added to the tabbed panel. And the tabs are added to the page. We normally don't refresh the entire page. Content is controlled by the ajax tabbed panel system. It looks like I am getting the invalid URL exception on the link. I haven't been able to recreate the error. It is something that the end user tends to see. ... import org.apache.wicket.extensions.ajax.markup.html.tabs.AjaxTabbedPanel; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; import org.apache.wicket.extensions.markup.html.tabs.ITab; public class MyTab extends AbstractTab { @Override public Panel getPanel( final String arg0 ) { return new MyPanel(); } } public class MyPanel { public MyPanel() { this.add( new AjaxSubmitLink Object ( theLink ) { @Override public void onEvent( final AjaxRequestTarget target ) { ... } } ); } } ...
Debugging page expired exception errors
I get two pageexpiredexception errors and I can't recreate the problem. With an error like this, what would cause this type of page expired exception error? Do you think that the page actually expired? Or is there something wrong with writing or reading from the page map file on disk. ERROR ONE: 2011-05-06 23:21:43,619 ERROR - Cannot find the rendered page in session [pagemap=null,componentPath=2:contentPanelContainer:contentPanel:panel:f ield,versionNumber=0] org.apache.wicket.protocol.http.PageExpiredException: Cannot find the rendered page in session [pagemap=null,componentPath=2:contentPanelContainer:contentPanel:panel:f ield,versionNumber=0] at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequ estCycleProcessor.java:197) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484 ) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java: 160) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.ja va:1146) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrap per.java:592) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWr apper.java:525) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3548) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831 ) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1 478) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:1 33) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscriminatio n(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformatio n(HttpInboundLink.java:387) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpIC LReadCallback.java:102) at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallba ck.complete(SSLReadServiceContext.java:1818) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(Ai oReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture. java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFu ture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java :751) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497) ERROR TWO: Request cannot be processed org.apache.wicket.protocol.http.PageExpiredException: Request cannot be processed at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequ estCycleProcessor.java:163) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484 ) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java: 160) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.ja va:1146) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrap per.java:592) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWr apper.java:525) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3548) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831 ) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1 478) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:1 33) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscriminatio n(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformatio n(HttpInboundLink.java:387) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpIC LReadCallback.java:102) at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallba ck.complete(SSLReadServiceContext.java:1818) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(Ai oReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.
FW: Debugging page expired exception errors
I posted this the other day, I think I have some more information. Is there a way to change the session secondlevel cache store and possibly the default disk store such that there aren't collissions between file writes/reads. I think in a high volume environment (lots of hits), I am getting this pageexpiredexception because wicket is trying to access to the diskpage store data the same time. E.g. Are multiple writes/reads allowed against the diskpagestore/DiskPageStoreIndex? - - I get two pageexpiredexception errors and I can't recreate the problem. With an error like this, what would cause this type of page expired exception error? Do you think that the page actually expired? Or is there something wrong with writing or reading from the page map file on disk. ERROR ONE: 2011-05-06 23:21:43,619 ERROR - Cannot find the rendered page in session [pagemap=null,componentPath=2:contentPanelContainer:contentPanel:panel:f ield,versionNumber=0] org.apache.wicket.protocol.http.PageExpiredException: Cannot find the rendered page in session [pagemap=null,componentPath=2:contentPanelContainer:contentPanel:panel:f ield,versionNumber=0] at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequ estCycleProcessor.java:197) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484 ) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java: 160) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.ja va:1146) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrap per.java:592) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWr apper.java:525) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3548) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831 ) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1 478) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:1 33) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscriminatio n(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformatio n(HttpInboundLink.java:387) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpIC LReadCallback.java:102) at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallba ck.complete(SSLReadServiceContext.java:1818) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(Ai oReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture. java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFu ture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java :751) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497) ERROR TWO: Request cannot be processed org.apache.wicket.protocol.http.PageExpiredException: Request cannot be processed at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequ estCycleProcessor.java:163) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484 ) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java: 160) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.ja va:1146) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrap per.java:592) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWr apper.java:525) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3548) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:269) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:831 ) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1 478) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:1 33) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscriminatio n(HttpInboundLink.java:458) at
RE: FW: Debugging page expired exception errors
What do you think about older versions? 1.4 era. I will try the load tests. -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Tuesday, June 21, 2011 8:40 AM To: users@wicket.apache.org Subject: Re: FW: Debugging page expired exception errors we have a unit test that starts 20 threads which read and write randomly and there is no problem. DiskDataStoreTest (Wicket 1.5) On Tue, Jun 21, 2011 at 3:37 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: I posted this the other day, I think I have some more information. Is there a way to change the session secondlevel cache store and possibly the default disk store such that there aren't collissions between file writes/reads. I think in a high volume environment (lots of hits), I am getting this pageexpiredexception because wicket is trying to access to the diskpage store data the same time. E.g. Are multiple writes/reads allowed against the diskpagestore/DiskPageStoreIndex? - - I get two pageexpiredexception errors and I can't recreate the problem. With an error like this, what would cause this type of page expired exception error? Do you think that the page actually expired? Or is there something wrong with writing or reading from the page map file on disk. ERROR ONE: 2011-05-06 23:21:43,619 ERROR - Cannot find the rendered page in session [pagemap=null,componentPath=2:contentPanelContainer:contentPanel:panel :f ield,versionNumber=0] org.apache.wicket.protocol.http.PageExpiredException: Cannot find the rendered page in session [pagemap=null,componentPath=2:contentPanelContainer:contentPanel:panel :f ield,versionNumber=0] at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRe qu estCycleProcessor.java:197) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:4 84 ) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java: 160) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper. ja va:1146) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWr ap per.java:592) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(Servlet Wr apper.java:525) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3548) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:26 9) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:8 31 ) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java :1 478) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java :1 33) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscriminat io n(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformat io n(HttpInboundLink.java:387) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(Http IC LReadCallback.java:102) at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCall ba ck.complete(SSLReadServiceContext.java:1818) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted( Ai oReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture. java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannel Fu ture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.ja va :751) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497) ERROR TWO: Request cannot be processed org.apache.wicket.protocol.http.PageExpiredException: Request cannot be processed at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRe qu estCycleProcessor.java:163) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:4 84 ) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java: 160) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper. ja va:1146
RE: FW: Debugging page expired exception errors
Sort of related, but I was also looking at ensuring that ajax requests do not get cached. Or page requests. Something along the lines of this code: final WebResponse response = getWebRequestCycle().getWebResponse(); response.setHeader(Cache-Control, no-cache, max-age=0, must-revalidate, no-store); -Original Message- From: Martijn Dashorst [mailto:martijn.dasho...@gmail.com] Sent: Tuesday, June 21, 2011 11:27 AM To: users@wicket.apache.org Subject: Re: FW: Debugging page expired exception errors For the TL;DR: check your cookies... Fun story follows... We just solved a strange bug in our own application where users were logged out after a certain, but random amount of time, and where other users reported being thrown out every 5 minutes. We couldn't discover what happened, and after logging everything sessionid related, we noticed two cookies being sent (that we added ourselves in the application). Looking at the client side of things, we finally saw that we were generating those 2 cookies for each path in the application-which was really increased since we introduced bookmarkable URLs... It appears that browsers have a limit for the amount of cookies per domain, and that each browser behaves differently when the limit is reached: - safari/chrome: no limit what soever - IE: 50 cookies, FIFO - FF: 50 cookies, random eviction Since we convinced many of our users to switch to firefox, they got thrown out at random times... Only the die hards with 'conservative' sys admins that are using IE were thrown out consistently. So long story short: check your cookies. Martijn On Tue, Jun 21, 2011 at 5:17 PM, Igor Vaynberg igor.vaynb...@gmail.com wrote: if this was a load issue we would hear a ton of complaints on the list. -igor On Tue, Jun 21, 2011 at 5:37 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: I posted this the other day, I think I have some more information. Is there a way to change the session secondlevel cache store and possibly the default disk store such that there aren't collissions between file writes/reads. I think in a high volume environment (lots of hits), I am getting this pageexpiredexception because wicket is trying to access to the diskpage store data the same time. E.g. Are multiple writes/reads allowed against the diskpagestore/DiskPageStoreIndex? - - I get two pageexpiredexception errors and I can't recreate the problem. With an error like this, what would cause this type of page expired exception error? Do you think that the page actually expired? Or is there something wrong with writing or reading from the page map file on disk. ERROR ONE: 2011-05-06 23:21:43,619 ERROR - Cannot find the rendered page in session [pagemap=null,componentPath=2:contentPanelContainer:contentPanel:pane l:f ield,versionNumber=0] org.apache.wicket.protocol.http.PageExpiredException: Cannot find the rendered page in session [pagemap=null,componentPath=2:contentPanelContainer:contentPanel:pane l:f ield,versionNumber=0] at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebR equ estCycleProcessor.java:197) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java: 484 ) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java: 160) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper .ja va:1146) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletW rap per.java:592) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(Servle tWr apper.java:525) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3548) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:2 69) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java: 831 ) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.jav a:1 478) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.jav a:1 33) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimina tio n(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInforma tio n(HttpInboundLink.java:387) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(Htt pIC LReadCallback.java:102) at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCal lba ck.complete(SSLReadServiceContext.java:1818) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted (Ai oReadCompletionListener.java:165
Override modal.js functionality because of issue with form inside form
I am using a dated version of wicket. I don't know if this is fixed but I wanted to override the functionality in the modal.js from wicket-extensions. Basically, I need to remove the inner form that is created by the javascript. Some of the browsers we are using, the user cannot submit the form from a modal window (maybe our page layout is at fault). What is a non-invasive way of doing this (least amount of code changes)? It looks like a lot of the methods in the ModalWindow class are private or static, I was thinking of just overriding that class or reimplementing that class and passing my own javascript with modified functionality. Here is the javascript I needed to change: ... res/modal.js div class=\wicket-modal\ id=\+idWindow+\ style=\top: 10px; left: 10px; width: 100px;\form style='background-color:transparent;padding:0px;margin:0px;border-width: 0px;position:static'+
RE: Override modal.js functionality because of issue with form inside form
Related bug: https://issues.apache.org/jira/browse/WICKET-3146 From: Brown, Berlin [GCG-PFS] Sent: Sunday, June 26, 2011 8:23 PM To: 'users@wicket.apache.org' Subject: Override modal.js functionality because of issue with form inside form I am using a dated version of wicket. I don't know if this is fixed but I wanted to override the functionality in the modal.js from wicket-extensions. Basically, I need to remove the inner form that is created by the javascript. Some of the browsers we are using, the user cannot submit the form from a modal window (maybe our page layout is at fault). What is a non-invasive way of doing this (least amount of code changes)? It looks like a lot of the methods in the ModalWindow class are private or static, I was thinking of just overriding that class or reimplementing that class and passing my own javascript with modified functionality. Here is the javascript I needed to change: ... res/modal.js div class=\wicket-modal\ id=\+idWindow+\ style=\top: 10px; left: 10px; width: 100px;\form style='background-color:transparent;padding:0px;margin:0px;border-width: 0px;position:static'+
RE: Override modal.js functionality because of issue with form inside form
Either way, if I wanted to override that functionality. What is a way to do so? I am going to try adding the modal-override.js javascript And then getting rid of the inner form: Wicket.Window.getMarkup = ... CustomModal extends ModalWindow this.add(JavascriptPackageResource.getHeaderContribution(JAVASCRIPT)); With certain browsers, the way we are using browsers does not allow the submit. Works with IE but not in Chrome or Firefox. form modalWindow submitButton / /form -Original Message- From: Pedro Santos [mailto:pedros...@gmail.com] Sent: Sunday, June 26, 2011 11:27 PM To: users@wicket.apache.org Subject: Re: Override modal.js functionality because of issue with form inside form Hi Brown, submit a form inside a modal window should be fine, just make sure you have an outer form higher in hierarchy. Nested forms inside a modal window works nice even in old versions. It is important because it prevents invalid markup like form tag inside form tag. About improvements in modal window, it is already planned to Wicket 1.6. On Sun, Jun 26, 2011 at 9:24 PM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Related bug: https://issues.apache.org/jira/browse/WICKET-3146 From: Brown, Berlin [GCG-PFS] Sent: Sunday, June 26, 2011 8:23 PM To: 'users@wicket.apache.org' Subject: Override modal.js functionality because of issue with form inside form I am using a dated version of wicket. I don't know if this is fixed but I wanted to override the functionality in the modal.js from wicket-extensions. Basically, I need to remove the inner form that is created by the javascript. Some of the browsers we are using, the user cannot submit the form from a modal window (maybe our page layout is at fault). What is a non-invasive way of doing this (least amount of code changes)? It looks like a lot of the methods in the ModalWindow class are private or static, I was thinking of just overriding that class or reimplementing that class and passing my own javascript with modified functionality. Here is the javascript I needed to change: ... res/modal.js div class=\wicket-modal\ id=\+idWindow+\ style=\top: 10px; left: 10px; width: 100px;\form style='background-color:transparent;padding:0px;margin:0px;border-width: 0px;position:static'+ -- Pedro Henrique Oliveira dos Santos - 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
PageExpiredException with multiple browser windows, ajaxformupdating behavior
I am getting a PageExpiredException. I believe it is related to a user opening multiple browser windows. They are using the same session and accessing the same page at the same time. I was thinking that the page will expire in one window but not the other for some reason. User actions; 1. Open a window (with that Page) 2. Open another (with that Page) 3. Click around in one window for a couple of minutes 4. Maybe the user will go BACK to the first window and click 5. Receive PageExpiredException when they click on an ajax component. I can concede that maybe having having multiple windows and accessing the same session is not a good idea. I can restrict the user such that they only open one window. But, I just wanted to know if anyone had this issue and why. Here is the strange part, if the user clicks fast enough in both windows, window-a and window-b then they DON'T get the PageExpiredException. But if the user waits a minute or maybe around 30 seconds on one page, they get the PageExpiredException. Maybe the page is written to disk after 30 seconds or so? Here is essentially the page structure: Version: Wicket 1.4.15 Error: org.apache.wicket.protocol.http.PageExpiredException: Cannot find the rendered page in session [pagemap=null,componentPath=2:radio,versionNumber=0] at org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequ estCycleProcessor.java:197) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436) at org.apache.wicket.RequestCycle.request(RequestCycle.java:545) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:484 ) at org.apache.wicket.protocol.http.WicketServlet.doPost(WicketServlet.java: 160) at javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.ja va:1146) Most of the code: import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.apache.wicket.PageParameters; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.form.RadioChoice; public class TestPage extends WebPage { public static class OptionBean implements Serializable, Cloneable { private String name; private String value; public OptionBean() { this( null, null ); } public OptionBean( final String name, final String value ) { setName( name ); setValue( value ); } public String getName() { return name; } public void setName( final String name ) { this.name = name; } public String getValue() { return value; } public void setValue( final String value ) { this.value = value; } } final static List OptionBean yesNoList = new ArrayList OptionBean (); final static OptionBean YES_OPTION = new OptionBean(); final static OptionBean NO_OPTION = new OptionBean(); static { YES_OPTION.setName( Yes ); YES_OPTION.setValue( 1 ); yesNoList.add( YES_OPTION ); NO_OPTION.setName( No ); NO_OPTION.setValue( 0 ); yesNoList.add( NO_OPTION ); } public TestPage() { this(null); } public TestPage(final PageParameters p) { super(p); final RadioChoice rc = new RadioChoice(radio, yesNoList); rc.add(new AjaxFormChoiceComponentUpdatingBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { } }); this.add(rc); } }
target.addComponent and impact
If you have an ajax event and then you call target.addComponent on another component or collection of other components. Are there issues with calling target.addComponent on components that aren't visible or maybe detached from the page? Or calling target.addComponent more than once on a particular component?
RE: target.addComponent and impact
Let's say that I have a component in the hashmap that needs to get updated and let's that I call target.addComponent on some parent component, in that case will the child get updated twice. E.g. Target.addComponent(someChildComponent); Target.addComponent(someParentOfTheChild); In this case, will child get updated twice or still just once ... Because the parent will take care of having the child updated? -Original Message- From: Andrea Del Bene [mailto:adelb...@ciseonweb.it] Sent: Thursday, July 14, 2011 11:55 AM To: users@wicket.apache.org Subject: Re: target.addComponent and impact Right, I've looked at code and it uses an hashmap in last case i think rendering will be once because the components are kept in map with markupid of component as key in ajaxrequesttarget. On Thu, Jul 14, 2011 at 9:11 PM, Andrea Del Beneadelb...@ciseonweb.it wrote: - 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
RE: target.addComponent and impact
One more question. Is it is a hint to update this particular component? Or will wicket fully rerender the component the user whether it needs to get updated or not? -Original Message- From: Brown, Berlin [GCG-PFS] Sent: Thursday, July 14, 2011 12:06 PM To: 'users@wicket.apache.org' Subject: RE: target.addComponent and impact Let's say that I have a component in the hashmap that needs to get updated and let's that I call target.addComponent on some parent component, in that case will the child get updated twice. E.g. Target.addComponent(someChildComponent); Target.addComponent(someParentOfTheChild); In this case, will child get updated twice or still just once ... Because the parent will take care of having the child updated? -Original Message- From: Andrea Del Bene [mailto:adelb...@ciseonweb.it] Sent: Thursday, July 14, 2011 11:55 AM To: users@wicket.apache.org Subject: Re: target.addComponent and impact Right, I've looked at code and it uses an hashmap in last case i think rendering will be once because the components are kept in map with markupid of component as key in ajaxrequesttarget. On Thu, Jul 14, 2011 at 9:11 PM, Andrea Del Beneadelb...@ciseonweb.it wrote: - 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
getInput and getDefaultModelObject and validation
If I am using some form validator, I notice that getDefaultModelObject does not have the value from the getInput. I am assume this intentional. Is there a way to force wicket to update the modelObject? How and when does the modelobject get updated. myForm.add(new AbstractFormValidator() { public void validate() { String val = component.getInput(); --- has the correct value from the request String val2 = component.getModelObject(); does not have value. } }); ... In the case above, I could use the proper ajaxbehavior (like onBlur on a textfield) and the modelObject gets updated. But if I weren't using ajax, is there a way to force wicket to update the modelObject.
RE: getInput and getDefaultModelObject and validation
I guess there are cases where you want to use an AbstractFormValidator and run validation on a form before it is submitted and want to address those fields before they are submitted. It would be nice if the modelobject were updated. Let's say you have 100 textfields attached to a form, you want to validate some of the fields, all at once (say using FormValidator attached to the form), Is there a way to force a modelobject update on each individual field and then do my form validation. (I guess the only way is through ajax events on each field). E.g. Form.add(new TextField); Form.add(new TextField); Form.add(new TextField); Form.add(new TextField); Form.add(new TextField); Form.add(new AbstractFormValidator() { onValidate() { if (textField1.getInput() == creditCard) { } } }); ... With the code above, I have to do all of my form validation without my desired type. -Original Message- From: Wilhelmsen Tor Iver [mailto:toriv...@arrive.no] Sent: Friday, July 29, 2011 3:20 AM To: users@wicket.apache.org Subject: RE: getInput and getDefaultModelObject and validation If I am using some form validator, I notice that getDefaultModelObject does not have the value from the getInput. I am assume this intentional. Is there a way to force wicket to update the modelObject? Yes, form component models are not updated until they pass validation, that is very intentional. :) (E.g. if you have a Date text field and someone types beer, what would you expect to be written to the model?) How and when does the modelobject get updated. When all validation succeeds and it progresses into a submit. But if I weren't using ajax, is there a way to force wicket to update the modelObject. That will happen automatically after validation passes. Validation should ideally only check inputs and give any errors. - Tor Iver - 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
RE: getInput and getDefaultModelObject and validation
then your model will have invalid data, and if that is acceptable, what role does the validator fill then? You might as well do your checks in onSubmit() at that point... I guess it depends, I normally haven't had a need to validate every individual component. But I like having all of my model objects with their values and then doing validation of those values/types before the form is submitted. getConvertedInput would work what role does the backing object fill if you can't using them during your validation. I guess in some cases you want an override switch to allow the model object to get updated with the input pre-validation. ... As a hack, we normally just add ajaxbehaviors on the components and their values get updated, then I can do form validation with all the updated models. -Original Message- From: Wilhelmsen Tor Iver [mailto:toriv...@arrive.no] Sent: Friday, July 29, 2011 5:04 AM To: users@wicket.apache.org Subject: RE: getInput and getDefaultModelObject and validation Is there a way to force a modelobject update on each individual field and then do my form validation. It seems you want to use getConvertedInput(). Going via the model to get the converted value is just a detour when you are in a validator. If you push data to the model and then decide it is invalid, then your model will have invalid data, and if that is acceptable, what role does the validator fill then? You might as well do your checks in onSubmit() at that point... if (textField1.getInput() == creditCard) { You should be aware that this code will most likely fail. Look into equals(). - Tor Iver - 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
RE: Cheap, ajax event on page load
Well, I guess I figured out how you can easily get a page expired exception or invalidurlexception. If you hide the component where the timer behavior was created from before the timer behavior comes back, then you get an error. From: Brown, Berlin [GCG-PFS] Sent: Thursday, August 04, 2011 10:26 PM To: 'users@wicket.apache.org' Subject: Cheap, ajax event on page load Using timerbehavior for an ajax onload. I have been wanting an on page load ajax request. There isn't one builtin but I have used this recently. Using ajax timer behavior, use the onTimer event. It works, except you have to wait for the timed interval to get invoked. At a minimum, I use a second and not for critical operations. My only concern with using this approach (besides the fact I using the class outside of the normal use-case) is ensuring that the timer behavior is removed properly. Any see in issue with doing this? Browser compability issues with timer behavior? Class extends AbstractAjaxTimerBehavior @Override protected void onTimer(final AjaxRequestTarget target) { if (counter = this.getMaxNumberIntervals()) { try { this.stop(); if (this.getComponent() != null) { this.getComponent().remove(this); } } catch(Exception e) { } counter = 0; } // End of if, check for removal counter++; }
On Label/Div or some other component, how to use setMarkupId and dynamic id
Is there a way to prefix a component with using setMarkupid but also have the dynamic id. I want my end output to have: With Code: x = new WebMarkupContainer(myId) x.setMarkupId(myId); div id=myId_id2323 /
RE: On Label/Div or some other component, how to use setMarkupId and dynamic id
Strange but I may scrape the page and search for those particular elements. I want the prefix but I also want to keep uniqueness. -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Thursday, September 01, 2011 2:19 PM To: users@wicket.apache.org Subject: Re: On Label/Div or some other component, how to use setMarkupId and dynamic id i guess the question would be: why? -igor On Thu, Sep 1, 2011 at 10:57 AM, Brown, Berlin [GCG-PFS] berlin.br...@primerica.com wrote: Is there a way to prefix a component with using setMarkupid but also have the dynamic id. I want my end output to have: With Code: x = new WebMarkupContainer(myId) x.setMarkupId(myId); div id=myId_id2323 / - 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
RE: On Label/Div or some other component, how to use setMarkupId and dynamic id
Well setMarkId is already there. And I have seen it done before, I think with the render Header? I think I got what I needed. -Original Message- From: jcgarciam [mailto:jcgarc...@gmail.com] Sent: Thursday, September 01, 2011 4:34 PM To: users@wicket.apache.org Subject: Re: On Label/Div or some other component, how to use setMarkupId and dynamic id I meant some specific custom attribute. On Thu, Sep 1, 2011 at 5:33 PM, Juan Carlos Garcia jcgarc...@gmail.comwrote: Why not adding a behavior that output some specific custom tag using the onComponentTag method? Will that work for you? On Thu, Sep 1, 2011 at 4:54 PM, Brown, Berlin [GCG-PFS] [via Apache Wicket] ml-node+3784600-559914674-65...@n4.nabble.com wrote: Strange but I may scrape the page and search for those particular elements. I want the prefix but I also want to keep uniqueness. -Original Message- From: Igor Vaynberg [mailto:[hidden email]http://user/SendEmail.jtp?type=nodenode=3784600i=0] Sent: Thursday, September 01, 2011 2:19 PM To: [hidden email] http://user/SendEmail.jtp?type=nodenode=3784600i=1 Subject: Re: On Label/Div or some other component, how to use setMarkupId and dynamic id i guess the question would be: why? -igor On Thu, Sep 1, 2011 at 10:57 AM, Brown, Berlin [GCG-PFS] [hidden email] http://user/SendEmail.jtp?type=nodenode=3784600i=2 wrote: Is there a way to prefix a component with using setMarkupid but also have the dynamic id. I want my end output to have: With Code: x = new WebMarkupContainer(myId) x.setMarkupId(myId); div id=myId_id2323 / - To unsubscribe, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3784600i=3 For additional commands, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3784600i=4 - To unsubscribe, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3784600i=5 For additional commands, e-mail: [hidden email]http://user/SendEmail.jtp?type=nodenode=3784600i=6 -- If you reply to this email, your message will be added to the discussion below: http://apache-wicket.1842946.n4.nabble.com/On-Label-Div-or-some-other -component-how-to-use-setMarkupId-and-dynamic-id-tp3784344p3784600.ht ml To start a new topic under Apache Wicket, email ml-node+1842946-398011874-65...@n4.nabble.com To unsubscribe from Apache Wicket, click herehttp://apache-wicket.1842946.n4.nabble.com/template/NamlServlet.jtp ?macro=unsubscribe_by_codenode=1842946code=amNnYXJjaWFtQGdtYWlsLmNvbXw xODQyOTQ2fDEyNTYxMzc3ODY=. -- JC -- JC -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/On-Label-Div-or-some-other-co mponent-how-to-use-setMarkupId-and-dynamic-id-tp3784344p3784704.html Sent from the Users forum mailing list archive at Nabble.com. - 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