Session still valid if user returns?
Once again, i have I question, to which I found no answer: If the user leaves my wicket application and navigates to another website and returns to my wicket application within a few minutes. Is his previous session still valid?
Re: Session still valid if user returns?
Yes, if a) the session hasn't expired yet (there's inactivity period after which session expires, usually set to 30 minutes) b) user hasn't closed the browser - the session cookie is still valid or c) session id is encoded in URL. -Matej On Fri, Sep 5, 2008 at 9:47 AM, Liz Huber [EMAIL PROTECTED] wrote: Once again, i have I question, to which I found no answer: If the user leaves my wicket application and navigates to another website and returns to my wicket application within a few minutes. Is his previous session still valid? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Assert that all models are detached at the end of the request?
For the sake of completeness, here is the solution I am currently using. It uses, as suggested by Martijn, a custom request cycle and a modified version of SerializableChecker. You have to install the custom request cycle in your application using @Override public RequestCycle newRequestCycle(Request request, Response response) { return new CustomRequestCycle(this, (WebRequest) request, (WebResponse) response); } Hope this helps others, too! Kaspar // * FILE: CustomRequestCycle.java * import java.io.NotSerializableException; import org.apache.wicket.Page; import org.apache.wicket.Response; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.protocol.http.WebRequest; import org.apache.wicket.protocol.http.WebRequestCycle; import org.apache.wicket.request.target.component.IPageRequestTarget; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * A custom request cycle that checks, when in development mode, that all models of a page are * detached. Currently, only model that are instances of LoadableDetachableModel (including * subclasses) are checked. */ public class CustomRequestCycle extends WebRequestCycle { /** Logging object */ private static final Logger log = LoggerFactory.getLogger(WebRequestCycle.class); public CustomRequestCycle(WebApplication application, WebRequest request, Response response) { super(application, request, response); } @Override protected void onEndRequest() { super.onEndRequest(); if (WebApplication .DEVELOPMENT .equalsIgnoreCase(WebApplication.get().getConfigurationType())) { Page requestPage = getRequest().getPage(); testDetachedObjects(requestPage); if (getRequestTarget() instanceof IPageRequestTarget) { Page responsePage = ((IPageRequestTarget) getRequestTarget()).getPage(); if (responsePage != requestPage) { testDetachedObjects(responsePage); } } } } private void testDetachedObjects(final Page page) { if (page == null) { return; } try { NotSerializableException exception = new NotSerializableException( Model is not detached when attempting to serialize!); DetachedChecker checker = new DetachedChecker(exception); checker.writeObject(page); } catch (Exception ex) { log.error(Couldn't test/serialize the Page: + page + , error: + ex); } } } // * FILE: DetachedChecker.java * import java.io.Externalizable; import java.io.IOException; import java.io.NotSerializableException; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.io.ObjectStreamClass; import java.io.ObjectStreamField; import java.io.OutputStream; import java.io.Serializable; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.util.Date; import java.util.IdentityHashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.Map; import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.util.lang.Generics; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * This is taken from Wicket SerializableChecker.java (SVN r687197) and customized slightly * (see comments containing KF). See the latter file for all details, including terms of * use. Notice that this does not replace SerializableChecker; the latter is still run. */ public final class DetachedChecker extends ObjectOutputStream { /** * Exception that is thrown when a non-serializable object was found. */ public static final class WicketNotSerializableException extends WicketRuntimeException { private static final long serialVersionUID = 1L; WicketNotSerializableException(String message, Throwable cause) { super(message, cause); } } /** * Does absolutely nothing. */ private static class NoopOutputStream extends OutputStream { @Override public void close() { } @Override public void flush() { } @Override public void write(byte[] b) { } @Override public void write(byte[] b, int i, int l) { } @Override public void write(int b) { } } private static abstract class ObjectOutputAdaptor implements ObjectOutput { public void close() throws IOException { } public void flush() throws IOException { } public void write(byte[] b) throws IOException { } public void write(byte[] b, int off, int len) throws IOException { } public void write(int b) throws IOException { } public void writeBoolean(boolean v) throws IOException { } public void writeByte(int v) throws IOException
Re: [Follow up] Ajax link doesn't call event
Lack of super section cause that kind of a problem. Look at example: AjaxEditableLabel label = new AjaxEditableLabel(componentId, new PropertyModel(dtoUser, loginName)){ @Override protected void onEdit(AjaxRequestTarget target) { super.onEdit(target); log.debug(ListCopies.ListCopies().loginNameColumn.onEdit: +dtoUser.getId()+ +dtoUser.getLoginName()+ +dtoUser.getFirstName()+ +dtoUser.getLastName()); } @Override protected void onError(AjaxRequestTarget target) { super.onError(target); target.addComponent(getFeedbackPanel()); log.error(ListCopies.ListCopies().loginNameColumn.onError: +dtoUser.getId()+ +dtoUser.getLoginName()+ +dtoUser.getFirstName()+ +dtoUser.getLastName()); } @Override public void onSubmit(AjaxRequestTarget target){ super.onSubmit(target); log.debug(ListCopies.ListCopies().loginNameColumn.onSubmit: +dtoUser.getId()+ +dtoUser.getLoginName()); ((LibraryApplication) getApplication()).getManageUser().saveObject(dtoUser); } }; ezegb wrote: @SuppressWarnings(unchecked) @Override protected void onSubmit(AjaxRequestTarget target, Form form) { ProjectProduct projectProduct = (ProjectProduct) this.getModelObject(); projectProduct.getAuthor().remove(item.getIndex()); target.addComponent(authorContainer); } -- View this message in context: http://www.nabble.com/Ajax-link-doesn%27t-call-event-tp18219220p19326851.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]
Re: Problem with multiple browser windows and locked page maps
Hi Johan, I've seen the code in WebPage.onNewBrowserWindow(). The thing I'm having a problem figuring out is where to hook in this code. I can't see that I can do this in the constructor of a page as you suggest. In the constructor the page hasn't been fully constructed yet so I can't see that I could clone the page and redirect to it in the way that onNewBrowserWindow does. I've also had a look in wicket.Session to see if there's a place that I can hook in this extra check but I can't see how. Partly because all the relevant methods are final so can't be overridden... I tried to patch our version of Wicket to get a workaround for this. I added the following to Session.newPageMap(String name): public final IPageMap newPageMap(String name) { if (name == PageMap.DEFAULT_NAME) { name = createAutoPageMapName(); log.debug(Allocated new page map name: + name); } ...the rest as before... } This seems to solve the problem, but I don't know if this as other side effects. If this is basically a sensible fix, would it be reasonable to add a hook for doing this in a cleaner way, e.g. adding a call in newPageMap() to a new method getPageMapName(name), that in the default implementation just returns the argument, but could be overridden to do the above? Regards, Jan 2008/9/1 Johan Compagner [EMAIL PROTECTED] First try to look at the newbrowser window check that we have in webpage. Dont know if you can all do those things (clone the page and set another pagemap) What you could do is int the page const check pagemap, if default then create the same page as you are on but then with a different pagemap and throw a restartresponse exception. Johan On 9/1/08, Jan Stette [EMAIL PROTECTED] wrote: Johan, I've had a look at doing the workaround you suggest, but I don't know Wicket's internals enough to fully understand where to plug it in. In the constructor of a page, I can check the page map name, but how would I do the redirect here? Conversely, I can override onBeginRequest() in the request cycle, but in this case, how would I check the page map name and access other page details in order to redirect to the same page? Sorry if I'm being dim here, but some more details would be greatly appreciated. And yes, pages shouldn't take a long time to load, it's just that in some applications it's hard to guarantee that it will never happen, and we'd like to handle all cases to make our application as robust as possible. Regards, Jan 2008/8/29 Johan Compagner [EMAIL PROTECTED] Yes your observation is exactly what i described. What you can do is for example check in the constructor (with pagemap param) or in onbegin request (before render) of a page, if the pagemap is the default, if it is create the same page with a new pagemap and redicect to that one. Whay you want is that the default pagemap is never used, by defaul all pages are going into that But you should check if you really want long running processes like that! Jihan On 8/29/08, Jan Stette [EMAIL PROTECTED] wrote: Thanks for your answers, Matej and Johan. Matej: we are running with multi-window support on, and store per-window related navigation in the session keyed on page map name. This works fine most of the time. Johan: I've been stepping through the Wicket code and studying the docs to understand how it deals with new windows, and I think I'm starting to understand what's happening, and your comments about default page maps. Basically what seems to be the case is that the inital window in a session never receives its own page map name, it stays on the default one. This means that this initial window is indistinguishable from a brand new window that hasn't yet had a page map name allocated and been redirected to a page with this set. I've done some tests which seem to confirm this hypothesis: - I open an initial browser window on my application (window 1) - I open a second window in the same session (window 2) If a start a long-running operation in window 1, any new windows created will lock until window 1's operation has been completed. However, if I start the long-running operation in window 2, I can open new windows to my heart's content and they will not block. Does that make sense, is this an accurate description of the problem? It seems odd that the initial window is never allocated a page map name, which leads to this assymtry between windows. Is this something that can be fixed? Or even better, can I do something my side in order to force any window/page map opened against a session to have a unique name allocated? Regards, Jan 2008/8/29 Johan Compagner [EMAIL PROTECTED] And even with that check it will not work. If you open a new tab then the first
Re: Add a javascript window to a Link when text input not saved
Hi, you'll need some javascript to do this. your link (alink) will have to call some JS function which will check for changed inputs and if there is such input just call event.preventDefault() to prevent the request to the LinkPage.class On Wed, 2008-09-03 at 11:40 -0700, liza6218 wrote: Hi, I'm trying to figure out the following, any help will be apreciated. I have a form with 3 TextFields , a DropDownChoice and a save button , and a BookmarkablePageLink in the page. I need to add a javascript confirm window to the Link whenever any input changed without save (submit). and remove the confirm window when the change is saved. public aPage() { form = new Form(form); DropDownChoicequestion questions = new DropDownChoice(question, ...); form.add(questions); TextField answer1 = new RequiredTextField(answer1); TextField answer2 = new RequiredTextField(answer2); TextField answer3 = new RequiredTextField(answer3); form.add(answer1); form.add(answer2); form.add(answer3); form.add(new Button(save) { @Override public void onSubmit() { saveChanges(); //remove the confirm window } } add(form); BookmarkablePageLink alink = new BookmarkablePageLink(alink, LinkPage.class)); add(alink); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wicket-like framework to complement wicket?
Really? Would it be easy to implement this interface: http://domdrides.sourceforge.net/domdrides-core/apidocs/org/domdrides/repository/Repository.html If so, I'd be interested in the code as another submodule to domdrides (we've got hibernate, jpa, and iBATIS right now). On Fri, Sep 5, 2008 at 1:49 AM, Fernando Wermus [EMAIL PROTECTED] wrote: Francisco, I integrated db4o with wicket. bye! On Thu, Aug 21, 2008 at 9:25 AM, francisco treacy [EMAIL PROTECTED] wrote: sure! when i'm finished with neodatis integration, i'll open source the whole thing (really small though). we could then create a wicket-iolite archetype. i'll check if all the dependencies are available in public maven repos. i'll keep you updated. i'm looking for a name for this thing... have already 2 or 3 but suggestions are welcome :) francisco On Thu, Aug 21, 2008 at 1:54 AM, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote: Really great, now we just need it to get packed with Wicket iolite:) francisco treacy wrote: hi guys, i started to work on a little utility to glue some libraries that i already use with wicket. they became a standard stack when i develop applications: these are guice, salve, warp-persist and neodatis odb. this utility is meant to work with wicket, so i thought it would be nice to add some wicket-specific functionality like databinder does, for example. just a simple library to bootstrap with wicket, providing out-of-the-box dependency injection, transactions and persistence to your domain classes. i imagine neodatis could be easily replaced with any other database, thanks to warp-persist's pluggable persistence strategies. perhaps somebody else is using the same technologies and finds this idea worthwhile. more here: http://blog.zoptio.net/2008/08/21/wicket-like-framework-to-complement-wicket/ let me know what you think -- even if it's complete nonsense :) thanks! francisco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - 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] -- Fernando Wermus. www.linkedin.com/in/fernandowermus http://mientretiempo.blogspot.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem sharing model between 2 panels
Here is the problem I have a Parent panel which swaps in and out a Display panel and an Update panel (these are basically 2 views, read-only and read-write, of a users details). To enable any changes by the Update panel to be seen by the Display panel, I have both panels pointing to the same model, which in turn wraps the same user object. However, the Update panel uses a form to affect changes. This form also points to the same Model / Object and herein lies the problem the form maintains the same model throughout requests (as expected) BUT after debugging I found that it seems to be creating a different underlying model-object for each request. Therefore, while both my panels point to the same Model / Object the form is making changes to a different Object! Long story short after swapping the panels post-Update the changes are not seen by the Display panel. Is this form behaviour what you would expect to see? If so, is there a more elegant solution than just manually copying the changed fields between model-objects or grabbing the changed user object from the db again? Any help, very much appreciated. Thanks - Neil. -- View this message in context: http://www.nabble.com/Problem-sharing-model-between-2-panels-tp19330828p19330828.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]
Render html with Wickettester inside webapp locks page
Hi, I have used WicketTester in 1.3.X to render mail in a Link call like: WicketTester tester = new WicketTester(new WicketTester.NonPageCachingDummyWebApplication()); tester.startPage(new Mail(someData)); String mail = tester.getServletResponse().getDocument(); sendmail(mail); setResponsePage(...); However, if I try this on 1.4, the page will lock and never send any response back. Is this a bug, or just misuse? How can I get around the issue? Thanks, Daniel Roth -- View this message in context: http://www.nabble.com/Render-html-with-Wickettester-inside-webapp-locks-page-tp19330996p19330996.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]
Re: wicket-like framework to complement wicket?
first off, i admit i didn't know too much about domdrides. so it seems i was talking about the entity part. e.g. extend UuidEntity in your domain, that is orthogonal to gluw. concerning domdrides repository approach, as a quick idea i can imagine implementing gluw in an adapter pattern manner. not sure about generic params though. /** * A Gluw-based implementation of a person repository. */ public class GluwPersonRepository extends GluwRepositoryPerson,String implements PersonRepository { public GluwPersonRepository() { super(Person.class); } } public abstract class GluwRepositoryEntityType extends EntityIdType, IdType extends Serializable extends gluw.repo.RepositoryImplEntityType extends EntityIdType implements RepositoryEntityType, IdType { protected HibernateRepository(ClassEntityType entityClass) { super(entityClass); // will have to change constructor's package scope } // adapt existing methods signatures to super methods // new methods such as contains() not found in gluw.repo.Repository, implement by calling getDB() which provides an instance of ODB (neodatis) // - analogous to spring's HibernateDaoSupport } note you won't be taking advantage of the ootb gluw.repo.RepositoryEntity if you use domdrides approach (obviously). do you think integration is feasible? francisco ps: i should re-examine the way i'm handling getById(Serializable id). as i don't force the end user to extend any particular domain base class, i use a string/reflection-style ODB query -- which can cause trouble if the id field is not present. will have to evaluate tradeoffs of both approaches On Fri, Sep 5, 2008 at 12:56 PM, James Carman [EMAIL PROTECTED] wrote: Really? Would it be easy to implement this interface: http://domdrides.sourceforge.net/domdrides-core/apidocs/org/domdrides/repository/Repository.html If so, I'd be interested in the code as another submodule to domdrides (we've got hibernate, jpa, and iBATIS right now). On Fri, Sep 5, 2008 at 1:49 AM, Fernando Wermus [EMAIL PROTECTED] wrote: Francisco, I integrated db4o with wicket. bye! On Thu, Aug 21, 2008 at 9:25 AM, francisco treacy [EMAIL PROTECTED] wrote: sure! when i'm finished with neodatis integration, i'll open source the whole thing (really small though). we could then create a wicket-iolite archetype. i'll check if all the dependencies are available in public maven repos. i'll keep you updated. i'm looking for a name for this thing... have already 2 or 3 but suggestions are welcome :) francisco On Thu, Aug 21, 2008 at 1:54 AM, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote: Really great, now we just need it to get packed with Wicket iolite:) francisco treacy wrote: hi guys, i started to work on a little utility to glue some libraries that i already use with wicket. they became a standard stack when i develop applications: these are guice, salve, warp-persist and neodatis odb. this utility is meant to work with wicket, so i thought it would be nice to add some wicket-specific functionality like databinder does, for example. just a simple library to bootstrap with wicket, providing out-of-the-box dependency injection, transactions and persistence to your domain classes. i imagine neodatis could be easily replaced with any other database, thanks to warp-persist's pluggable persistence strategies. perhaps somebody else is using the same technologies and finds this idea worthwhile. more here: http://blog.zoptio.net/2008/08/21/wicket-like-framework-to-complement-wicket/ let me know what you think -- even if it's complete nonsense :) thanks! francisco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - 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] -- Fernando Wermus. www.linkedin.com/in/fernandowermus http://mientretiempo.blogspot.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wicket-like framework to complement wicket?
fernando, good! but i personally restrain from using db4o as its license is quite restrictive. that's why i'm supporting neodatis, which is slowly gaining momentum. is your code available? how are you handling transactions? how do you get references to ObjectContainers in your wicket pages? chau che francisco On Fri, Sep 5, 2008 at 7:49 AM, Fernando Wermus [EMAIL PROTECTED] wrote: Francisco, I integrated db4o with wicket. bye! On Thu, Aug 21, 2008 at 9:25 AM, francisco treacy [EMAIL PROTECTED] wrote: sure! when i'm finished with neodatis integration, i'll open source the whole thing (really small though). we could then create a wicket-iolite archetype. i'll check if all the dependencies are available in public maven repos. i'll keep you updated. i'm looking for a name for this thing... have already 2 or 3 but suggestions are welcome :) francisco On Thu, Aug 21, 2008 at 1:54 AM, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote: Really great, now we just need it to get packed with Wicket iolite:) francisco treacy wrote: hi guys, i started to work on a little utility to glue some libraries that i already use with wicket. they became a standard stack when i develop applications: these are guice, salve, warp-persist and neodatis odb. this utility is meant to work with wicket, so i thought it would be nice to add some wicket-specific functionality like databinder does, for example. just a simple library to bootstrap with wicket, providing out-of-the-box dependency injection, transactions and persistence to your domain classes. i imagine neodatis could be easily replaced with any other database, thanks to warp-persist's pluggable persistence strategies. perhaps somebody else is using the same technologies and finds this idea worthwhile. more here: http://blog.zoptio.net/2008/08/21/wicket-like-framework-to-complement-wicket/ let me know what you think -- even if it's complete nonsense :) thanks! francisco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - 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] -- Fernando Wermus. www.linkedin.com/in/fernandowermus http://mientretiempo.blogspot.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Making a Behavior that adds a script after a component?
I have a couple of behaviors that add javascript to the header of a document, to change attributes or add event scripts to components (using jquery onready, but that's not the point). This all works fine. There is just one problem: when I use such components in an ajax request/response, it won't have the javascript added attributes anymore, because the component gets replaced by the wicket ajax call. I'm looking for a way to make the behaviors add the necessary javascript to add the attributes again, when an ajax response is created. E.g. a way to let behaviors add a script to every ajax response, or let them add script tags after the rendering of the component. Is there a way to do this in Wicket? I know I could make a custom panel/component that just has an extra script tag, but that's far to intrusive, and makes it really difficult to make different combinations of these behaviors. Example behavior class: public class DatePickerBehavior extends AbstractBehavior { private String createOnReadyScript(String markupId) { return $(document).ready(function(){\n + createPickerScript(markupId) + \n});; } private String createPickerScript(String markupId) { return $('# + markupId + ').datepicker();; } public void bind(Component component) { super.bind(component); component.add(new HeaderContributor(new IHeaderContributor() { public void renderHead(IHeaderResponse response) { response.renderJavascript(createOnReadyScript(component.getMarkupId()), null); } })); //Is there a way to instead of contributing to the header, add the script to the document body after the rendering of // the component itself. //Or a way to add a script to every ajax request? } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
trying to display exceptions in Tomcat
Hi, I am new to Wicket and Tomcat and I am following a tutorial using Tomcat 6. I am doing a very simple Hello World application. I am trying to get Tomcat to display the exception message instead of the infamous The requested resource (/myApp/app) is not available Status 404 message when there is a problem in rendering the pages. In the tutorial I am following, the response page shows an exception message containing a WicketMessage describing the actual error which is entitled Unexpected RuntimeException. I have followed the author's steps but I don't get this nice exception message. Does anyone know if I am missing something in my configuration of Tomcat or in my deployment descriptor? Thanks Dean Murray
Re: Making a Behavior that adds a script after a component?
if you use renderOnDomReadyJavascript method of IHeaderResponse it will be invoked after ajax request. -Matej On Fri, Sep 5, 2008 at 3:41 PM, Pointbreak [EMAIL PROTECTED] wrote: I have a couple of behaviors that add javascript to the header of a document, to change attributes or add event scripts to components (using jquery onready, but that's not the point). This all works fine. There is just one problem: when I use such components in an ajax request/response, it won't have the javascript added attributes anymore, because the component gets replaced by the wicket ajax call. I'm looking for a way to make the behaviors add the necessary javascript to add the attributes again, when an ajax response is created. E.g. a way to let behaviors add a script to every ajax response, or let them add script tags after the rendering of the component. Is there a way to do this in Wicket? I know I could make a custom panel/component that just has an extra script tag, but that's far to intrusive, and makes it really difficult to make different combinations of these behaviors. Example behavior class: public class DatePickerBehavior extends AbstractBehavior { private String createOnReadyScript(String markupId) { return $(document).ready(function(){\n + createPickerScript(markupId) + \n});; } private String createPickerScript(String markupId) { return $('# + markupId + ').datepicker();; } public void bind(Component component) { super.bind(component); component.add(new HeaderContributor(new IHeaderContributor() { public void renderHead(IHeaderResponse response) { response.renderJavascript(createOnReadyScript(component.getMarkupId()), null); } })); //Is there a way to instead of contributing to the header, add the script to the document body after the rendering of // the component itself. //Or a way to add a script to every ajax request? } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Making a Behavior that adds a script after a component?
Perfect. Thanks! On Fri, 5 Sep 2008 15:53:12 +0200, Matej Knopp [EMAIL PROTECTED] said: if you use renderOnDomReadyJavascript method of IHeaderResponse it will be invoked after ajax request. -Matej On Fri, Sep 5, 2008 at 3:41 PM, Pointbreak [EMAIL PROTECTED] wrote: I have a couple of behaviors that add javascript to the header of a document, to change attributes or add event scripts to components (using jquery onready, but that's not the point). This all works fine. There is just one problem: when I use such components in an ajax request/response, it won't have the javascript added attributes anymore, because the component gets replaced by the wicket ajax call. I'm looking for a way to make the behaviors add the necessary javascript to add the attributes again, when an ajax response is created. E.g. a way to let behaviors add a script to every ajax response, or let them add script tags after the rendering of the component. Is there a way to do this in Wicket? I know I could make a custom panel/component that just has an extra script tag, but that's far to intrusive, and makes it really difficult to make different combinations of these behaviors. Example behavior class: public class DatePickerBehavior extends AbstractBehavior { private String createOnReadyScript(String markupId) { return $(document).ready(function(){\n + createPickerScript(markupId) + \n});; } private String createPickerScript(String markupId) { return $('# + markupId + ').datepicker();; } public void bind(Component component) { super.bind(component); component.add(new HeaderContributor(new IHeaderContributor() { public void renderHead(IHeaderResponse response) { response.renderJavascript(createOnReadyScript(component.getMarkupId()), null); } })); //Is there a way to instead of contributing to the header, add the script to the document body after the rendering of // the component itself. //Or a way to add a script to every ajax request? } } - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: trying to display exceptions in Tomcat
Dean Murray wrote: Hi, I am new to Wicket and Tomcat and I am following a tutorial using Tomcat 6. I am doing a very simple Hello World application. I am trying to get Tomcat to display the exception message instead of the infamous The requested resource (/myApp/app) is not available Status 404 message when there is a problem in rendering the pages. In the tutorial I am following, the response page shows an exception message containing a WicketMessage describing the actual error which is entitled Unexpected RuntimeException. I have followed the author's steps but I don't get this nice exception message. Does anyone know if I am missing something in my configuration of Tomcat or in my deployment descriptor? Thanks Dean Murray does this get you any further? http://cwiki.apache.org/confluence/display/WICKET/Error+Pages+and+Feedback+Messages mf - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Gmap2 not visible
Hi there, i'm having a problem with wicket-contrib-gmap2. I compiled the examples and everything worked fine. Then i wrote my own app just for testing but when i'm looking at the page i only see the 'powered by Google' Logo and the Copyright Notice but no map. Here's my Code: final GMap2 map = new GMap2(contentLocationGMap, GoogleMapsAPIKey); add(map); and here the HTML: div wicket:id=contentLocationGMap style=margin-left: auto; margin-right: auto; width: 600px; height: 400px;GoogleMap/div Had anybody have this problem too? Thanks for the answers ;) Regards, norman -- View this message in context: http://www.nabble.com/Gmap2-not-visible-tp19334325p19334325.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]
Re: Gmap2 not visible
try firing your app in DEPLOYMENT mode francisco On Fri, Sep 5, 2008 at 6:01 PM, normanr [EMAIL PROTECTED] wrote: Hi there, i'm having a problem with wicket-contrib-gmap2. I compiled the examples and everything worked fine. Then i wrote my own app just for testing but when i'm looking at the page i only see the 'powered by Google' Logo and the Copyright Notice but no map. Here's my Code: final GMap2 map = new GMap2(contentLocationGMap, GoogleMapsAPIKey); add(map); and here the HTML: div wicket:id=contentLocationGMap style=margin-left: auto; margin-right: auto; width: 600px; height: 400px;GoogleMap/div Had anybody have this problem too? Thanks for the answers ;) Regards, norman -- View this message in context: http://www.nabble.com/Gmap2-not-visible-tp19334325p19334325.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AjaxFormComponentUpdatingBehavior(onchange) does not work when added to a FormComponentPanel
Hello all, I created a Component called TimePanel which is a FormComponentPanel containing two DropDownChoices. As you may have guessed from the components name, its used to input time. It is intended to be used with Jodas LocaTime as a ModelObject. One DDC is for hours, the other one for minutes. It is very similar to the Time part of the DateTime Input example from WIA. Now what i want to achieve, is that this Panel can be used with AjaxFormComponentUpdatingBehavior(onchange) like any non-composite form component: timePanel.add(new AjaxFormComponentUpdatingBehavior(onchange) { @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(getForm()); } }); I expected problems, mostly because the enclosing div (the panels container) gets the onchange listener added. but to my surprise, an js event was generated when i changed the selected value in one of the select elements, and ultimately my TimePanel's convertInput() Method was called. My convertInput() looks like this: @Override protected void convertInput() { Integer hour=m_hourDropDownChoice.getConvertedInput(); Integer minute=m_minuteDropDownChoice.getConvertedInput(); setConvertedInput(new LocalTime(hour,minute)); } but both DDCs give me nulls as their convertedInput. They dont have any raw input either. Digging a little further i discovered why: ofcourse the timePanels, and not the DDCs, inputChanged() and getInputAsArray() methods are called when the event is triggered. they try to get a value from the request via the panels id, which of course results in null. Now my question is: Is there a best practice for what i try to achieve? Or is there already an AjaxBehaviour which does what i want? thank you for reading, lutz
Re: Problem sharing model between 2 panels
the model that the display panel should be a loadable detachable model so it loads data from the database on render the model that the update panel uses should load the changes, edit them, and save them to the database. that way everything is in sync. when the form submits it clones the model object, that is done for versioning reasons, but it is the clone that is kept...the reference to the actual model object should not be changed. -igor On Fri, Sep 5, 2008 at 6:05 AM, Neil McT [EMAIL PROTECTED] wrote: Here is the problem I have a Parent panel which swaps in and out a Display panel and an Update panel (these are basically 2 views, read-only and read-write, of a users details). To enable any changes by the Update panel to be seen by the Display panel, I have both panels pointing to the same model, which in turn wraps the same user object. However, the Update panel uses a form to affect changes. This form also points to the same Model / Object and herein lies the problem the form maintains the same model throughout requests (as expected) BUT after debugging I found that it seems to be creating a different underlying model-object for each request. Therefore, while both my panels point to the same Model / Object the form is making changes to a different Object! Long story short after swapping the panels post-Update the changes are not seen by the Display panel. Is this form behaviour what you would expect to see? If so, is there a more elegant solution than just manually copying the changed fields between model-objects or grabbing the changed user object from the db again? Any help, very much appreciated. Thanks - Neil. -- View this message in context: http://www.nabble.com/Problem-sharing-model-between-2-panels-tp19330828p19330828.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Render html with Wickettester inside webapp locks page
imho this is a misuse. but to try and get it to work you might want to run wickettester in a separate thread. i think it might hang because the tester will mess with the threadlocals. -igor On Fri, Sep 5, 2008 at 6:15 AM, danielroth [EMAIL PROTECTED] wrote: Hi, I have used WicketTester in 1.3.X to render mail in a Link call like: WicketTester tester = new WicketTester(new WicketTester.NonPageCachingDummyWebApplication()); tester.startPage(new Mail(someData)); String mail = tester.getServletResponse().getDocument(); sendmail(mail); setResponsePage(...); However, if I try this on 1.4, the page will lock and never send any response back. Is this a bug, or just misuse? How can I get around the issue? Thanks, Daniel Roth -- View this message in context: http://www.nabble.com/Render-html-with-Wickettester-inside-webapp-locks-page-tp19330996p19330996.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Assert that all models are detached at the end of the request?
Could you perhaps use an aspect for this? On Thu, Aug 28, 2008 at 4:57 PM, Kaspar Fischer [EMAIL PROTECTED] wrote: Is there an easy way to assert that all models are detached at the end of the request? It does not look so easy to check this as models do not have common base class where one could register them for a check... I often use an additional model in a component and store it as a member field; if I forgot to detach() this model in the onDetach() handler, I would have a dangling model. That caused me quite some trouble once and I want to avoid it in the future. Thanks, Kaspar - 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]
How to trigger Ajax event from client side javascript?
Hi, I'm trying to trigger OnChangeAjaxBehavior on an HiddenField (or TextField) change from client side javascript. Here is the code in html: function change(){ var change = document.forms[0].changed.value; if(change != true) { document.forms[0].changed.value = true; } } input type=hiden wicket:id=changed/ in wicket: Form form = new Form(form); add(form); final HidenField changed= new HidenField (changed); form.add(HidenField); final Label label = new Label(selectedValue); label.setOutputMarkupId(true); form.add(label); OnChangeAjaxBehavior onChangeAjaxBehavior = new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(label); } }; changed.add(onChangeAjaxBehavior); Any help will be very much appreciated. - Lisa -- View this message in context: http://www.nabble.com/How-to-trigger-Ajax-event-from-client-side-javascript--tp19335490p19335490.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]
Re: Gmap2 not visible
Yeah! Thanks i've read something like that, but my mind plays so many tricks on me at the moment :D Thanks so much! francisco treacy-2 wrote: try firing your app in DEPLOYMENT mode francisco On Fri, Sep 5, 2008 at 6:01 PM, normanr [EMAIL PROTECTED] wrote: Hi there, i'm having a problem with wicket-contrib-gmap2. I compiled the examples and everything worked fine. Then i wrote my own app just for testing but when i'm looking at the page i only see the 'powered by Google' Logo and the Copyright Notice but no map. Here's my Code: final GMap2 map = new GMap2(contentLocationGMap, GoogleMapsAPIKey); add(map); and here the HTML: div wicket:id=contentLocationGMap style=margin-left: auto; margin-right: auto; width: 600px; height: 400px;GoogleMap/div Had anybody have this problem too? Thanks for the answers ;) Regards, norman -- View this message in context: http://www.nabble.com/Gmap2-not-visible-tp19334325p19334325.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Gmap2-not-visible-tp19334325p19335676.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]
Re: DateField throwing runtime error in IE only
Hi, Did you or anyone found the solution to this? I am having the same problem in IE7 on a ModalWindow (implemented as Panel) with a DateTextField and a DatePicker attached to it. I noticed that it works for the first time when there is no date in the date field...but after date is selected and if user wants to change the date it does not work...Calendar does not come up. If you remove date from the date text field and click on calendar again then Calendar comes up but does not respond to date selection...and you cannot close the calendar by clicking [x].It also shows unknown runtime error line 2993. Did anyone face the similar problem? Thanks, RG Michael Mehrle wrote: I have a DateField inside a modal and when clicking on the date icon it's throwing a 'unknown runtime error' in IE's JavaScript console. Works in Safari and Firefox. Is this a commonly known problem? Michael -- View this message in context: http://www.nabble.com/DateField-throwing-runtime-error-in-IE-only-tp17379574p19337621.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]
Re: wicket-like framework to complement wicket?
On Fri, 05 Sep 2008 15:21:34 +0200, francisco treacy wrote: good! but i personally restrain from using db4o as its license is quite restrictive. that's why i'm supporting neodatis, which is slowly gaining momentum. Isn't DB4O released under GPL, as well as a commercial license? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: wicket-like framework to complement wicket?
GPL is very restrictive :) -igor On Fri, Sep 5, 2008 at 4:35 PM, Sam Stainsby [EMAIL PROTECTED] wrote: On Fri, 05 Sep 2008 15:21:34 +0200, francisco treacy wrote: good! but i personally restrain from using db4o as its license is quite restrictive. that's why i'm supporting neodatis, which is slowly gaining momentum. Isn't DB4O released under GPL, as well as a commercial license? - 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]