Re: wicket-event.js 404
2010/5/14 Jeremy Thomerson jer...@wickettraining.com: Also - what version of Wicket are you using? I was using version 1.4.3. It seems to be fixed in 1.4.8. Was something related to an AjaxFormSubmitBehavior binded to the onblur event. Thanks, bye Lorenzo - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
wicket-event.js 404
Hi all, I have a quite simple composition of panels with the innermost panel containing a form. In the form there is an AjaxSubmitLink. In the onSubmit of the link there is this line target.addComponent(feedback); When I click the link using Firebug in Firefox I can see that a POST is sent to this URL http://localhost:9090/?wicket:interface=:3:products:newItemDetails:editor:entity:actionBar:save::IActivePageBehaviorListener:0:1wicket:ignoreIfNotActive=true the content is a standard multi-part submit, I can post it if useful. The server responds with this ajax-response ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent id=newItemDetailse ![CDATA[div wicket:id=newItemDetails id=newItemDetailsewicket:panel span wicket:id=viewwicket:panel /wicket:panel/span /wicket:panel/div]]/componentheader-contribution encoding=wicket1 ![CDATA[head xmlns:wicket=http://wicket.apache.org;script type=text/javascript src=resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js/script script type=text/javascript src=resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js/script script type=text/javascript id=wicket-ajax-debug-enable!--/*--![CDATA[/*!--*/ wicketAjaxDebugEnable=true; /*--]^]^*//script ... Then firefox tries to download the file wicket-event.js from this URL http://localhost:9090/purchase/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js and gets a 404 error. purchase is the mount name of the starting page (mounted using a MixedParamHybridUrlCodingStrategy). The webapp does not have a context, it's mounted on the root of the webserver. Instead the file is actually available on this URL http://localhost:9090/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js For comparison, In the headers of the very first page, the one containing the link, there is this line script type=text/javascript src=../resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js/script and this works correctly. I found in the dubugger where the headers for the ajax-response are built and I arrived at WebRequestCodingStrategy.encode, line 830. Here the path is always built as fixed path, dots are never prepended. Now I'm a little confused. Firefox ask first asks for this URL http://localhost:9090/. The response contains relative URLs so I would expect for Firefox to consider these as relatives to the requested URL. So the next request should be the correct one. Instead FF adds a purchase fragment in the URL. Why? Is this the expected behaviour for an ajax-request? Any suggestion to fix this problem? At this time I can easily debug this problem so I can provide any extra info. Bye Lorenzo -- La TV uccide. Se vuoi puoi smettere. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Accessing the rowItem from the populateItem of a column
2009/7/15 Iain Reddick iain.redd...@beatsystems.com: cellItem.getParent().getParent() will get the row component, but it's not a very clean solution. Hi, thanks for the replies. I'm using wicket 1.3.3 and this method was not yet present. I'm not upgrading due to some problems with ajax tests and WicketTester. Anyway I cannot see many other options, other than using a ListView instead of a table or the one described above. Bye Lorenzo - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Accessing the rowItem from the populateItem of a column
Hi all, I need to do an ajax refresh of a whole line of a table. On the left of the table there is a dropdown and when the selection is changed the other fields of the table should be refreshed accordingly. So I have a column where the dropdown is defined and here I add an onchange behaviour where I should add the entire row to the ajax target. But in the populateItem of ICellPopulator I have no access to the rowItem. With this hack Object repeatingView = ReflectionUtil.getPrivateField(cellItem, parent); return (Item) ReflectionUtil.getPrivateField(repeatingView, parent); I can reach the rowItem and everything works perfectly. Now I was looking for a cleaner way to do this. The item I need is the one that is received from the populateItem(Item) of AbstractDataGridView so I could override this call super and add the tracking of the current rowItem making it available, as a field, in subsequent ICellPopulator.populateItem calls. Not very nice anyway. Do you have any suggestion? Could a getParent method added to cellItem to access to the rowItem it belongs to? Thanks, bye Lorenzo -- It has to start somewhere, It has to start sometime. What better place than here, what better time than now? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
How to keep fields between pages
Hi, I'm trying to keep a page state between requests. I know this should be a very simple thing, but it's puzzling me. I have a field, a List, in my page where some data from the user is accumulated. This data is generated from a monitoring system. The user starts the monitoring and the events are added to the list. Then he need to be able to move to other pages, do some other stuff, than come back to this page and find the previous content (for example the last 100 events). I use a ListView to display the data. So I think the Page should be instantiated only once, but the populate item should be called on every page display. Even browser refresh should not create a new Page. Then the page should auto refresh with an ajaxSelfUpdate behaviour, html refresh or something like that. At this time I'm fighting with mounts, PageLinks and populateItems but I'm not finding the right combo. Is this approach correct? Should I use something else instead of a field to keep the data? Thanks, bye Lorenzo - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to keep fields between pages
2009/5/22 Dipu dipu@googlemail.com: can't you store the List in the session when you move to other page's and get it from session when you get back. Yes, I can, but it doesn't look very wicket style, so I suspect I'm missing something about Wicket (PageMaps, RequestTarget, ecc.) and that there is a very clean and easy solution waiting out there. If it's not so, using session attributes could be a good option. Thanks Lorenzo - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Form values lost on converter error when inside table
Hi, I'need to display some editable values inside an HTML table. The form contains both string and numeric values. If I submit an invalid numeric value an error is reporter but all other values are lost. Using a simple form this does not happens, it happens only when we had the table part. I think we have done something wrong with the dataview and the dataProvider but we cannot see what's wrong. Following this article (we skipped the detachable part) http://liminescence.blogspot.com/2007/12/wicket-html-table-implementation.html I defined a very simple DataProvider protected List readAll() { return Arrays.asList(new Bean(a, 1), new Bean(b, 2)); } a simple dataView @Override protected void populateItem(Item item) { Bean bean = (Bean) item.getModelObject(); item.setModel(new CompoundPropertyModel(bean)); item.add(new TextField(rock)); item.add(new TextField(number)); } and added this to a form final DataView personDataView = new PersonDataView(beanList, dataProvider); form.add(personDataView); This is the markup table width=100% border=0 trthRock/th thNumber/th/tr tr wicket:id=beanList td input wicket:id=rock type=text size=20 maxlength=5/br/ /td td input wicket:id=number type=text size=20 maxlength=5/br/ /td /tr /table When I type an invalid value for the number field the rock field is reset to the default value and the input from the user is lost. What are we doing wrong? Thanks, bye Lorenzo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Form values lost on converter error when inside table
2008/9/12 Serkan Camurcuoglu [EMAIL PROTECTED]: if you were using a listview, you should have called setReuseItems(true) on it.. Maybe there exists something similar for DataView.. ListView javadoc says: If you nest a ListView in a Form, ALLWAYS set this property to true, as otherwise validation will not work properly. Hi Serkan, think you very much for the reply, we looked for something similar but we completely missed that. I think could be useful to report the same warning in the DataView and DataTable javadoc (or maybe just Form). Anyway in our example we are using a DataView and that method is not present. We found a setReuseStrategy both on DataView and on DataTable but none of the provided strategies (default and reuseIfEquals) worked. What is the ReuseStrategy providing a behavior equivalent to setReuseItems(true)? I suspect is ReuseIfModelsEqualStrategy and we have to define a custom model with the correct equals but I'm not sure and I'm looking for a confirm. Thanks again. Bye Lorenzo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple instances of pages and spring integration
Hi Igor, I tried your suggestion and it works but looks like a workaround more than a solution. I have many pages that need some configuration. This is server side configuration, for example how often a page should refresh itself. I tryed to pass in these parameters as PageParameters but in this way I have to convert this from String to Integer to use it and in every call to the page I have to provide these parameters. At the same time I do not have an easy place to put this page configuration params. I think I can define a PageParameters bean for each page inside spring but looks like a bad hack and this won't solve all the problems. I expect page configuration to be a very common problem so I think there should be a simple/standard approach for this or just some best practices about this. Thanks, bye Lorenzo 2008/8/6 Igor Vaynberg [EMAIL PROTECTED]: well normally you would just do class monitorpage extends webpage { public monitorpage(string deviceid) { .. do whatever with deviceid } } if you need your pages to be bookmarkable then just use class monitorpage extends webpage { public monitorpage(pageparameters params) { string deviceid=params.get(0); } } and mount the page with mount(/device,new indexedurlcodingstrategy(monitorpage.class)); then the urls are /device/deviceid -igor On Wed, Aug 6, 2008 at 10:48 AM, Lorenzo Bolzani [EMAIL PROTECTED] wrote: Hi all, I have a page to monitor the status of a remote device. The page just stay there and refresh automatically to display the actual state. The problem is that I need to have to distinct pages to monitor two distinct devices. My ideal approach would be to define two pages in spring, something like this bean class=DeviceMonitorPage name=monitor1 property name=device ref=device1/ property name=mountUrl value=deviceMonitor1/ /bean bean class=DeviceMonitorPage name=monitor2 property name=device ref=device2/ property name=mountUrl value=deviceMonitor2/ /bean but I know that Wicket is not going to look for this pages in my spring-config file. In other words I need two instances of the same page configured in two different ways. Is this possibile? How can I pass in the parameters (with or without spring)? I found nothing about this in the docs. In this way I could pass in the ref name (device1 or device2) and make it work with an explicit spring context lookup (no injection). The @SpringBean annotation works but in this specific case it is not usable because of the two different parameters. Thanks for any suggestions. Bye Lorenzo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- It has to start somewhere, It has to start sometime. What better place than here, what better time than now? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple instances of pages and spring integration
Hi Michael, the point is that this is not a user provided parameter but a server-side page configuration parameter. In this specific case I need to tell the page how often it should auto-refresh. So it is not something that should be passed in from the client over the url but something defined at the application startup. If my page requires three config parameters I do not want to have to provide these on every link to this page. Am I missing something? Bye Lorenzo 2008/8/11 Michael Sparer [EMAIL PROTECTED]: I'd say Igor's suggestion is a solution rather than workaround. There's just no point in configuring pages by means of XML or - worse - even a spring config. Passing in page specific parameters is exactly the way to go. I tryed to pass in these parameters as PageParameters but in this way I have to convert this from String to Integer to use it and in every call to the page I have to provide these parameters. I don't get it. Parsing a String with Integer.parse shouldn't be considered as a bad hack or a problem - as far as i know you can even use params.getInt(foobar). and you're also free to do your custom stuff if a param isn't provided. or am i misunderstanding something? regards, Michael Lorenzo Bolzani wrote: Hi Igor, I tried your suggestion and it works but looks like a workaround more than a solution. I have many pages that need some configuration. This is server side configuration, for example how often a page should refresh itself. I tryed to pass in these parameters as PageParameters but in this way I have to convert this from String to Integer to use it and in every call to the page I have to provide these parameters. At the same time I do not have an easy place to put this page configuration params. I think I can define a PageParameters bean for each page inside spring but looks like a bad hack and this won't solve all the problems. I expect page configuration to be a very common problem so I think there should be a simple/standard approach for this or just some best practices about this. Thanks, bye Lorenzo 2008/8/6 Igor Vaynberg [EMAIL PROTECTED]: well normally you would just do class monitorpage extends webpage { public monitorpage(string deviceid) { .. do whatever with deviceid } } if you need your pages to be bookmarkable then just use class monitorpage extends webpage { public monitorpage(pageparameters params) { string deviceid=params.get(0); } } and mount the page with mount(/device,new indexedurlcodingstrategy(monitorpage.class)); then the urls are /device/deviceid -igor On Wed, Aug 6, 2008 at 10:48 AM, Lorenzo Bolzani [EMAIL PROTECTED] wrote: Hi all, I have a page to monitor the status of a remote device. The page just stay there and refresh automatically to display the actual state. The problem is that I need to have to distinct pages to monitor two distinct devices. My ideal approach would be to define two pages in spring, something like this bean class=DeviceMonitorPage name=monitor1 property name=device ref=device1/ property name=mountUrl value=deviceMonitor1/ /bean bean class=DeviceMonitorPage name=monitor2 property name=device ref=device2/ property name=mountUrl value=deviceMonitor2/ /bean but I know that Wicket is not going to look for this pages in my spring-config file. In other words I need two instances of the same page configured in two different ways. Is this possibile? How can I pass in the parameters (with or without spring)? I found nothing about this in the docs. In this way I could pass in the ref name (device1 or device2) and make it work with an explicit spring context lookup (no injection). The @SpringBean annotation works but in this specific case it is not usable because of the two different parameters. Thanks for any suggestions. Bye Lorenzo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- It has to start somewhere, It has to start sometime. What better place than here, what better time than now? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/Multiple-instances-of-pages-and-spring-integration-tp18856317p18924320.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- It has to start somewhere, It has to start
Re: Multiple instances of pages and spring integration
2008/8/11 Igor Vaynberg [EMAIL PROTECTED]: then have your page look it up itself from the spring context using some registry class mypage extends webpage { @SpringBean private PageConfigRegistry registry; public mypage() { mydata data=(mydata)registry.getdatafor(getclass()); // do whatever with data // ^ or put that lookup into your base page so page just has to call getConfigData() } } So you are saying that wicket does not provide a standard way for page configuration. So I'll develop a custom solution based on spring or on property files. there is no need for a framework to provide anything special for such a usecase, it is just java... Even I18N is just java, you could write the wicket code yourself if you should. But I chose to use wicket just not to have to. I think configurability is a very common requirement for any web framework (even servlets had this). Even a simple solution based on property files or, for example, a complete integration with Spring would be useful. Thanks, bye Lorenzo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multiple instances of pages and spring integration
Hi all, I have a page to monitor the status of a remote device. The page just stay there and refresh automatically to display the actual state. The problem is that I need to have to distinct pages to monitor two distinct devices. My ideal approach would be to define two pages in spring, something like this bean class=DeviceMonitorPage name=monitor1 property name=device ref=device1/ property name=mountUrl value=deviceMonitor1/ /bean bean class=DeviceMonitorPage name=monitor2 property name=device ref=device2/ property name=mountUrl value=deviceMonitor2/ /bean but I know that Wicket is not going to look for this pages in my spring-config file. In other words I need two instances of the same page configured in two different ways. Is this possibile? How can I pass in the parameters (with or without spring)? I found nothing about this in the docs. In this way I could pass in the ref name (device1 or device2) and make it work with an explicit spring context lookup (no injection). The @SpringBean annotation works but in this specific case it is not usable because of the two different parameters. Thanks for any suggestions. Bye Lorenzo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Adding custom resource properties files
Hi, we have two pages sharing the same set of user messages so we would like to be able to share the same file. The two pages are different and cannot subclass a same parent. We cannot extract a common component because we have two different views on the same data. Maybe we could define an empty panel and share that only for the user massages but I do not like this idea. Is there a way to add/override a new resource file at the page level? So that key are looked up in this way: component form page custom page file- this is new application and at the class level too. In other words I just want to insert e new file. We looked at IResourceLoader and this looks like an option (registering a custom Loader in the application init()). We tried and this works. The problem is how to integrate this new Loader with the standard ComponentStringResourceLoader so that the key is looked up also in the standard way. We had a look at PropertiesFactory trying to register a new file, but the list of resources is determined by a ResourceNameIterator in the method loadStringResources and is not easy to modify the behaviour of this method. So the only options seems to be to extend ComponentStringResourceLoader overriding loadStringResource(Class, String, Locale, String) with a big cut and paste. Is there any other option? Thanks, bye Lorenzo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]